1

我有一个旧的 Compaq 键盘,上面有一组不起作用的键。

我已经尝试过xev, evtestevemu-record并且libinput debug-events除了这些键之外的所有其他键都可以识别。

但是,当我打开 Wireshark USB 记录器时,我会得到一些如下所示的输出:

0000   00 a8 6e e5 73 9c ff ff 42 01 82 0a 01 00 2d 00   ..o.s...C.....-.
0010   9e ab f1 5f 00 00 00 00 06 c6 03 00 00 00 00 00   ..._............
0020   06 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00   ................
0030   02 00 00 00 00 00 00 00 04 02 00 00 00 00 00 00   ................
0040   04 00 00 00 00 00                                 ......

0000   00 a8 6e e5 73 9c ff ff 42 01 82 0a 01 00 2d 00   ..o.s...C.....-.
0010   a0 ab f1 5f 00 00 00 00 66 64 01 00 00 00 00 00   ..._....fd......
0020   06 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00   ................
0030   02 00 00 00 00 00 00 00 04 02 00 00 00 00 00 00   ................
0040   04 00 00 10 00 00 

这意味着密钥确实有效,我只需要为它编写一个驱动程序。

现在我在编写 linux 驱动程序方面的经验为零,但我查看linux/drivers/hid/github.com/torvalds/linux,具体来说hid-asus.c,我知道我必须以某种方式用相应的十六进制值识别每个击键。

问题是我可以弄清楚在哪里看,因为只有十六进制转储的0000,00200030行保持不变,并且0010每次我通过wireshark记录它时都不同。

我知道这可能是基本的,但你能指出我正确的方向吗,即提供一些我可以阅读的关于这个主题的内容,或者知道我应该如何继续?

输出evtest

/dev/input/event12: Compaq Compaq Internet Keyboard
/dev/input/event13: Compaq Compaq Internet Keyboard Consumer Control
/dev/input/event14: Compaq Compaq Internet Keyboard System Control
/dev/input/event15: Compaq Compaq Internet Keyboard

这是来自的输出lsusb

Bus 001 Device 010: ID 049f:000e Compaq Computer Corp. Internet Keyboard
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x049f Compaq Computer Corp.
  idProduct          0x000e Internet Keyboard
  bcdDevice            1.00
  iManufacturer           1 Compaq
  iProduct                2 Compaq Internet Keyboard
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x003b
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          2 Compaq Internet Keyboard
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower               50mA
    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              3 Compaq Internet Keyboard
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.00
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      65
         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              24
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      0 
      iInterface              4 Compaq Internet Keyboard
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.00
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     499
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0006  1x 6 bytes
        bInterval               3
Device Status:     0x0000
  (Bus Powered) 
4

0 回答 0