创建HID描述符

时间:2014-04-10 20:00:38

标签: usb hid usb-descriptor

我正在为我的设备创建自定义HID描述符。它只从设备传输,只有一个报告。

数据是:

  • 64位unsigned int
  • 16位unsigned int
  • 16位unsigned int
  • 16位unsigned int
  • 16位unsigned int

该设备是“特定于供应商”

我已经拉了几个小时了!任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:0)

据我所知,不支持在HID报告描述符中编码64位值。您可能能够定义REPORT_SIZE(64)和REPORT_COUNT(1),但可以在描述符中编码的最大LOGICAL_MAXIMUM()是LOGICAL_MAXIMUM(2147483647),它只是32位。

您可能必须将64位项目分解为2 x 32位项目(或8 x 8位项目),或者查看是否可以在不指定LOGICAL_MAXIMUM的情况下使其工作。例如:

//--------------------------------------------------------------------------------
// Decoded Application Collection
//--------------------------------------------------------------------------------

/*
06 00FF      (GLOBAL) USAGE_PAGE         0xFF00 Vendor-defined 
09 AC        (LOCAL)  USAGE              0xFF0000AC  
A1 01        (MAIN)   COLLECTION         0x01 Application (Usage=0xFF0000AC: Page=Vendor-defined, Usage=, Type=)
09 01          (LOCAL)  USAGE              0xFF000001  
15 00          (GLOBAL) LOGICAL_MINIMUM    0x00 (0) <-- Redundant: LOGICAL_MINIMUM is already 0
27 FFFFFF7F    (GLOBAL) LOGICAL_MAXIMUM    0x7FFFFFFF (2147483647) 
75 20          (GLOBAL) REPORT_SIZE        0x20 (32) Number of bits per field 
95 02          (GLOBAL) REPORT_COUNT       0x02 (2) Number of fields 
81 02          (MAIN)   INPUT              0x00000002 (2 fields x 32 bits) 0=Data 1=Variable 0=Absolute 0=NoWrap 0=Linear 0=PrefState 0=NoNull 0=NonVolatile 0=Bitmap 
27 FFFF0000    (GLOBAL) LOGICAL_MAXIMUM    0x0000FFFF (65535) 
09 02          (LOCAL)  USAGE              0xFF000002  
75 10          (GLOBAL) REPORT_SIZE        0x10 (16) Number of bits per field 
95 04          (GLOBAL) REPORT_COUNT       0x04 (4) Number of fields 
81 02          (MAIN)   INPUT              0x00000002 (4 fields x 16 bits) 0=Data 1=Variable 0=Absolute 0=NoWrap 0=Linear 0=PrefState 0=NoNull 0=NonVolatile 0=Bitmap 
C0           (MAIN)   END_COLLECTION     Application
*/

//--------------------------------------------------------------------------------
// Vendor-defined inputReport (Device --> Host)
//--------------------------------------------------------------------------------

typedef struct
{
                                                     // No REPORT ID byte
  uint32_t VEN_VendorDefined0001[2];                 // Usage 0xFF000001: , Value = 0 to 2147483647
  uint16_t VEN_VendorDefined0002[4];                 // Usage 0xFF000002: , Value = 0 to 65535
} inputReport_t;