linux 键盘过滤,linux – 需要拦截HID Keyboard事件(然后阻止它们)

我有一个RFID USB设备,注册为HID设备(A USB键盘或多或少).

我正在寻找一种方法来捕获此输入,并在它碰到普通键盘事件处理程序(并将10位数的RFID代码输出到控制台)之前对其进行阻塞/过滤.

我当然必须专门捕获这个设备,并且将真正的键盘输入单独留下(或传递给它).

我最初的想法是在UDEV中阻止设备(所以usbhid / event / kbd内核模块没有绑定到它),并为这个设备编写自己的基本驱动程序 – 但是我不知道从哪里开始,甚至会工作

什么是伟大的(我不知道这样的事情可以做到) – 是如果我写一个事件过滤器模块,可以与事件驱动程序保持一致,并捕获(然后过滤)适当的输入从RFID单元,但让其他一切通过.我想象这样一个模块不需要太多的代码,这将是最实际的.

帮帮我?

[编辑:我应该补充说,Xorg没有安装 – 仅控制台]

cat /proc/bus/input:

I: Bus=0003 Vendor=0419 Product=0912 Version=0100

N: Name="NewRoad Sem. NewRoad System PS2 Interface"

P: Phys=usb-0000:00:1d.3-2/input0

S: Sysfs=/devices/pci0000:00/0000:00:1d.3/usb5/5-2/5-2:1.0/input/input20

U: Uniq=

H: Handlers=sysrq kbd mouse0 event3

B: PROP=0

B: EV=120017

B: KEY=70000 0 0 e080ffdf01cfffff fffffffffffffffe

B: REL=103

B: MSC=10

B: LED=1f

更多信息:

lsusb -d 0419:0912 -v

Bus 005 Device 019: ID 0419:0912 Samsung Info. Systems America, Inc.

Device Descriptor:

bLength 18

bDescriptorType 1

bcdUSB 1.00

bDeviceClass 0 (Defined at Interface level)

bDeviceSubClass 0

bDeviceProtocol 0

bMaxPacketSize0 8

idVendor 0x0419 Samsung Info. Systems America, Inc.

idProduct 0x0912

bcdDevice 0.01

iManufacturer 1 NewRoad Sem.

iProduct 2 NewRoad System PS2 Interface

iSerial 0

bNumConfigurations 1

Configuration Descriptor:

bLength 9

bDescriptorType 2

wTotalLength 34

bNumInterfaces 1

bConfigurationValue 1

iConfiguration 4

bmAttributes 0xa0

(Bus Powered)

Remote Wakeup

MaxPower 100mA

Interface Descriptor:

bLength 9

bDescriptorType 4

bInterfaceNumber 0

bAlternateSetting 0

bNumEndpoints 1

bInterfaceClass 3 Human Interface Device

bInterfaceSubClass 1 Boot Interface Subclass

bInterfaceProtocol 1 Keyboard

iInterface 5

HID Device Descriptor:

bLength 9

bDescriptorType 33

bcdHID 1.00

bCountryCode 0 Not supported

bNumDescriptors 1

bDescriptorType 34 Report

wDescriptorLength 119

Report Descriptors:

** UNAVAILABLE **

Endpoint Descriptor:

bLength 7

bDescriptorType 5

bEndpointAddress 0x81 EP 1 IN

bmAttributes 3

Transfer Type Interrupt

Synch Type None

Usage Type Data

wMaxPacketSize 0x0008 1x 8 bytes

bInterval 10

Device Status: 0x0000

(Bus Powered)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值