HID实例

键盘

电脑上使用hexdump查看键盘设备节点,输入a后,获得的原始HID数据如下:

sudo hexdump -e '8/1 " %02X" "\n"' /dev/hidraw1
Selection_286.png

第一行04代表a,这一行数据过来代表a键down的事件;
第二行全部00,这一行数据过来代表a键抬起的事件;
两行代表按键的操作流程。

当然使用usbhid-dump更为直观,如下所示:

Selection_287.png

触摸屏

Selection_288.png

描述符:

05 0d 09 04 a1 01 85 01 09 22 a1 02 09 42 15 00 25 01 75 01 95 01 81 02 95 07 81 03 26 ff 00 75 08 95 01 09 51 81 02 09 30 81 02 75 10 95 01 05 01 55 0f 65 11 26 00 04 35 00 46 ff ff 09 30 81 02 46 ff ff 26 58 02 09 31 81 02 c0 05 0d 55 0c 66 01 10 47 ff ff 00 00 27 ff ff 00 00 75 10 95 01 09 56 81 02 05 0d 09 54 25 7f 95 01 75 08 81 02 85 02 09 55 95 01 25 02 b1 02 c0 

  INPUT(1)[INPUT]
    Field(0)
      Logical(Digitizers.Finger)
      Application(Digitizers.TouchScreen)
      Usage(1)
        Digitizers.TipSwitch
      Logical Minimum(0)
      Logical Maximum(1)
      Report Size(1)
      Report Count(1)
      Report Offset(0)
      Flags( Variable Absolute )
    Field(1)
      Logical(Digitizers.Finger)
      Application(Digitizers.TouchScreen)
      Usage(1)
        Digitizers.ContactID
      Logical Minimum(0)
      Logical Maximum(255)
      Report Size(8)
      Report Count(1)
      Report Offset(8)
      Flags( Variable Absolute )
    Field(2)
      Logical(Digitizers.Finger)
      Application(Digitizers.TouchScreen)
      Usage(1)
        Digitizers.TipPressure
      Logical Minimum(0)
      Logical Maximum(255)
      Report Size(8)
      Report Count(1)
      Report Offset(16)
      Flags( Variable Absolute )
    Field(3)
      Logical(Digitizers.Finger)
      Application(Digitizers.TouchScreen)
      Usage(1)
        GenericDesktop.X
      Logical Minimum(0)
      Logical Maximum(1024)
      Physical Minimum(0)
      Physical Maximum(65535)
      Unit Exponent(-1)
      Unit(SI Linear : Centimeter)
      Report Size(16)
      Report Count(1)
      Report Offset(24)
      Flags( Variable Absolute )
    Field(4)
      Logical(Digitizers.Finger)
      Application(Digitizers.TouchScreen)
      Usage(1)
        GenericDesktop.Y
      Logical Minimum(0)
      Logical Maximum(600)
      Physical Minimum(0)
      Physical Maximum(65535)
      Unit Exponent(-1)
      Unit(SI Linear : Centimeter)
      Report Size(16)
      Report Count(1)
      Report Offset(40)
      Flags( Variable Absolute )
    Field(5)
      Application(Digitizers.TouchScreen)
      Usage(1)
        Digitizers.0056
      Logical Minimum(0)
      Logical Maximum(65535)
      Physical Minimum(0)
      Physical Maximum(65535)
      Unit Exponent(-4)
      Unit(SI Linear : Seconds)
      Report Size(16)
      Report Count(1)
      Report Offset(56)
      Flags( Variable Absolute )
    Field(6)
      Application(Digitizers.TouchScreen)
      Usage(1)
        Digitizers.ContactCount
      Logical Minimum(0)
      Logical Maximum(127)
      Physical Minimum(0)
      Physical Maximum(65535)
      Unit Exponent(-4)
      Unit(SI Linear : Seconds)
      Report Size(8)
      Report Count(1)
      Report Offset(72)
      Flags( Variable Absolute )
  FEATURE(2)[FEATURE]
    Field(0)
      Application(Digitizers.TouchScreen)
      Usage(1)
        Digitizers.ContactMaximumNumber
      Logical Minimum(0)
      Logical Maximum(2)
      Physical Minimum(0)
      Physical Maximum(65535)
      Unit Exponent(-4)
      Unit(SI Linear : Seconds)
      Report Size(8)
      Report Count(1)
      Report Offset(0)
      Flags( Variable Absolute )

Digitizers.TipSwitch ---> Key.Touch
Digitizers.ContactID ---> Sync.Report
Digitizers.TipPressure ---> Absolute.?
GenericDesktop.X ---> Absolute.MTPositionX
GenericDesktop.Y ---> Absolute.MTPositionY
Digitizers.0056 ---> Absolute.Misc
Digitizers.ContactCount ---> Sync.Report

将描述符和输入事件对应起来:


Selection_291.png

你可能感兴趣的:(HID实例)