|
ginnOS
The reference: libc, the libraries and the kernel
|
Macros | |
| #define | TYPE_MAIN 0 |
| the HID report descriptor parser (USB Device Class Definition for HID 1.11, section 6.2.2). | |
| #define | TYPE_GLOBAL 1 |
| #define | TYPE_LOCAL 2 |
| #define | MAIN_INPUT 0x8 |
| #define | GLOBAL_PAGE 0x0 |
| #define | GLOBAL_LOG_MIN 0x1 |
| #define | GLOBAL_LOG_MAX 0x2 |
| #define | GLOBAL_SIZE 0x7 |
| #define | GLOBAL_ID 0x8 |
| #define | GLOBAL_COUNT 0x9 |
| #define | LOCAL_USAGE 0x0 |
| #define | LOCAL_USAGE_MIN 0x1 |
| #define | LOCAL_USAGE_MAX 0x2 |
| #define | INPUT_CONSTANT 0x01 |
| #define | INPUT_RELATIVE 0x04 |
| #define | PAGE_DESKTOP 0x01 |
| #define | PAGE_BUTTON 0x09 |
| #define | USAGE_X 0x30 |
| #define | USAGE_Y 0x31 |
| #define | USAGE_WHEEL 0x38 |
| #define | MAX_USAGES 16 |
Functions | |
| bool | hid_parse_pointer (const uint8_t *descriptor, uint32_t length, hid_pointer_t *out) |
| find the pointer fields in a report descriptor. | |
| int32_t | hid_field_value (const hid_field_t *field, const uint8_t *report, uint32_t length) |
| read a field from a report (the report id byte already skipped). | |
| #define TYPE_MAIN 0 |
the HID report descriptor parser (USB Device Class Definition for HID 1.11, section 6.2.2).
a descriptor is a list of items: a prefix byte (the size in bits 0 to 1, the type in bits 2 to 3, the tag in bits 4 to 7) and 0, 1, 2 or 4 data bytes. global items (the usage page, the logical range, the report size, count and id) stay set until changed; local items (the usages) belong to the next main item. an Input main item adds report count fields of report size bits each to the report.
not supported: push and pop of the global state, and long items (they are skipped). the pointer fields must all be in one report.
| #define TYPE_GLOBAL 1 |
| #define TYPE_LOCAL 2 |
| #define MAIN_INPUT 0x8 |
| #define GLOBAL_PAGE 0x0 |
| #define GLOBAL_LOG_MIN 0x1 |
| #define GLOBAL_LOG_MAX 0x2 |
| #define GLOBAL_SIZE 0x7 |
| #define GLOBAL_ID 0x8 |
| #define GLOBAL_COUNT 0x9 |
| #define LOCAL_USAGE 0x0 |
| #define LOCAL_USAGE_MIN 0x1 |
| #define LOCAL_USAGE_MAX 0x2 |
| #define INPUT_CONSTANT 0x01 |
| #define INPUT_RELATIVE 0x04 |
| #define PAGE_DESKTOP 0x01 |
| #define PAGE_BUTTON 0x09 |
| #define USAGE_X 0x30 |
| #define USAGE_Y 0x31 |
| #define USAGE_WHEEL 0x38 |
| #define MAX_USAGES 16 |
| bool hid_parse_pointer | ( | const uint8_t * | descriptor, |
| uint32_t | length, | ||
| hid_pointer_t * | out ) |
find the pointer fields in a report descriptor.
| int32_t hid_field_value | ( | const hid_field_t * | field, |
| const uint8_t * | report, | ||
| uint32_t | length ) |
read a field from a report (the report id byte already skipped).
| length | the bytes in the report. |