阅读:4720回复:4
版主帮我看一看这个HID REPORT DESC.
版主,
您好我要把此报告描述符改成 1. 双向传输 2. 每次8bytes任意数据 怎么改呀? 谢谢 Best Regards Aron Chu.PAGE * ---------------------------------------------------------------------- * * Report Descriptor * * ================= * * - provides a description of the data provided by every control * * in a device * * - made up of "items" that provide info. about the device * * - short & long items * * 1> short item * * - 1st byte b1-0 item size(0,1,2,4 bytes) * * b3-2 item type(0-main, 1-global, 2-local) * * b7-4 item tag * * - 0-4 optional data bytes(as specified in item size) * * 2> long item * * - 1st byte must be $FE * * - 2nd byte item size * * - 3rd byte item tag * * - 0-255 optional data bytes(as specified in item size) * * (Note:- long item tag are NOT specified & reserved for * * future use.) * * - 3 types of items : MAIN, GLOBAL and LOCAL * * - LOCAL items * * . describe the data fields defined by the next main item * * - for every control, it must include the following items :- * * . Input, Output or Feature tag * * . Logical Minimum * * . Logical Maximum * * . Usage Global Items * * . Usage Page ? * * . Report Size ? * * . Report Count * * (Note:- Main items are preceded by Global items.) * * * * * * * * ---------------------------------------------------------------------- * * Reference: * * {Device Class Def. for HID[V1.0 draft#4]} * * p.28, sect 6.2.2.4 - main item tags & data defination * * p.29, sect 6.2.2.4 - bit definations of main item data * * ---------------------------------------------------------------------- * .PAGE * --- Main Item Tags --------------------------------------------------- * * - 5 types of Main Items * * . INPUT item - describe data format return from controls * * . OUTPUT item - describe data format send to controls * * . FEATURE item - define config. options for the device * * (Note:- FEATURE items differs from OUTPUT items that they * * are NOT visible to applications.) * * . COLLECTION item - grouping of items * * . END_COLLECTION item - end of a collection of items * * (Note:- COLLECTION & END_COLLECTION items are classified * * as non-data items.) * * - bit definitions of Data for INPUT/OUTPUT/FEATURE items * * ------------------------------------------------------------- * * Bit | =0 | = 1 * * ------------------------------------------------------------- * * b0 |Data |Constant * * |- the item is data |- item is adding bits to pad * * | | the report * * ------------------------------------------------------------- * * b1 |Array |Variable * * |- return an index in each |- return status of all * * | field corresponds to the| defined fields * * | pressed button | * * ------------------------------------------------------------- * * b2 |Absolute |Relative * * |- based on fixed origin |- indicate change of value * * ------------------------------------------------------------- * * b3 |No Wrap |Wrap * * |- data NOT roll-over for |- data roll-over for extreme * * | extreme values | values * * ------------------------------------------------------------- * * b4 |Linear |Non-linear * * ------------------------------------------------------------- * * b5 |with Preferred State |no Preferred State * * ------------------------------------------------------------- * * b6 |no Null Position |Null State * * | |- report Null state by return * * | | out-of-range values * * ------------------------------------------------------------- * * b7 |Non-volatile |Volatile * * | |- return value can be * * | | changed by host * * ------------------------------------------------------------- * * b8 |Bit Field |Buffered Bytes * * ------------------------------------------------------------- * * b9- |Reserved | * * b31 | | * * ------------------------------------------------------------- * * (Note:- b7 only applies for OUTPUT & FEATURE items. * * - for Constant item(b0=1), no other bits attributes apply. * * - for Array Input item(b1=0), only b0, b1 & b2 attributes * * apply. ) * * - data definitions for COLLECTION & END_COLLECTION items * * =$00 Physical Type * * - set of items for one geometric position * * (e.g. x,y,z position of a Joystick) * * =$01 Application Type * * - set of items for particular application * * (e.g. keyboard, or mouse) * * =$02 Logical Type * * - set of items form a composite data structure * * (e.g. byte count & data of a buffer queue) * * =$03-7F <reserved for future use> * * =$80-FF <vendor defined> * * ---------------------------------------------------------------------- * Mtag_Input equ $80 ; b1-0 no. of data bytes Mtag_Output equ $90 ; ? 0 - 0 bytes Mtag_Feature equ $B0 ; ? 1 - 1 bytes Mtag_Collectn equ $A0 ; ? 2 - 2 bytes * ; 3 - 4 bytes Mtag_EndCltn equ $C0 ; b1-0 <always zero> .PAGE * --- Global Item Tags ------------------------------------------------- * * - describe the default attributes for all subsequent data fields * * unless overridden by another GLOBAL item * * - Global items * * . Usage Page select the Usage Page * * (the Usage Tag points to one of the 256 usage * * in the selected Usage Page) * * . Logical Min. min. value of return data * * . Logical Max. max. value of return data * * . Physical Min. min. value of return physical data(with unit) * * . Physical Max. max. value of return physical data(with unit) * * . Unit Exponent exponent of unit[in base 10] * * (e.g. if data=$03 for unit exponent item, * * then unit is multipled by 10^3 ) * * . Unit code represent selected unit * * . Report Size specify the size of a report field [in bits] * * . Report ID all items after the Report ID item are included * * in a report prefixed by a 1-byte ID * * . Report Count specify the no. of report fields[for variable item]* * or * * max. no. of controls that may be included in the * * report[for array item] * * . Push copy the global item state table to top of stack * * . Pop copy the global item state table from top of stack * * - resolution = (Logical Max - Logical Min) / [(10^unit_exponent) * * * (Physical Max - Physical Min)] * * (e.g. a 400-dpi mouse * * Logical Min(-127) * * ? Logical Max(127) * * ? Physical Min(-3175) * * ? Physical Max(3175) * * ? Unit Exponent(-4) * * Unit(inches) * * resolution = (127 - (-127)) / ((3175 - (-3175)) * 10^(-4)) * * = 400 count/inch ) * * - data definitions for Unit item * * ------------------------------------------------------------------- * * | | Value * * Nibble| Basic |------------------------------------------------- * * | Units | =0 | =1 | =2 | =3 | =4 * * ------------------------------------------------------------------- * * 0 | System | <none> | SI | SI | English | English * * | | | Linear | Rotation| Linear | Rotation * * ------------------------------------------------------------------- * * * * ----------------------------------------------------------------- * * | | System * * Nibble| Basic |----------------------------------------------- * * | Units | SI Linear | SI Rotat'n|Eng Linear |Eng Rotat'n * * ----------------------------------------------------------------- * * 1 | Length | cm | radian | inch | degree * * 2 | Mass | gram | gram | slug | slug * * 3 | Time | sec | sec | sec | sec * * 4 | Temp | K | K | F | F * * 5 | Current | A | A | A | A * * 6 | Luminous | Candela | Candela | Candela | Candela * * 7 | <reserve>| <none> | <none> | <none> | <none> * * ------------------------------------------------------------------- * * (Note:- For System nibble, value=7 means vendor-defined. * * - More complex units can be derived from the basic units. * * e.g. Joule = [mass(kg)][length(m)][time(s^-2)] * * = [mass(gx10^3)][length(cmx10^2)][time(s^-2)] * * Therefore, data for Unit item = $0000E321 or $E321 * * ---------------------------------------------------------------------- * * Reference: * * {Device Class Def. for HID[V1.0 draft#4]} * * p.37, section 6.2.2.7 Unit item data for some common complex units * * p.57, appendix A definations of Usage Page & Tags * * ---------------------------------------------------------------------- * Gtag_UPage equ $04 ; b1-0 no. of data bytes Gtag_LogMin equ $14 ; ? 0 - 0 bytes Gtag_LogMax equ $24 ; ? 1 - 1 bytes Gtag_PhyMin equ $34 ; ? 2 - 2 bytes Gtag_PhyMax equ $44 ; ? 3 - 4 bytes Gtag_UnitExp equ $54 ; ? Gtag_Unit equ $64 ; ? Gtag_RptSize equ $74 ; ? Gtag_RptID equ $84 ; ? Gtag_RptCnt equ $94 ; ? Gtag_Push equ $A4 ; ? Gtag_Pop equ $B4 ; .PAGE * --- Local Item Tags -------------------------------------------------- * * - define characteristics of controls * * - all Local items are unsigned integers * * - Local items * * . Usage represent a suggested usage for the item, array or * * collection * * . Usage Min. the starting usage associated with an array * * . Usage Max. the ending usage associated with an array * * . Designator Idx index points to a designator in the Physical Desc. * * . Designator Min. index points to the starting designator associated * * with an array * * . Designator Max. index points to the ending designator associated * * with an array * * . String Index string index for a String Descriptor * * . String Min. specify the starting string index associated with * * an array * * . String Max. specify the ending string index associated with * * an array * * . Set Delimiter define the beginning or end of a set of local items* * (item data: $00=close set / $01=open set) * * - apply to controls of following Main item * * (e.g. if 3 Usage tags before an Input item defining 5 controls * * then 1> the 3 Usages are assigned sequentially * * to the first 3 controls, and * * 2> the 3rd Usage is assigned to the 4th & 5th controls) * * - ? alt. set of local items may be associated with a control * * by bracketing each set with Set_Delimiter items * * (Note:- Alt. sets are optional & may NOT be recognised by the OS.) * * ---------------------------------------------------------------------- * * Reference: * * {Device Class Def. for HID[V1.0 draft#4]} * * p.57, appendix A definations of Usage Page & Tags * * ---------------------------------------------------------------------- * Ltag_Usage equ $08 ; b1-0 no. of data bytes Ltag_UsgMin equ $18 ; ? 0 - 0 bytes Ltag_UsgMax equ $28 ; ? 1 - 1 bytes Ltag_DgntrIdx equ $38 ; ? 2 - 2 bytes Ltag_DgntrMin equ $48 ; ? 3 - 4 bytes Ltag_DgntrMax equ $58 ; ? Ltag_StrgIdx equ $78 ; ? Ltag_StrgMin equ $88 ; ? Ltag_StrgMax equ $98 ; ? Ltag_SDlimitr equ $A8 ; .PAGE * [HID - Joystick] ----------------------------------------------------- * * Byte # Usage Logical Physical * * ------- ---------- -------------- -------------- * * 1 X-axis [-127..127] [0..255] * * 2 Y-axis [-127..127] [0..255] * * 3 HAT switch [0..7,F] [0..270 deg] * * 4 Buttons x8 [0..1] [0..1] * * 5 Z-axis(rot) [-127..127] [0..255] * * 6 Slider [0..255] [0..255] * * ---------------------------------------------------------------------- * REPORT_DESC: * Item Tag D.Cnt Data Comment * ------------- ----- ---- -------------------------------- db {Gtag_UPage |$01},$01 ; Usage Page(Generic Desktop) db {Ltag_Usage |$01},$04 ; Usage(Joystick) db {Mtag_Collectn|$01},$01 ; Collection(Application) * db {Ltag_Usage |$01},$01 ; Usage(Pointer) db {Mtag_Collectn|$01},$00 ; Collection(Physical) db {Ltag_Usage |$01},$30 ; Usage(X) db {Ltag_Usage |$01},$31 ; Usage(Y) db {Gtag_LogMin |$01},$80 ; Logical Min(-127) db {Gtag_LogMax |$01},$7F ; Logical Max(127) db {Gtag_PhyMin |$01},$00 ; Physical Min(0) db {Gtag_PhyMax |$02},$FF,$00 ; Physical Max(255) db {Gtag_RptSize |$01},$08 ; Report Size(8) [bits] db {Gtag_RptCnt |$01},$02 ; Report Count(2) [fields] db {Mtag_Input |$01},$02 ; Input(Data,Var,Abs) db {Mtag_EndCltn} ; End_Collection * db {Ltag_Usage |$01},$39 ; Usage(Hat Switch) db {Gtag_LogMin |$01},$00 ; Logical Min(0) db {Gtag_LogMax |$01},$07 ; Logical Max(7) db {Gtag_PhyMin |$01},$00 ; Physical Min(0) db {Gtag_PhyMax |$02},$0E,$01 ; Physical Max(270) db {Gtag_Unit |$01},$14 ; Unit(Eng Rot:degree) db {Gtag_RptSize |$01},$04 ; Report Size(4) [bits] db {Gtag_RptCnt |$01},$01 ; Report Count(1) [fields] db {Mtag_Input |$01},$42 ; Input(Data,Var,Abs,Null) * db {Gtag_RptSize |$01},$04 ; Report Size(4) db {Gtag_RptCnt |$01},$01 ; Report Count(1) db {Mtag_Input |$01},$01 ; Input(Constant) * db {Gtag_UPage |$01},$09 ; Usage Page(Buttons) db {Gtag_LogMin |$01},$00 ; Logical Min(0) db {Gtag_LogMax |$01},$01 ; Logical Max(1) db {Gtag_PhyMin |$01},$00 ; Physical Min(0) db {Gtag_PhyMax |$01},$01 ; Physical Max(1) db {Ltag_UsgMin |$01},$01 ; Usage Min(1) db {Ltag_UsgMax |$01},$08 ; Usage Max(8) db {Gtag_RptSize |$01},$01 ; Report Size(1) db {Gtag_RptCnt |$01},$08 ; Report Count(8) db {Mtag_Input |$01},$02 ; Input(Data,Var,Abs) * db {Gtag_UPage |$01},$01 ; Usage Page(Generic Desktop) db {Ltag_Usage |$01},$35 ; Usage(Rz) db {Gtag_LogMin |$01},$80 ; Logical Min(-127) db {Gtag_LogMax |$01},$7F ; Logical Max(127) db {Gtag_PhyMin |$01},$00 ; Physical Min(0) db {Gtag_PhyMax |$02},$FF,$00 ; Physical Max($00FF) db {Gtag_Unit |$01},$00 ; Unit(none) db {Gtag_RptSize |$01},$08 ; Report Size(8) [bits] db {Gtag_RptCnt |$01},$01 ; Report Count(1) [fields] db {Mtag_Input |$01},$02 ; Input(Data,Var,Abs) * db {Ltag_Usage |$01},$36 ; Usage(Slider) db {Gtag_LogMin |$01},$00 ; Logical Min(0) db {Gtag_LogMax |$02},$FF,$00 ; Logical Max($00FF) db {Gtag_PhyMin |$01},$00 ; Physical Min(0) db {Gtag_PhyMax |$02},$FF,$00 ; Physical Max($00FF) db {Gtag_RptSize |$01},$08 ; Report Size(8) [bits] db {Gtag_RptCnt |$01},$01 ; Report Count(1) [fields] db {Mtag_Input |$01},$02 ; Input(Data,Var,Abs) * db {Mtag_EndCltn} ; End_Collection REPORT_DESC_END: |
|
|
沙发#
发布于:2001-10-24 13:33
我没做过hid,还是让usb11回答吧!
|
|
|
板凳#
发布于:2001-10-24 13:55
usb11,
您忙不忙啊? 能不能腾出手指点一下,就当是换一下思维,权作休息吧。 Regards/Aron Chu |
|
|
地板#
发布于:2001-10-24 16:55
我头像怎么这样啊?
哪位知道到哪里去可找到,请告知,谢谢! |
|
|
地下室#
发布于:2001-10-24 19:20
我看过,不过,没有做过。
你自己再仔细看看HID Class规范,里面有详细的描述。 |
|
|