Learning USB HID in Linux Part 5 - Collections, Usage Maximum, Usage Minimum, Logical Maximum, Logical Minimum
Collections
Report descriptors are made up of items; an item is distinct grouping of data. Collection items are used to group together input, output and feature items. In the HID Specification, there are 3 different types of predefined collections:
Logical: Indicates that some bits of data belong together, whatever that means.
Example from HID Spec: Contents of data buffer and buffer length
Usage Minimum and Usage Maximum assigns a series of Usage IDs to the data in the array or bitmap. Usage Minimum defines the starting ID and Usage Maximum defines the ending ID.
Example:
For a 3 button, mouse ID's are assigned to Button1 (0x01), Button2 (0x02), Button3 (0x03)
Usage Minimum and Usage Maximum entries allow a series of similar items to be defined together when the usages are assigned to continuous numbers. Instead of defining 101 Usages separately for each key on the standard keyboard, a single usage can be defined with the maximum and minimum set to the maximum and minimum IDs.
Logical Minimum and Logical Maximum specify the range of values that the report can contain.
Example:
1. Mouse that reports position value of -127 to 127 will have a logical maximum of 127 and logical minimum of -127
2. Single button state that is either asserted or released will have a logical minimum of 0 and logical maximum of 1
USB Descriptor dump of mouse:
References:
1. https://www.cypress.com/file/136381/download
2. http://who-t.blogspot.com/2018/12/understanding-hid-report-descriptors.html
Report descriptors are made up of items; an item is distinct grouping of data. Collection items are used to group together input, output and feature items. In the HID Specification, there are 3 different types of predefined collections:
- Physical
- Application
- Logical
Physical: Data collected at one physical point. Devices that collect data from multiple sensors at one time may group the data in physical collection
Eg. Mouse position Data.
Application: Groups together items that serves different or common purposes in a single device.
Eg. Keyboard that groups together the LEDs and key presses.
Usually, every Report Descriptor must define at least one Application Collection but you may have two or more.
Logical: Indicates that some bits of data belong together, whatever that means.
Example from HID Spec: Contents of data buffer and buffer length
Usage Minimum and Usage Maximum assigns a series of Usage IDs to the data in the array or bitmap. Usage Minimum defines the starting ID and Usage Maximum defines the ending ID.
Example:
For a 3 button, mouse ID's are assigned to Button1 (0x01), Button2 (0x02), Button3 (0x03)
Usage Minimum and Usage Maximum entries allow a series of similar items to be defined together when the usages are assigned to continuous numbers. Instead of defining 101 Usages separately for each key on the standard keyboard, a single usage can be defined with the maximum and minimum set to the maximum and minimum IDs.
Logical Minimum and Logical Maximum specify the range of values that the report can contain.
Example:
1. Mouse that reports position value of -127 to 127 will have a logical maximum of 127 and logical minimum of -127
2. Single button state that is either asserted or released will have a logical minimum of 0 and logical maximum of 1
USB Descriptor dump of mouse:
References:
1. https://www.cypress.com/file/136381/download
2. http://who-t.blogspot.com/2018/12/understanding-hid-report-descriptors.html
Comments
Post a Comment