ARM Linux 2.6.36 内核 USB读卡器 测试程序


首先用  cat /proc/bus/input/devices 确定读卡器设备在系统里的注册信息

cat /proc/bus/input/devices

I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="gpio-keys"
P: Phys=gpio-keys/input0
S: Sysfs=/devices/platform/gpio-keys/input/input0
U: Uniq=
H: Handlers=kbd event0
B: PROP=0
B: EV=3
B: KEY=1680 0 0 10000002

I: Bus=0019 Vendor=0001 Product=0001 Version=0001
N: Name="s3c-keypad"
P: Phys=s3c-keypad/input0
S: Sysfs=/devices/virtual/input/input1
U: Uniq=
H: Handlers=kbd event1
B: PROP=0
B: EV=100003
B: KEY=1680 0 0 10004ffc

I: Bus=0013 Vendor=dead Product=beef Version=0101
N: Name="S3C TouchScreen"
P: Phys=input(ts)
S: Sysfs=/devices/virtual/input/input2
U: Uniq=
H: Handlers=mouse0 event2
B: PROP=0
B: EV=b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=1000003

I: Bus=0003 Vendor=08ff Product=0009 Version=0110
N: Name="USB Reader With Keyboard"
P: Phys=usb-s3c24xx-1/input0
S: Sysfs=/devices/platform/s3c2410-ohci/usb1/1-1/1-1:1.0/input/input3
U: Uniq=
H: Handlers=sysrq kbd event3
B: PROP=0
B: EV=120013
B: KEY=e080ffdf 1cfffff ffffffff fffffffe
B: MSC=10
B: LED=1f

 系统input_event事件定义

struct input_event {
 struct timeval time;       //事件触发的时间
 __u16 type;                    //事件类型
 __u16 code;                  //代码,如果是键盘则是按键代码
 __s32 value;                 //如果是键盘则value = KeyDown 或者 KeyUP
};

  • 1
  • 2
  • 下一页

相关内容