1. 程式人生 > >HID報告描述符解析_筆記

HID報告描述符解析_筆記

要了解報告描述符,需要兩份資料:《device class definition for human interface device (HID)》, 《Universal Serial Bus HID Usage Tables》

例如:0x05, 0x01, // USAGE_PAGE (Generic Desktop)

0x05表示字首,0x01為資料部分

0x05轉換成二進位制,就是00000101,按照HID類協議5.3 generic item format的定義,這個位元組被分成3個部分:

  • bit0~bit1代表的是這個字首後面跟的資料長度,兩位可以表示最大4位元組的資料,即bsize
  • bit2~bit3代表的是這個字首的型別,總共可以有三種類型:
    0=main,1=global,2=local,3=reserved;
  • bit4~bit7代表字首的tag,一般分為input(二進位制的1000 00 nn,即bit4~bit7=1000,代表一個tag,bit2~bit3=00,代表main,bit0~bit1=nn,代表這個字首後面還有nn所代表的資料),output(二進位制的 1001 00 nn),feature(1011 00 nn),collection(1010 00 nn),end collection(1100 00 nn)



                            


 

INPUT欄位定義: