当前位置 博文首页 > dadalaohua的博客:【USB描述符系列】手持式条形扫描器

    dadalaohua的博客:【USB描述符系列】手持式条形扫描器

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

    【USB描述符系列】手持式条形扫描器

    简介

    使用了一款USB接口的手持式条形扫描器,就看了下这个USB设备的描述符是什么样了。从描述符可以看到,这个设备就是枚举成一个HID KeyBoard,和普通的键盘没有什么区别。条形扫描器在扫描获取到信息后,作为HID键盘设备上报了键值。

    下面是这个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
    12bcdDevice20100h1.00
    14iManufacturer101hIndex to string descriptor that contains the string < Your Name > in Unicode
    15iProduct102hIndex to string descriptor that contains the string < Your Product Name > in Unicode
    16iSerialNumber100hIndex to string descriptor that contains the string < Your Serial Number > in Unicode
    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
    7bmAttributes180hBus Powered
    4…0: Reserved. . . 00000Unused
    5: Remote Wakeup. .0 . . . . .No
    6: Self Powered. 0 . . . . . .No, Bus Powered
    7: Reserved (set to one)
    (bus-powered for 1.0)
    1 . . . . . . .Unused
    8bMaxPower196h300 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
    7wDescriptorLength2003Fh63 bytes

    Endpoint Descriptor 84 4 In, Interrupt, 1 ms

    OffsetFieldSizeValueDescription
    0bLength107hSize of this descriptor
    1bDescriptorType105hEndpoint
    2bEndpointAddress184h4 In
    3bmAttributes103hInterrupt
    1…0: Transfer Type. . . . . .11Interrupt
    7…2: Reserved000000 . .Unused
    4wMaxPacketSize20008h8 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
    ?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 (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
    ?Report Count (6)95 06
    ?Report Size (8)75 08
    ?Logical Minimum (0)15 00
    ?Logical Maximum (101)25 65
    ?Usage Page (Keyboard/Keypad)05 07
    ?Usage Minimum (Undefined)19 00
    ?Usage Maximum (Keyboard Application)29 65
    ?Input (Data,Ary,Abs)81 00
    End CollectionC0

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

    cs