首先用 cat /proc/bus/input/devices 確定讀卡器設備在系統裡的注冊信息
cat /proc/bus/input/devicesI: 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
};