2020年9月5日 星期六

Linux Kernel(20.1)- Input device user program


這裡簡單的描述一下如何寫一個user program去讀去input device data,基本上,就是直接open /dev/inputN,然後將data mapping成struct input_event。
struct input_event {
    struct timeval time;
    __u16 type;
    __u16 code;
    __s32 value;
};
type: event type
code: key code for EV_KEY
摘入一段/usr/include/linux/input-event-codes.h
/*
 * Event types
 */
#define EV_SYN          0x00
#define EV_KEY          0x01
#define EV_REL          0x02
#define EV_ABS          0x03
#define EV_MSC          0x04
#define EV_SW           0x05
#define EV_LED          0x11
#define EV_SND          0x12
#define EV_REP          0x14
#define EV_FF           0x15
#define EV_PWR          0x16
#define EV_FF_STATUS        0x17
#define EV_MAX          0x1f
#define EV_CNT          (EV_MAX+1)

/*
 * Key code
 */
#define KEY_RESERVED        0
#define KEY_ESC         1
#define KEY_1           2
#define KEY_2           3
...

#define BTN_MISC        0x100
#define BTN_0           0x100
#define BTN_1           0x101
#define BTN_2           0x102
...

#define KEY_OK          0x160
#define KEY_SELECT      0x161
...


#include <stdio.h>
#include <errno.h>

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#include <unistd.h>

#include <string.h>

#include <linux/input.h>

int main(int argc, char *argv[])
{
  struct input_event evt;
  int fd;
  fd = open(argv[1], O_RDONLY);
  if (fd < 0) {
    printf("open %s failed: %s/%d\n", argv[0], strerror(errno), errno);
    return -1;
  }

  while (1) {
    if (sizeof(evt) == read(fd, &evt, sizeof(evt))) {
      printf("type:%d, code:%d, val:%d\n", evt.type, evt.code, evt.value);
    } else {
      printf("read failed: %s/%d\n", strerror(errno), errno);
    }
  }
  return 0;
}


    參考資料:
  • Documentation/input/event-codes.rst



Citizens Broadband Radio Service (CBRS)


全球都將3.5GHz頻段的頻譜視為新一代電信服務的理想選擇,因為它既具備長距離傳輸的優勢,又有大量且連續的可用頻寬,包括中國、歐洲與南韓都已將它作為5G之用,台灣自去年底展開的5G頻譜競標,不只在今年初創下1,380億元新台幣的總標金紀錄,且最熱門的3.5GHz頻段的頻譜,總標金即達1364.33億元。

在FCC的3.5 GHz CBRS頻段釋出計畫中,引進了三層式頻譜接取架構。在此架構下,當Incumbents 與 PALs未使用該頻段時,GAAs皆可以使用。而當有很多GAAs處於同一場所時,要按照公平的原則使用可用頻率。因此,FCC將以SAS(Spectrum Access System),實現不同用戶及應用之間的頻譜共享。

Incumbents: 指的是那些原本在3.5G運作的使用者, 如 fixed satellite service, US Navy Radar等。
PALs(Priority Access Licenses): 指的是那些標下這個頻段使用者, 如service providers。
GAAs(General Authorized Access): 其他人。






2020年8月29日 星期六

PDN CONNECTIVITY REJECT Code


By 3GPP TS 24.244 version 16.0.0 Release 16
The cause IE typically indicates one of the following cause values:
  #8: operator determined barring;
  #26: insufficient resources;
  #27: missing or unknown APN;
  #28: unknown PDN type;
  #29: user authentication failed;
  #30: request rejected by PDN GW;
  #31: request rejected, unspecified;
  #32: service option not supported;
  #33: requested service option not subscribed;
  #34: service option temporarily out of order;
  #35: PTI already in use;
  #38: network failure;
  #50: PDN type IPv4 only allowed;
  #51: PDN type IPv6 only allowed;
  #52: single address bearers only allowed;
  #54: PDN connection does not exist;
  #55: multiple PDN connections for a given APN not allowed;
  #95 – 111: protocol errors;
  #113: Multiple accesses to a PDN connection not allowed; 




熱門文章