Changeset 4fec9ee in mainline for uspace/lib/usb/include/usb/classes/hidparser.h
- Timestamp:
- 2011-03-18T16:17:24Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 00b13408
- Parents:
- 4f66cc7b (diff), d8e61b0d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/classes/hidparser.h
r4f66cc7b r4fec9ee 37 37 38 38 #include <stdint.h> 39 #include <adt/list.h> 40 #include <usb/classes/hid_report_items.h> 41 42 /** 43 * Item prefix 44 */ 45 #define USB_HID_ITEM_SIZE(data) ((uint8_t)(data & 0x3)) 46 #define USB_HID_ITEM_TAG(data) ((uint8_t)((data & 0xF0) >> 4)) 47 #define USB_HID_ITEM_TAG_CLASS(data) ((uint8_t)((data & 0xC) >> 2)) 48 #define USB_HID_ITEM_IS_LONG(data) (data == 0xFE) 49 50 51 /** 52 * Input/Output/Feature Item flags 53 */ 54 /** Constant (1) / Variable (0) */ 55 #define USB_HID_ITEM_FLAG_CONSTANT(flags) ((flags & 0x1) == 0x1) 56 /** Variable (1) / Array (0) */ 57 #define USB_HID_ITEM_FLAG_VARIABLE(flags) ((flags & 0x2) == 0x2) 58 /** Absolute / Relative*/ 59 #define USB_HID_ITEM_FLAG_RELATIVE(flags) ((flags & 0x4) == 0x4) 60 /** Wrap / No Wrap */ 61 #define USB_HID_ITEM_FLAG_WRAP(flags) ((flags & 0x8) == 0x8) 62 #define USB_HID_ITEM_FLAG_LINEAR(flags) ((flags & 0x10) == 0x10) 63 #define USB_HID_ITEM_FLAG_PREFERRED(flags) ((flags & 0x20) == 0x20) 64 #define USB_HID_ITEM_FLAG_POSITION(flags) ((flags & 0x40) == 0x40) 65 #define USB_HID_ITEM_FLAG_VOLATILE(flags) ((flags & 0x80) == 0x80) 66 #define USB_HID_ITEM_FLAG_BUFFERED(flags) ((flags & 0x100) == 0x100) 67 68 69 /** 70 * Description of path of usage pages and usages in report descriptor 71 */ 72 typedef struct { 73 int32_t usage_page; 74 } usb_hid_report_path_t; 39 75 40 76 /** … … 42 78 */ 43 79 typedef struct { 44 45 uint8_t usage_min; 46 uint8_t usage_max; 47 uint8_t logical_min; 48 uint8_t logical_max; 49 uint8_t size; 50 uint8_t count; 51 uint8_t offset; 52 80 int32_t id; 81 int32_t usage_page; 82 int32_t usage; 83 int32_t usage_minimum; 84 int32_t usage_maximum; 85 int32_t logical_minimum; 86 int32_t logical_maximum; 87 int32_t size; 88 int32_t count; 89 size_t offset; 90 int32_t delimiter; 91 92 int32_t unit_exponent; 93 int32_t unit; 94 95 /* 96 * some not yet used fields 97 */ 98 int32_t string_index; 99 int32_t string_minimum; 100 int32_t string_maximum; 101 int32_t designator_index; 102 int32_t designator_minimum; 103 int32_t designator_maximum; 104 int32_t physical_minimum; 105 int32_t physical_maximum; 106 107 uint8_t item_flags; 108 109 link_t link; 53 110 } usb_hid_report_item_t; 54 111 55 112 56 113 /** HID report parser structure. */ 57 typedef struct { 58 } usb_hid_report_parser_t; 114 typedef struct { 115 link_t input; 116 link_t output; 117 link_t feature; 118 } usb_hid_report_parser_t; 119 59 120 60 121 … … 127 188 int usb_hid_boot_keyboard_output_report(uint8_t leds, uint8_t *data, size_t size); 128 189 190 int usb_hid_parser_init(usb_hid_report_parser_t *parser); 129 191 int usb_hid_parse_report_descriptor(usb_hid_report_parser_t *parser, 130 192 const uint8_t *data, size_t size); … … 134 196 const usb_hid_report_in_callbacks_t *callbacks, void *arg); 135 197 136 137 int usb_hid_free_report_parser(usb_hid_report_parser_t *parser); 198 int usb_hid_report_input_length(const usb_hid_report_parser_t *parser, 199 const usb_hid_report_path_t *path); 200 201 202 void usb_hid_free_report_parser(usb_hid_report_parser_t *parser); 203 204 void usb_hid_descriptor_print(usb_hid_report_parser_t *parser); 138 205 139 206 #endif
Note:
See TracChangeset
for help on using the changeset viewer.