买了本<圈圈教你玩USB>,对于报告描述符中集合的应用总是有些问题不太了解,请教下圈圈及大家
问题:
1:集合表示的是什么? 看协议上讲表示一些主条目的集合;
2:一般是在usage()后面就要开一个集合吗?还是在什么情况下需要开集合?
3:什么usage属于application或physical集合,这个是如何知道的?虽然协议中有如下定义,但还是弄不懂
Collection 1010 00 nn 0x00 Physical (group of axes)
0x01 Application (mouse, keyboard)
0x02 Logical (interrelated data)
0x03 Report
0x04 Named Array
0x05 Usage Switch
0x06 Usage Modifier
0x07-0x7F Reserved
0x80-0xFF Vendor-defined
4:如下面描述符所示,为什么还要开两个集合呢?
Usage Page (Generic Desktop), ;Use the Generic Desktop Usage Page
Usage (Mouse),
Collection (Application), ;Start Mouse collection
Usage (Pointer),
Collection (Physical), ;Start Pointer collection
Usage Page (Buttons)
Usage Minimum (1),
Usage Maximum (3),
Logical Minimum (0),
Logical Maximum (1), ;Fields return values from 0 to 1
Report Count (3),
Report Size (1), ;Create three 1 bit fields (button 1, 2, & 3)
Input (Data, Variable, Absolute), ;Add fields to the input report.
Report Count (1),
Report Size (5), ;Create 5 bit constant field
Input (Constant), ;Add field to the input report
Usage Page (Generic Desktop),
Usage (X),
Usage (Y),
Logical Minimum (-127),
Logical Maximum (127), ;Fields return values from -127 to 127
Report Size (8),
Report Count (2), ;Create two 8 bit fields (X & Y position)
Input (Data, Variable, Relative), ;Add fields to the input report
End Collection, ;Close Pointer collection
End Collection ;Close Mouse collection |