HID设备示例
+ -

USB键盘HID设备示例

2021-12-19 1691 1

该键盘是一个比较复杂的复合设备,其中接口0实现的是键盘功能,接口1又因为报告描述符分为三个HID设备。
USB键盘

BUSHOUND下的设备ID关系:
BUSHOUND设备树
在BUSHOUND抓取该USB键盘的枚举过程:

Device  Length    Phase  Data                                                Description       
------  --------  -----  --------------------------------------------------  ----------------  
   8.0            CTL    80 06 00 01  00 00 12 00                            GET DESCRIPTOR    
   8.0        18  IN     12 01 10 01  00 00 00 08  6d 04 1c c3  00 64 01 02  ........m....d..  
                         00 01                                               ..                
   8.0            CTL    80 06 00 02  00 00 09 00                            GET DESCRIPTOR    
   8.0         9  IN     09 02 3b 00  02 01 03 a0  2d                        ..;.....-         
   8.0            CTL    80 06 00 02  00 00 3b 00                            GET DESCRIPTOR    
   8.0        59  IN     09 02 3b 00  02 01 03 a0  2d 09 04 00  00 01 03 01  ..;.....-.......  
                         01 02 09 21  10 01 00 01  22 41 00 07  05 81 03 08  ...!...."A......  
                         00 0a 09 04  01 00 01 03  00 00 02 09  21 10 01 00  ............!...  
                         01 22 9f 00  07 05 82 03  04 00 ff                  .".........       
   8.0            CTL    00 09 01 00  00 00 00 00                            SET CONFIG        
   8.0            CTL    80 06 02 03  09 04 04 00                            GET DESCRIPTOR    
   8.0         4  IN     1a 03 55 00                                         ..U.              
   8.0            CTL    80 06 02 03  09 04 1a 00                            GET DESCRIPTOR    
   8.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
   8.0            CTL    80 06 02 03  09 04 04 00                            GET DESCRIPTOR    
   8.0         4  IN     1a 03 55 00                                         ..U.              
   8.0            CTL    80 06 02 03  09 04 1a 00                            GET DESCRIPTOR    
   8.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
  12.0            CTL    80 06 00 01  00 00 12 00                            GET DESCRIPTOR    
  12.0        18  IN     12 01 10 01  00 00 00 08  6d 04 1c c3  00 64 01 02  ........m....d..  
                         00 01                                               ..                
  12.0            CTL    80 06 00 02  00 00 09 00                            GET DESCRIPTOR    
  12.0         9  IN     09 02 22 00  01 01 03 a0  2d                        ..".....-         
  12.0            CTL    80 06 00 02  00 00 22 00                            GET DESCRIPTOR    
  12.0        34  IN     09 02 22 00  01 01 03 a0  2d 09 04 00  00 01 03 01  ..".....-.......  
                         01 02 09 21  10 01 00 01  22 41 00 07  05 81 03 08  ...!...."A......  
                         00 0a                                               ..                
  12.0            CTL    00 09 01 00  00 00 00 00                            SET CONFIG        
  12.0            CTL    21 0a 00 00  00 00 00 00                            SET IDLE          
  12.0            CTL    81 06 00 22  00 00 81 00                            GET DESCRIPTOR    
  12.0        65  IN     05 01 09 06  a1 01 05 07  19 e0 29 e7  15 00 25 01  ..........)...%.  
                         75 01 95 08  81 02 95 01  75 08 81 01  95 05 75 01  u.......u.....u.  
                         05 08 19 01  29 05 91 02  95 01 75 03  91 01 95 06  ....).....u.....  
                         75 08 15 00  26 ff 00 05  07 19 00 2a  ff 00 81 00  u...&......*....  
                         c0                                                  .                 
  13.0            CTL    80 06 00 01  00 00 12 00                            GET DESCRIPTOR    
  13.0        18  IN     12 01 10 01  00 00 00 08  6d 04 1c c3  00 64 01 02  ........m....d..  
                         00 01                                               ..                
  13.0            CTL    80 06 00 02  00 00 09 00                            GET DESCRIPTOR    
  13.0         9  IN     09 02 22 00  01 01 03 a0  2d                        ..".....-         
  13.0            CTL    80 06 00 02  00 00 22 00                            GET DESCRIPTOR    
  13.0        34  IN     09 02 22 00  01 01 03 a0  2d 09 04 01  00 01 03 00  ..".....-.......  
                         00 02 09 21  10 01 00 01  22 9f 00 07  05 82 03 04  ...!....".......  
                         00 ff                                               ..                
  13.0            CTL    00 09 01 00  00 00 00 00                            SET CONFIG        
  13.0            CTL    21 0a 00 00  01 00 00 00                            SET IDLE          
  13.0            CTL    81 06 00 22  01 00 df 00                            GET DESCRIPTOR    
  13.0       159  IN     05 0c 09 01  a1 01 85 01  09 e0 15 e8  25 18 75 07  ............%.u.  
                         95 01 81 06  15 00 25 01  75 01 09 e2  81 06 c0 06  ......%.u.......  
                         01 00 09 80  a1 01 85 02  25 01 15 00  75 01 0a 81  ........%...u...  
                         00 0a 82 00  0a 83 00 95  03 81 06 95  05 81 01 c0  ................  
                         06 0c 00 09  01 a1 01 85  03 25 01 15  00 75 01 0a  .........%...u..  
                         b5 00 0a b6  00 0a b7 00  0a b8 00 0a  cd 00 0a e2  ................  
                         00 0a e9 00  0a ea 00 95  08 81 02 0a  83 01 0a 8a  ................  
                         01 0a 92 01  0a 94 01 0a  21 02 0a 23  02 0a 24 02  ........!..#..$.  
                         0a 25 02 95  08 81 02 0a  26 02 0a 27  02 0a 2a 02  .%......&..'..*.  
                         0a b3 00 0a  b4 00 95 05  81 02 95 03  81 01 c0     ...............   
  12.0            CTL    21 09 00 02  00 00 01 00                            SET REPORT        
  12.0         1  OUT    01                                                  .                 
  13.0            CTL    80 06 02 03  09 04 0a 02                            GET DESCRIPTOR    
  13.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
  13.0            CTL    80 06 02 03  09 04 0a 02                            GET DESCRIPTOR    
  13.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
  13.0            CTL    80 06 02 03  09 04 0a 02                            GET DESCRIPTOR    
  13.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
  13.0            CTL    80 06 02 03  09 04 0a 02                            GET DESCRIPTOR    
  13.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
  13.0            CTL    80 06 02 03  09 04 0a 02                            GET DESCRIPTOR    
  13.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
  13.0            CTL    80 06 02 03  09 04 0a 02                            GET DESCRIPTOR    
  13.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
  13.0            CTL    80 06 02 03  09 04 0a 02                            GET DESCRIPTOR    
  13.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
  13.0            CTL    80 06 02 03  09 04 0a 02                            GET DESCRIPTOR    
  13.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
  13.0            CTL    80 06 02 03  09 04 0a 02                            GET DESCRIPTOR    
  13.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
  13.0            CTL    80 06 02 03  09 04 0a 02                            GET DESCRIPTOR    
  13.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
  13.0            CTL    80 06 02 03  09 04 0a 02                            GET DESCRIPTOR    
  13.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
  13.0            CTL    80 06 02 03  09 04 0a 02                            GET DESCRIPTOR    
  13.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
   8.0            CTL    80 06 00 02  00 00 09 00                            GET DESCRIPTOR    
   8.0         9  IN     09 02 3b 00  02 01 03 a0  2d                        ..;.....-         
   8.0            CTL    80 06 00 02  00 00 3b 00                            GET DESCRIPTOR    
   8.0        59  IN     09 02 3b 00  02 01 03 a0  2d 09 04 00  00 01 03 01  ..;.....-.......  
                         01 02 09 21  10 01 00 01  22 41 00 07  05 81 03 08  ...!...."A......  
                         00 0a 09 04  01 00 01 03  00 00 02 09  21 10 01 00  ............!...  
                         01 22 9f 00  07 05 82 03  04 00 ff                  .".........       
  13.0            CTL    80 06 02 03  09 04 0a 02                            GET DESCRIPTOR    
  13.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
  13.0            CTL    80 06 02 03  09 04 0a 02                            GET DESCRIPTOR    
  13.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
  13.0            CTL    80 06 02 03  09 04 0a 02                            GET DESCRIPTOR    
  13.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
  13.0            CTL    80 06 02 03  09 04 0a 02                            GET DESCRIPTOR    
  13.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
  13.0            CTL    80 06 02 03  09 04 0a 02                            GET DESCRIPTOR    
  13.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
  13.0            CTL    80 06 02 03  09 04 0a 02                            GET DESCRIPTOR    
  13.0        26  IN     1a 03 55 00  53 00 42 00  20 00 4b 00  65 00 79 00  ..U.S.B. .K.e.y.  
                         62 00 6f 00  61 00 72 00  64 00                     b.o.a.r.d.        
  12.1         8  IN     00 00 28 00  00 00 00 00                            ..(.....          
  15          12  IN     01 00 1c 00  00 00 00 00  00 00 00 00               ............      
  12.1         8  IN     00 00 00 00  00 00 00 00                            ........          
  15          12  IN     01 00 1c 00  01 00 00 00  00 00 00 00               ............      
  12.1         8  IN     01 00 00 00  00 00 00 00                            ........          
  15          12  IN     01 00 1d 00  00 00 00 00  00 00 00 00               ............      
  12.1         8  IN     00 00 00 00  00 00 00 00                            ........          
  15          12  IN     01 00 1d 00  01 00 00 00  00 00 00 00               ............      
  12.1         8  IN     00 00 04 00  00 00 00 00                            ........

在USBTreeView中的设备描述符信息如下:


    =========================== USB Port6 ===========================

Connection Status        : 0x01 (Device is connected)
Port Chain               : 2-6
Properties               : 0x01
 IsUserConnectable       : yes
 PortIsDebugCapable      : no
 PortHasMultiCompanions  : no
 PortConnectorIsTypeC    : no
ConnectionIndex          : 6
CompanionIndex           : 0
 CompanionHubSymLnk      : USB#ROOT_HUB30#4&186df573&0&0#{f18a0e88-c30c-11d0-8815-00a0c906bed8}
 CompanionPortNumber     : 22
 -> CompanionPortChain   : 2-22

      ======================== USB Device ========================

        +++++++++++++++++ Device Information ++++++++++++++++++
Device Description       : USB Composite Device
Device Path              : \\?\USB#VID_046D&PID_C31C#5&1e7d8db7&0&6#{a5dcbf10-6530-11d2-901f-00c04fb951ed} (GUID_DEVINTERFACE_USB_DEVICE)
Kernel Name              : \Device\USBPDO-2
Device ID                : USB\VID_046D&PID_C31C\5&1E7D8DB7&0&6
Hardware IDs             : USB\VID_046D&PID_C31C&REV_6400 USB\VID_046D&PID_C31C
Driver KeyName           : {36fc9e60-c465-11cf-8056-444553540000}\0009 (GUID_DEVCLASS_USB)
Driver                   : \SystemRoot\System32\drivers\usbccgp.sys (Version: 10.0.14393.1794  Date: 2017-10-09)
Driver Inf               : C:\Windows\inf\usb.inf
Legacy BusType           : PNPBus
Class                    : USB
Class GUID               : {36fc9e60-c465-11cf-8056-444553540000} (GUID_DEVCLASS_USB)
Service                  : usbccgp
Enumerator               : USB
Location Info            : Port_#0006.Hub_#0001
Location IDs             : PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(6), ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC_)#ACPI(RHUB)#ACPI(HS06)
Container ID             : {6d8fbade-d8e4-11eb-a930-74d83e3f7533}
Manufacturer Info        : (标准 USB 主控制器)
Capabilities             : 0x84 (Removable, SurpriseRemovalOK)
Status                   : 0x0180600A (DN_DRIVER_LOADED, DN_STARTED, DN_DISABLEABLE, DN_REMOVABLE, DN_NT_ENUMERATOR, DN_NT_DRIVER)
Problem Code             : 0
Address                  : 6
HcDisableSelectiveSuspend: 0
EnableSelectiveSuspend   : 0
SelectiveSuspendEnabled  : 0
EnhancedPowerMgmtEnabled : 0
IdleInWorkingState       : 0
WakeFromSleepState       : 0
Power State              : D0 (supported: D0, D1, D2, D3, wake from D0, wake from D1, wake from D2)
 Child Device 1          : USB 输入设备
  Device ID              : USB\VID_046D&PID_C31C&MI_00\6&200DCAF3&0&0000
  Class                  : HIDClass
  Driver KeyName         : {745a17a0-74d3-11d0-b6fe-00a0c90f57da}\0004 (GUID_DEVCLASS_HIDCLASS)
  Service                : HidUsb
   Child Device 1        : HID Keyboard Device
    Device Path 1        : \\?\HID#VID_046D&PID_C31C&MI_00#7&3a883424&0&0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd} (GUID_DEVINTERFACE_KEYBOARD)
    Device Path 2        : \\?\HID#VID_046D&PID_C31C&MI_00#7&3a883424&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} (GUID_DEVINTERFACE_HID)
    Kernel Name          : \Device\00000105
    Device ID            : HID\VID_046D&PID_C31C&MI_00\7&3A883424&0&0000
    Class                : Keyboard
    Driver KeyName       : {4d36e96b-e325-11ce-bfc1-08002be10318}\0003 (GUID_DEVCLASS_KEYBOARD)
    Service              : kbdhid
 Child Device 2          : USB 输入设备
  Device ID              : USB\VID_046D&PID_C31C&MI_01\6&200DCAF3&0&0001
  Class                  : HIDClass
  Driver KeyName         : {745a17a0-74d3-11d0-b6fe-00a0c90f57da}\0005 (GUID_DEVCLASS_HIDCLASS)
  Service                : HidUsb
   Child Device 1        : 符合 HID 标准的用户控制设备
    Device Path          : \\?\HID#VID_046D&PID_C31C&MI_01&Col01#7&22c4a7df&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} (GUID_DEVINTERFACE_HID)
    Kernel Name          : \Device\00000106
    Device ID            : HID\VID_046D&PID_C31C&MI_01&COL01\7&22C4A7DF&0&0000
    Class                : HIDClass
    Driver KeyName       : {745a17a0-74d3-11d0-b6fe-00a0c90f57da}\0010 (GUID_DEVCLASS_HIDCLASS)
   Child Device 2        : 符合 HID 标准的系统控制器
    Device Path 1        : \\?\HID#VID_046D&PID_C31C&MI_01&Col02#7&22c4a7df&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030} (GUID_DEVINTERFACE_HID)
    Device Path 2        : \\?\HID#VID_046D&PID_C31C&MI_01&Col02#7&22c4a7df&0&0001#{4afa3d53-74a7-11d0-be5e-00a0c9062857} (GUID_DEVICE_SYS_BUTTON)
    Kernel Name          : \Device\00000107
    Device ID            : HID\VID_046D&PID_C31C&MI_01&COL02\7&22C4A7DF&0&0001
    Class                : HIDClass
    Driver KeyName       : {745a17a0-74d3-11d0-b6fe-00a0c90f57da}\0011 (GUID_DEVCLASS_HIDCLASS)
   Child Device 3        : 符合 HID 标准的用户控制设备
    Device Path          : \\?\HID#VID_046D&PID_C31C&MI_01&Col03#7&22c4a7df&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030} (GUID_DEVINTERFACE_HID)
    Kernel Name          : \Device\00000108
    Device ID            : HID\VID_046D&PID_C31C&MI_01&COL03\7&22C4A7DF&0&0002
    Class                : HIDClass
    Driver KeyName       : {745a17a0-74d3-11d0-b6fe-00a0c90f57da}\0012 (GUID_DEVCLASS_HIDCLASS)

        +++++++++++++++++ Registry USB Flags +++++++++++++++++
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbflags\046DC31C6400
 NewInterfaceUsage       : REG_DWORD 00000000 (0)

        ---------------- Connection Information ---------------
Connection Index         : 0x06 (6)
Connection Status        : 0x01 (DeviceConnected)
Current Config Value     : 0x01
Device Address           : 0x0D (13)
Is Hub                   : 0x00 (no)
Device Bus Speed         : 0x00 (Low-Speed)
Number Of Open Pipes     : 0x02 (2 pipes to data endpoints)
Pipe[0]                  : EndpointID=1  Direction=IN   ScheduleOffset=0  Type=Interrupt
Pipe[1]                  : EndpointID=2  Direction=IN   ScheduleOffset=0  Type=Interrupt
Data (HexDump)           : 06 00 00 00 12 01 10 01 00 00 00 08 6D 04 1C C3   ............m...
                           00 64 01 02 00 01 01 00 00 0D 00 02 00 00 00 01   .d..............
                           00 00 00 07 05 81 03 08 00 0A 00 00 00 00 07 05   ................
                           82 03 04 00 FF 00 00 00 00                        .........

        --------------- Connection Information V2 -------------
Connection Index         : 0x06 (6)
Length                   : 0x10 (16 bytes)
SupportedUsbProtocols    : 0x03
 Usb110                  : 1 (yes)
 Usb200                  : 1 (yes)
 Usb300                  : 0 (no)
 ReservedMBZ             : 0x00
Flags                    : 0x00
 DevIsOpAtSsOrHigher     : 0 (Is not operating at SuperSpeed or higher)
 DevIsSsCapOrHigher      : 0 (Is not SuperSpeed capable or higher)
 DevIsOpAtSsPlusOrHigher : 0 (Is not operating at SuperSpeedPlus or higher)
 DevIsSsPlusCapOrHigher  : 0 (Is not SuperSpeedPlus capable or higher)
 ReservedMBZ             : 0x00
Data (HexDump)           : 06 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00   ................

    ---------------------- Device Descriptor ----------------------
bLength                  : 0x12 (18 bytes)
bDescriptorType          : 0x01 (Device Descriptor)
bcdUSB                   : 0x110 (USB Version 1.10)
bDeviceClass             : 0x00 (defined by the interface descriptors)
bDeviceSubClass          : 0x00
bDeviceProtocol          : 0x00
bMaxPacketSize0          : 0x08 (8 bytes)
idVendor                 : 0x046D (Logitech Inc.)
idProduct                : 0xC31C
bcdDevice                : 0x6400
iManufacturer            : 0x01 (String Descriptor 1)
 Language 0x0409         : "Logitech"
iProduct                 : 0x02 (String Descriptor 2)
 Language 0x0409         : "USB Keyboard"
iSerialNumber            : 0x00 (No String Descriptor)
bNumConfigurations       : 0x01 (1 Configuration)
Data (HexDump)           : 12 01 10 01 00 00 00 08 6D 04 1C C3 00 64 01 02   ........m....d..
                           00 01                                             ..

    ------------------ Configuration Descriptor -------------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x02 (Configuration Descriptor)
wTotalLength             : 0x003B (59 bytes)
bNumInterfaces           : 0x02 (2 Interfaces)
bConfigurationValue      : 0x01 (Configuration 1)
iConfiguration           : 0x03 (String Descriptor 3)
 Language 0x0409         : "U64.00_B0001"
bmAttributes             : 0xA0
 D7: Reserved, set 1     : 0x01
 D6: Self Powered        : 0x00 (no)
 D5: Remote Wakeup       : 0x01 (yes)
 D4..0: Reserved, set 0  : 0x00
MaxPower                 : 0x2D (90 mA)
Data (HexDump)           : 09 02 3B 00 02 01 03 A0 2D 09 04 00 00 01 03 01   ..;.....-.......
                           01 02 09 21 10 01 00 01 22 41 00 07 05 81 03 08   ...!...."A......
                           00 0A 09 04 01 00 01 03 00 00 02 09 21 10 01 00   ............!...
                           01 22 9F 00 07 05 82 03 04 00 FF                  .".........

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x00
bAlternateSetting        : 0x00
bNumEndpoints            : 0x01 (1 Endpoint)
bInterfaceClass          : 0x03 (HID - Human Interface Device)
bInterfaceSubClass       : 0x01 (Boot Interface)
bInterfaceProtocol       : 0x01 (Keyboard)
iInterface               : 0x02 (String Descriptor 2)
 Language 0x0409         : "USB Keyboard"
Data (HexDump)           : 09 04 00 00 01 03 01 01 02                        .........

        ------------------- HID Descriptor --------------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x21 (HID Descriptor)
bcdHID                   : 0x0110 (HID Version 1.10)
bCountryCode             : 0x00 (00 = not localized)
bNumDescriptors          : 0x01
Data (HexDump)           : 09 21 10 01 00 01 22 41 00                        .!...."A.
Descriptor 1:
bDescriptorType          : 0x22 (Class=Report)
wDescriptorLength        : 0x0041 (65 bytes)
Error reading descriptor : ERROR_INVALID_PARAMETER

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x81 (Direction=IN EndpointID=1)
bmAttributes             : 0x03 (TransferType=Interrupt)
wMaxPacketSize           : 0x0008
bInterval                : 0x0A (10 ms)
Data (HexDump)           : 07 05 81 03 08 00 0A                              .......

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x01
bAlternateSetting        : 0x00
bNumEndpoints            : 0x01 (1 Endpoint)
bInterfaceClass          : 0x03 (HID - Human Interface Device)
bInterfaceSubClass       : 0x00 (None)
bInterfaceProtocol       : 0x00 (None)
iInterface               : 0x02 (String Descriptor 2)
 Language 0x0409         : "USB Keyboard"
Data (HexDump)           : 09 04 01 00 01 03 00 00 02                        .........

        ------------------- HID Descriptor --------------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x21 (HID Descriptor)
bcdHID                   : 0x0110 (HID Version 1.10)
bCountryCode             : 0x00 (00 = not localized)
bNumDescriptors          : 0x01
Data (HexDump)           : 09 21 10 01 00 01 22 9F 00                        .!...."..
Descriptor 1:
bDescriptorType          : 0x22 (Class=Report)
wDescriptorLength        : 0x009F (159 bytes)
Error reading descriptor : ERROR_INVALID_PARAMETER

        ----------------- Endpoint Descriptor -----------------
bLength                  : 0x07 (7 bytes)
bDescriptorType          : 0x05 (Endpoint Descriptor)
bEndpointAddress         : 0x82 (Direction=IN EndpointID=2)
bmAttributes             : 0x03 (TransferType=Interrupt)
wMaxPacketSize           : 0x0004
bInterval                : 0xFF (255 ms)
Data (HexDump)           : 07 05 82 03 04 00 FF                              .......

      -------------------- String Descriptors -------------------
             ------ String Descriptor 0 ------
bLength                  : 0x04 (4 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language ID[0]           : 0x0409 (English - United States)
Data (HexDump)           : 04 03 09 04                                       ....
             ------ String Descriptor 1 ------
bLength                  : 0x12 (18 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "Logitech"
Data (HexDump)           : 12 03 4C 00 6F 00 67 00 69 00 74 00 65 00 63 00   ..L.o.g.i.t.e.c.
                           68 00                                             h.
             ------ String Descriptor 2 ------
bLength                  : 0x1A (26 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "USB Keyboard"
Data (HexDump)           : 1A 03 55 00 53 00 42 00 20 00 4B 00 65 00 79 00   ..U.S.B. .K.e.y.
                           62 00 6F 00 61 00 72 00 64 00                     b.o.a.r.d.
             ------ String Descriptor 3 ------
bLength                  : 0x1A (26 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "U64.00_B0001"
Data (HexDump)           : 1A 03 55 00 36 00 34 00 2E 00 30 00 30 00 5F 00   ..U.6.4...0.0._.
                           42 00 30 00 30 00 30 00 31 00                     B.0.0.0.1.
HID人机交互QQ群:564808376    UAC音频QQ群:218581009    UVC相机QQ群:331552032    BOT&UASP大容量存储QQ群:258159197    STC-USB单片机QQ群:315457461    USB技术交流QQ群2:580684376    USB技术交流QQ群:952873936   

0 篇笔记 写笔记

HID键盘设备数据抓包分析实践
本文使用 Bus Hound 工具对 USB HID 设备数据包进行分析,并结合官方手册及网上文章进行整理。在进行数据分析前,我们先回顾一下USB相关的基础知识。USB描述符USB 主机是通过各种描述符来识别设备的,有设备描述符,接口描述符,端点描述符,字符描述符,报告描述符(HID)等。和普通的......
USB键盘报告描述符数据格式分析
USB键盘的HID报表描述符的内容参见下表。数据的输入端点为中断方式,当有键盘敲击事件时,会上报数据长度为8字节的数据报告。0x05,0x01,// Global Generic Desktop0x09,0x06,// Local KeyBoard 0xA1,0x01,// Main app col......
HID 报表描述符键盘实例
通过下面的报告描述符的定义,我们根据上面的注释可知,包含一个中断输入报表描述符和一个中断输出报告描述符。其中断输入报告描述符用于USB HID键盘中断输入端点,输出报表描述符用于USB HID键盘中断输出端点。USB HID键盘的中断输入报告对于中断输入端点,数据格式定义如下:BYTE0:该字......
BIOS下识别USB键盘
在BIOS下要识别一个USB键盘和在操作系统下识别一个USB键盘其实是有一些区别的:首先接口描述符中bInterfaceClass的值必须为0x03,bInterfaceSubClass的值为0或1,为1表示HID设备符是一个启动设备(Boot Device,一般对PC机而言才有意义,意思是BIO......
为什么Windows7重新安装系统后插在USB3.0端口的鼠标不能使用?
在 Windows 7 及更早版本的操作系统中,USB 3.0 驱动程序堆栈由第三方提供,操作系统不提供USB3.0驱动栈。 因此,Windows7重新安装系统后插在USB3.0端口上的所有设备都无法工作,需要安装第三方提供的USB控制器和集线器驱动,这样才能识别出挂接在该USB总线下的设备。从Wi......
USB键盘与HID报表描述符关系
报告描述符确实非常复杂,要看懂协议真得比较难(因为只有英文的),我见到的国内教材也没有对这部分写得很详细的,有的也只是部分内容的翻译而已。一般建议用示例报告描述符修改一下就可以了,《Hid Usage Table》里给出了一些常见应用的报告描述符。对于键盘类应用,通常用已有的示例已经够用了。“如果是......
HID复合设备(键盘、鼠标)的实现
在使用一些USB键盘或鼠标的时候,特别是一些电竟高档HID设备时,经常发现这些设备会额外定义一些特别的快捷键,使得这些设备不仅有基础设备(如键盘,鼠标)的功能,也有一些特别的快捷功能(如系统声音的放大放小)。甚至更有一些复杂的设备,只需要一个USB接口,就同时支持鼠标键盘功能或在键盘的额外区域支持触......
USB HID键盘设备树及设备枚举过程分析
今天在本站USB中文网微信技术交流群有一个同学在问关于HID设备的报表描述符的东东。但是在问的过程中发现一个很严重的问题,那就是它的它设备是一个复合设备,导致设备树比较复杂,关于报表描述符与接口描述符等之间的相关对应关系不是很清楚。为此,本人手中刚好有一个本人认为USB HID设备中相对比较复杂的设......
Windows下通过USB虚拟的键盘鼠标总结
产品级详见:https://www.usbzh.com/article/detail-1182.html哐哐铛铛的,终于把以前搞的虚拟键盘、鼠标的驱动代码重新整理完成,并且在此基础上将USB虚拟的键盘和鼠标整合到一个驱动中。将键盘和鼠标的代码合并在一起的原因很简单:第一是为了验证自己写的这个虚......
USB键盘在Linux环境下一直返回NAK的输入端点和一直OUT数据的输出端点
群里有同学反馈,自己做的USB键盘在Windows下正常,但在Linux下就失败,想让帮忙分析一下原因。一个比较好的消息是他那边有USB总线分析仪,所以只需要抓包就可以进行分析了。最好开他给的抓包截图是样子的:从它的截图可以看到,USB键盘在获取了该键盘的HID报告描述符后,紧跟着一下发Report......
USB键盘HID设备示例
键盘是一个比较复杂的复合设备,其中接口0实现的是键盘功能,接口1又因为报告描述符分为三个HID设备。BUSHOUND下的设备ID关系:在BUSHOUND抓取该USB键盘的枚举过程:Device Length Phase Data ......
USB键盘鼠标芯片选型
型号协议功能时钟工作温度封装 CH93292.0 全速 Device串口转HID键盘/鼠标/自定义HID芯片,支持多种工作模式和串口通讯模式内置-40~+85℃SOP16 CH93282.0 全速 Device串口转HID键盘芯片,实现串口数据转US......
USB键盘定义HID报告描述符一键关机、唤醒和睡眠功能
这是本人电脑的USB键盘复合设备中的一个HID功能,用于实现一键关机,唤醒机器和一键进入睡眠状态。使用USB标准请求及描述符在线分析工具http://www.usbzh.com/tool/usb.html 分析该报告描述符0x05, 0x01, // Usage Page (Gene......
HID键盘鼠标复位报告描述符
0x05, 0x01, // USAGE_PAGE (Generic Desktop) 0x09, 0x02, // USAGE (Mouse) 0xa1, 0x01, ......
HID键盘报告描述符
0x05, 0x01, // Usage Page (Generic Desktop Ctrls)0x09, 0x06, // Usage (Keyboard)0xA1, 0x01, // Collection (Application)0x05, 0......
关注公众号
  • HID人机交互
  • Linux&USB
  • UAC音频
  • TYPE-C
  • USB规范
  • USB大容量存储
  • USB百科
  • USB周边
  • UVC摄像头
  • Windows系统USB
  • 音视频博客
  • 取消
    感谢您的支持,我会继续努力的!
    扫码支持
    扫码打赏,你说多少就多少

    打开支付宝扫一扫,即可进行扫码打赏哦

    您的支持,是我们前进的动力!