custom HID代码分析(一) 报文描述符

来源:互联网 发布:java long转int 编辑:程序博客网 时间:2024/06/09 21:26
__ALIGN_BEGIN static uint8_t CUSTOM_HID_ReportDesc_FS[USBD_CUSTOM_HID_REPORT_DESC_SIZE] __ALIGN_END ={ 0x06, 0xFF, 0x00,        /* USAGE_PAGE (Vendor Page: 0xFF00) */ 0x09, 0x01,/* USAGE (Demo Kit)   */ 0xa1, 0x01,/* COLLECTION (Application)   */ /* 6 */  /* Led 1 */ 0x85, 0x01,/*   REPORT_ID (1)*/ 0x09, 0x01,/*   USAGE (LED 1)*/ 0x15, 0x00,/*   LOGICAL_MINIMUM (0)  */   0x25, 0x01,/*   LOGICAL_MAXIMUM (1)  */    0x75, 0x08,/*   REPORT_SIZE (8)  */ 0x95, 0x14,/*   REPORT_COUNT (1) wxy add  report_count : data length  */    0x81, 0x03,/*    FEATURE (Data,Var,Abs,Vol) */   0xc0        /*   END_COLLECTION   */     };

代码1  FALCON USB-CUSTOM-HID

USBD_CUSTOM_HID_REPORT_DESC_SIZE 为描述符的数量,在USBlyser中的描述如下
__ALIGN_BEGIN static uint8_t CUSTOM_HID_ReportDesc_FS[USBD_CUSTOM_HID_REPORT_DESC_SIZE] __ALIGN_END ={ 0x06, 0xFF, 0x00,<span style="white-space:pre"></span>   /* USAGE_PAGE (Vendor Page: 0xFF00) */<span style="white-space:pre"></span> 0x09, 0x01,<span style="white-space:pre"></span>/* USAGE (Demo Kit) <span style="white-space:pre"></span>  */<span style="white-space:pre"></span> 0xa1, 0x01,<span style="white-space:pre"></span>/* COLLECTION (Application) <span style="white-space:pre"></span>  */<span style="white-space:pre"></span> /* 6 */  /* Led 1 */<span style="white-space:pre"></span> 0x85, 0x01,<span style="white-space:pre"></span>/*<span style="white-space:pre"></span>   REPORT_ID (1)<span style="white-space:pre"></span>*/ 0x09, 0x01,<span style="white-space:pre"></span>/*<span style="white-space:pre"></span>   USAGE (LED 1)<span style="white-space:pre"></span>*/ 0x15, 0x00,<span style="white-space:pre"></span>/*<span style="white-space:pre"></span>   LOGICAL_MINIMUM (0)<span style="white-space:pre"></span>  */<span style="white-space:pre"></span>   0x25, 0x01,<span style="white-space:pre"></span>/*<span style="white-space:pre"></span>   LOGICAL_MAXIMUM (1)<span style="white-space:pre"></span>  */<span style="white-space:pre"></span>    0x75, 0x08,<span style="white-space:pre"></span>/*<span style="white-space:pre"></span>   REPORT_SIZE (8)<span style="white-space:pre"></span>  */<span style="white-space:pre"></span> 0x95, 0x14,<span style="white-space:pre"></span>/*<span style="white-space:pre"></span>   REPORT_COUNT (1) <span style="white-space:pre"></span>wxy add  report_count : data length <span style="white-space:pre"></span> */ <span style="white-space:pre"></span>   0x81, 0x03,<span style="white-space:pre"></span> /*    FEATURE (Data,Var,Abs,Vol) */   0xc0<span style="white-space:pre"></span>/*<span style="white-space:pre"></span>   END_COLLECTION<span style="white-space:pre"></span>   */     };
<img src="http://img.blog.csdn.net/20160309103100849" alt="" />
其中第一行的 06 FF 00 在描述符工具中实际为 06 00 FF,供应商定义的页面
实验改变00 FF顺序后 不影响USB hid挂载
用途页开辟以后,描述用途为:09 01 供应商用途1 相当于自定义
开始应用集合:{
  报文ID 设置为 01
  用途: 供应商用途1
  逻辑最小值: 0
  逻辑最大值: 1
  报文大小:   8位
  报文长度:   20个报文
  输入值:       
 }结束应用集合
</pre><pre code_snippet_id="1602715" snippet_file_name="blog_20160309_19_2543618" name="code" class="html">
</pre><pre code_snippet_id="1602715" snippet_file_name="blog_20160309_19_2543618" name="code" class="html">

0 0
原创粉丝点击