Changeset c7a2e7e in mainline for uspace/lib/usb/src/hidparser.c
- Timestamp:
- 2011-03-03T15:35:37Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b7d9606
- Parents:
- e259d95
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/hidparser.c
re259d95 rc7a2e7e 43 43 44 44 45 int usb_hid_report_parse_tag(uint8_t tag, uint8_t class, uint8_t *data, size_t item_size,45 int usb_hid_report_parse_tag(uint8_t tag, uint8_t class, const const uint8_t *data, size_t item_size, 46 46 usb_hid_report_item_t *report_item); 47 int usb_hid_report_parse_main_tag(uint8_t tag, uint8_t *data, size_t item_size,47 int usb_hid_report_parse_main_tag(uint8_t tag, const uint8_t *data, size_t item_size, 48 48 usb_hid_report_item_t *report_item); 49 int usb_hid_report_parse_global_tag(uint8_t tag, uint8_t *data, size_t item_size,49 int usb_hid_report_parse_global_tag(uint8_t tag, const uint8_t *data, size_t item_size, 50 50 usb_hid_report_item_t *report_item); 51 int usb_hid_report_parse_local_tag(uint8_t tag, uint8_t *data, size_t item_size,51 int usb_hid_report_parse_local_tag(uint8_t tag, const uint8_t *data, size_t item_size, 52 52 usb_hid_report_item_t *report_item); 53 53 … … 55 55 int usb_hid_report_reset_local_items(); 56 56 void usb_hid_free_report_list(link_t *head); 57 int32_t usb_hid_report_tag_data_int32(uint8_t *data, size_t size); 57 int32_t usb_hid_report_tag_data_int32(const uint8_t *data, size_t size); 58 size_t usb_hid_count_item_offset(usb_hid_report_item_t * report_item, size_t offset); 58 59 /** 59 60 * … … 80 81 */ 81 82 int usb_hid_parse_report_descriptor(usb_hid_report_parser_t *parser, 82 const uint8_t *data, size_t size)83 const const uint8_t *data, size_t size) 83 84 { 84 85 size_t i=0; … … 89 90 usb_hid_report_item_t *report_item=0; 90 91 usb_hid_report_item_t *new_report_item; 92 93 size_t offset=0; 91 94 92 95 … … 103 106 class = USB_HID_ITEM_TAG_CLASS(data[i]); 104 107 105 ret = usb_hid_report_parse_tag(tag,class, 106 (uint8_t *)(data + sizeof(uint8_t)*(i+1)), 108 ret = usb_hid_report_parse_tag(tag,class,(data + (i+1)), 107 109 item_size,report_item); 108 110 switch(ret){ … … 110 112 // store report item to report and create the new one 111 113 printf("\nNEW REPORT ITEM: %X",tag); 114 115 offset = usb_hid_count_item_offset(report_item, offset); 116 report_item->offset = offset; 112 117 switch(tag) { 113 118 case USB_HID_REPORT_TAG_INPUT: … … 125 130 break; 126 131 default: 127 printf("\tjump over \n");132 printf("\tjump over tag: %X\n", tag q); 128 133 break; 129 134 } … … 178 183 */ 179 184 int usb_hid_parse_report(const usb_hid_report_parser_t *parser, 180 const uint8_t *data, size_t size,185 const const uint8_t *data, size_t size, 181 186 const usb_hid_report_in_callbacks_t *callbacks, void *arg) 182 187 { … … 210 215 * @return Error code 211 216 */ 212 int usb_hid_boot_keyboard_input_report(const uint8_t *data, size_t size,217 int usb_hid_boot_keyboard_input_report(const const uint8_t *data, size_t size, 213 218 const usb_hid_report_in_callbacks_t *callbacks, void *arg) 214 219 { … … 268 273 * @return Code of action to be done next 269 274 */ 270 int usb_hid_report_parse_tag(uint8_t tag, uint8_t class, uint8_t *data, size_t item_size,275 int usb_hid_report_parse_tag(uint8_t tag, uint8_t class, const const uint8_t *data, size_t item_size, 271 276 usb_hid_report_item_t *report_item) 272 277 { … … 305 310 */ 306 311 307 int usb_hid_report_parse_main_tag(uint8_t tag, uint8_t *data, size_t item_size,312 int usb_hid_report_parse_main_tag(uint8_t tag, const uint8_t *data, size_t item_size, 308 313 usb_hid_report_item_t *report_item) 309 314 { … … 341 346 */ 342 347 343 int usb_hid_report_parse_global_tag(uint8_t tag, uint8_t *data, size_t item_size,348 int usb_hid_report_parse_global_tag(uint8_t tag, const uint8_t *data, size_t item_size, 344 349 usb_hid_report_item_t *report_item) 345 350 { … … 398 403 * @return Error code 399 404 */ 400 int usb_hid_report_parse_local_tag(uint8_t tag, uint8_t *data, size_t item_size,405 int usb_hid_report_parse_local_tag(uint8_t tag, const uint8_t *data, size_t item_size, 401 406 usb_hid_report_item_t *report_item) 402 407 { … … 449 454 * @return Converted int32 number 450 455 */ 451 int32_t usb_hid_report_tag_data_int32( uint8_t *data, size_t size)456 int32_t usb_hid_report_tag_data_int32(const uint8_t *data, size_t size) 452 457 { 453 458 unsigned int i; … … 563 568 return; 564 569 } 570 571 inline size_t usb_hid_count_item_offset(usb_hid_report_item_t * report_item, size_t offset) 572 { 573 return offset += (report_item->count * report_item->size); 574 } 565 575 /** 566 576 * @}
Note:
See TracChangeset
for help on using the changeset viewer.