当前位置 博文首页 > dadalaohua的博客:【USB描述符系列】二维码扫描枪

    dadalaohua的博客:【USB描述符系列】二维码扫描枪

    作者:[db:作者] 时间:2021-07-27 11:46

    【USB描述符系列】二维码扫描枪

    简介

    使用了一款USB接口的二维码扫描枪,看了下这个设备的描述符也没有什么特别的。从描述符可以看到,这个设备就是枚举成一个HID KeyBoard,和普通的键盘没有什么区别。二维码扫描枪在扫描获取到信息后,作为HID键盘设备上报了键值。用的这个USB设备是一个Full Speed设备。

    下面是这个USB接口的二维码扫描枪的描述符,产品的VID和PID被我隐去了。

    Device Descriptor

    OffsetFieldSizeValueDescription
    0bLength112hSize of this descriptor
    1bDescriptorType101hDevice
    2bcdUSB20110hUSB Spec 1.1
    4bDeviceClass100hClass info in Ifc Descriptors
    5bDeviceSubClass100hUnused
    6bDeviceProtocol100hUnused
    7bMaxPacketSize0140h64 bytes
    8idVendor2XXXXhVendor ID
    10idProduct2XXXXhProduct ID
    12bcdDevice20001h0.01
    14iManufacturer100hUnused
    15iProduct100hUnused
    16iSerialNumber100hUnused
    17bNumConfigurations101hOne configuration

    Configuration Descriptor

    OffsetFieldSizeValueDescription
    0bLength109hSize of this descriptor
    1bDescriptorType102hConfiguration
    2wTotalLength20022hLength of the total configuration block, including this descriptor, in bytes
    4bNumInterfaces101hOne interfaces
    5bConfigurationValue101hID of this configuration
    6iConfiguration100hUnused
    7bmAttributes1A0hBus Powered, Remote Wakeup
    4…0: Reserved. . . 00000Unused
    5: Remote Wakeup. .1 . . . . .Yes
    6: Self Powered. 0 . . . . . .No, Bus Powered
    7: Reserved (set to one)
    (bus-powered for 1.0)
    1 . . . . . . .Unused
    8bMaxPower165h202 mA

    Interface Descriptor 0/0 HID, 1 Endpoints

    OffsetFieldSizeValueDescription
    0bLength109hSize of this descriptor
    1bDescriptorType104hINTERFACE
    2bInterfaceNumber100hIndex of this interface
    3bAlternateSetting100hIndex of this setting
    4bNumEndpoints101h1 endpoints
    5bInterfaceClass103hHID
    6bInterfaceSubClass101hBoot Interface
    7bInterfaceProtocol101hKeyboard
    8iInterface100hUnused

    HID Descriptor

    OffsetFieldSizeValueDescription
    0bLength109hSize of this descriptor
    1bDescriptorType121hHID
    2bcdHID20110h1.10
    4bCountryCode100h
    5bNumDescriptors101h
    6bDescriptorType122hReport
    7wDescriptorLength2006Ah106 bytes

    Endpoint Descriptor 81 1 In, Interrupt, 1 ms

    OffsetFieldSizeValueDescription
    0bLength107hSize of this descriptor
    1bDescriptorType105hEndpoint
    2bEndpointAddress181h1 In
    3bmAttributes103hInterrupt
    1…0: Transfer Type. . . . . .11Interrupt
    7…2: Reserved000000 . .Unused
    4wMaxPacketSize20040h64 bytes
    6bInterval101h1 ms

    Interface 0 HID Report Descriptor Keyboard

    Item Tag (Value)Raw Data
    Usage Page (Generic Desktop)05 01
    Usage (Keyboard)09 06
    Collection (Application)A1 01
    ?Usage Page (Keyboard/Keypad)05 07
    ?Report ID (3)85 03
    ?Usage Minimum (Keyboard Left Control)19 E0
    ?Usage Maximum (Keyboard Right GUI)29 E7
    ?Logical Minimum (0)15 00
    ?Logical Maximum (1)25 01
    ?Report Size (1)75 01
    ?Report Count (8)95 08
    ?Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)81 02
    ?Report Count (1)95 01
    ?Report Size (8)75 08
    ?Input (Cnst,Var,Abs,NWrp,Lin,Pref,NNul,Bit)81 03
    ?Report Count (1)95 01
    ?Report Size (8)75 08
    ?Logical Minimum (0)15 00
    ?Logical Maximum (-25)25 E7
    ?Usage Page (Keyboard/Keypad)05 07
    ?Usage Minimum (Undefined)19 00
    ?Usage Maximum (Keyboard LANG1)29 90
    ?Input(Data,Ary,Abs)81 00
    ?Report ID (3)85 03
    ?Report Count (5)95 05
    ?Report Size (1)75 01
    ?Usage Page (LEDs)05 08
    ?Usage Minimum (Num Lock)19 01
    ?Usage Maximum (Kana)29 05
    ?Output (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit)91 02
    ?Report Count (1)95 01
    ?Report Size (3)75 03
    ?Output (Cnst,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit)91 03
    End CollectionC0
    Usage Page (Generic Desktop)05 01
    Usage (Undefined)09 10
    Collection (Application)A1 01
    ?Usage Page (Keyboard/Keypad)05 07
    ?Report ID (186)85 BA
    ?Usage Minimum (Keyboard Left Control)19 E0
    ?Usage Maximum (Keyboard Right GUI)29 E7
    ?Logical Minimum (0)15 00
    ?Logical Maximum (-1)25 FF
    ?Report Size (63)75 3F
    ?Report Count (8)95 08
    ?Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)81 02
    ?Report ID (186)85 BA
    ?Report Count (8)95 08
    ?Report Size (63)75 3F
    ?Usage Page (LEDs)05 08
    ?Usage Minimum (Num Lock)19 01
    ?Usage Maximum (Kana)29 05
    ?Output (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit)91 02
    End CollectionC0

    本文链接:https://blog.csdn.net/u012028275/article/details/115569000

    cs