Changeset 57d9c05e in mainline for uspace/lib/usb/include/usb/classes/hidparser.h
- Timestamp:
- 2011-03-25T17:15:26Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 841e6e5
- Parents:
- 9c0f158
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/classes/hidparser.h
r9c0f158 r57d9c05e 31 31 */ 32 32 /** @file 33 * @brief USB HID parser.33 * USB HID report descriptor and report data parser 34 34 */ 35 35 #ifndef LIBUSB_HIDPARSER_H_ … … 74 74 #define USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY 4 75 75 76 /** */ 76 77 typedef struct { 78 /** */ 77 79 int32_t usage_page; 80 /** */ 78 81 int32_t usage; 79 82 /** */ 80 83 link_t link; 81 84 } usb_hid_report_usage_path_t; 82 85 86 /** */ 83 87 typedef struct { 88 /** */ 84 89 int depth; 90 91 /** */ 85 92 link_t link; 86 93 } usb_hid_report_path_t; … … 90 97 */ 91 98 typedef struct { 99 /** */ 92 100 int32_t id; 101 /** */ 93 102 int32_t usage_minimum; 103 /** */ 94 104 int32_t usage_maximum; 105 /** */ 95 106 int32_t logical_minimum; 107 /** */ 96 108 int32_t logical_maximum; 109 /** */ 97 110 int32_t size; 111 /** */ 98 112 int32_t count; 113 /** */ 99 114 size_t offset; 115 /** */ 100 116 int32_t delimiter; 101 117 /** */ 102 118 int32_t unit_exponent; 119 /** */ 103 120 int32_t unit; 104 121 105 /* 106 * some not yet used fields 107 */ 122 /** */ 108 123 int32_t string_index; 124 /** */ 109 125 int32_t string_minimum; 126 /** */ 110 127 int32_t string_maximum; 128 /** */ 111 129 int32_t designator_index; 130 /** */ 112 131 int32_t designator_minimum; 132 /** */ 113 133 int32_t designator_maximum; 134 /** */ 114 135 int32_t physical_minimum; 136 /** */ 115 137 int32_t physical_maximum; 116 138 139 /** */ 117 140 uint8_t item_flags; 118 141 142 /** */ 119 143 usb_hid_report_path_t *usage_path; 144 /** */ 120 145 link_t link; 121 146 } usb_hid_report_item_t; … … 124 149 /** HID report parser structure. */ 125 150 typedef struct { 151 /** */ 126 152 link_t input; 153 /** */ 127 154 link_t output; 155 /** */ 128 156 link_t feature; 129 157 } usb_hid_report_parser_t; … … 190 218 191 219 /* 192 * modifiers definitions 193 */ 194 220 * Descriptor parser functions 221 */ 222 /** */ 223 int usb_hid_parser_init(usb_hid_report_parser_t *parser); 224 225 /** */ 226 int usb_hid_parse_report_descriptor(usb_hid_report_parser_t *parser, 227 const uint8_t *data, size_t size); 228 229 /** */ 230 void usb_hid_free_report_parser(usb_hid_report_parser_t *parser); 231 232 /** */ 233 void usb_hid_descriptor_print(usb_hid_report_parser_t *parser); 234 235 /* 236 * Boot protocol functions 237 */ 238 /** */ 195 239 int usb_hid_boot_keyboard_input_report(const uint8_t *data, size_t size, 196 240 const usb_hid_report_in_callbacks_t *callbacks, void *arg); 197 241 242 /** */ 198 243 int usb_hid_boot_keyboard_output_report(uint8_t leds, uint8_t *data, size_t size); 199 244 200 int usb_hid_parser_init(usb_hid_report_parser_t *parser); 201 int usb_hid_parse_report_descriptor(usb_hid_report_parser_t *parser, 202 const uint8_t *data, size_t size); 203 245 246 /* 247 * Input report parser functions 248 */ 249 /** */ 204 250 int usb_hid_parse_report(const usb_hid_report_parser_t *parser, 205 251 const uint8_t *data, size_t size, … … 207 253 const usb_hid_report_in_callbacks_t *callbacks, void *arg); 208 254 255 /** */ 209 256 size_t usb_hid_report_input_length(const usb_hid_report_parser_t *parser, 210 257 usb_hid_report_path_t *path, int flags); 211 258 212 259 213 void usb_hid_free_report_parser(usb_hid_report_parser_t *parser); 214 215 void usb_hid_descriptor_print(usb_hid_report_parser_t *parser); 216 217 /* usage path functions*/260 261 /* 262 * usage path functions 263 */ 264 /** */ 218 265 usb_hid_report_path_t *usb_hid_report_path(void); 266 267 /** */ 219 268 void usb_hid_report_path_free(usb_hid_report_path_t *path); 269 270 /** */ 220 271 int usb_hid_report_path_append_item(usb_hid_report_path_t *usage_path, int32_t usage_page, int32_t usage); 272 273 /** */ 221 274 void usb_hid_report_remove_last_item(usb_hid_report_path_t *usage_path); 275 276 /** */ 222 277 void usb_hid_report_null_last_item(usb_hid_report_path_t *usage_path); 278 279 /** */ 223 280 void usb_hid_report_set_last_item(usb_hid_report_path_t *usage_path, int32_t tag, int32_t data); 281 282 /** */ 224 283 int usb_hid_report_compare_usage_path(usb_hid_report_path_t *report_path, usb_hid_report_path_t *path, int flags); 284 285 /** */ 225 286 usb_hid_report_path_t *usb_hid_report_path_clone(usb_hid_report_path_t *usage_path); 226 287 227 288 228 // output API 289 /* 290 * Output report parser functions 291 */ 229 292 /** Allocates output report buffer*/ 230 293 uint8_t *usb_hid_report_output(usb_hid_report_parser_t *parser); 294 231 295 /** Frees output report buffer*/ 232 296 void usb_hid_report_output_free(uint8_t *output); … … 235 299 size_t usb_hid_report_output_size(usb_hid_report_parser_t *parser, 236 300 usb_hid_report_path_t *path, int flags); 301 237 302 /** Updates the output report buffer by translated given data */ 238 303 int usb_hid_report_output_translate(usb_hid_report_parser_t *parser,
Note:
See TracChangeset
for help on using the changeset viewer.