Changeset 2020927 in mainline
- Timestamp:
- 2011-04-21T21:35:33Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1553cbf
- Parents:
- c7c0984a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/hidparser.c
rc7c0984a r2020927 73 73 void usb_hid_print_usage_path(usb_hid_report_path_t *path); 74 74 void usb_hid_descriptor_print_list(link_t *head); 75 int usb_hid_report_reset_local_items();75 void usb_hid_report_reset_local_items(usb_hid_report_item_t *report_item); 76 76 void usb_hid_free_report_list(link_t *head); 77 77 usb_hid_report_item_t *usb_hid_report_item_clone(const usb_hid_report_item_t *item); … … 144 144 } 145 145 146 for(i=0; i<report_item->usages_count; i++){ 147 usb_log_debug("usages (%d) - %x\n", i, report_item->usages[i]); 148 } 149 146 150 147 151 for(i=0; i<report_item->count; i++){ … … 168 172 169 173 if(report_item->usages_count > 0 && ((report_item->usage_minimum == 0) && (report_item->usage_maximum == 0))) { 170 if(i < report_item->usages_count){171 if((report_item->usages[i] & 0xFF00) != 0){172 field->usage_page = (report_item->usages[i] >> 16);173 field->usage = (report_item->usages[i] & 0xFF);174 uint32_t usage; 175 if(report_item->type == USB_HID_REPORT_TYPE_INPUT) { 176 if(i < report_item->usages_count){ 177 usage = report_item->usages[i]; 174 178 } 175 179 else { 176 field->usage = report_item->usages[i];180 usage = report_item->usages[report_item->usages_count - 1]; 177 181 } 178 182 } 179 183 else { 180 field->usage = report_item->usages[report_item->usages_count - 1]; 181 } 184 if((report_item->count - i - 1) < report_item->usages_count){ 185 usage = report_item->usages[(report_item->count - i - 1)]; 186 } 187 else { 188 usage = report_item->usages[report_item->usages_count - 1]; 189 } 190 } 191 192 193 if((usage & 0xFF00) != 0){ 194 field->usage_page = (usage >> 16); 195 field->usage = (usage & 0xFF); 196 } 197 else { 198 field->usage = usage; 199 } 200 201 182 202 } 183 203 … … 342 362 343 363 /* reset local items */ 344 while(report_item->usages_count > 0){ 345 report_item->usages[--(report_item->usages_count)] = 0; 346 } 347 348 report_item->extended_usage_page = 0; 349 report_item->usage_minimum = 0; 350 report_item->usage_maximum = 0; 351 report_item->designator_index = 0; 352 report_item->designator_minimum = 0; 353 report_item->designator_maximum = 0; 354 report_item->string_index = 0; 355 report_item->string_minimum = 0; 356 report_item->string_maximum = 0; 364 usb_hid_report_reset_local_items (report_item); 357 365 358 366 break; … … 476 484 // TODO usage_path->flags = *data; 477 485 usb_hid_report_path_append_item(usage_path, report_item->usage_page, report_item->usages[report_item->usages_count-1]); 486 usb_hid_report_reset_local_items (report_item); 478 487 return USB_HID_NO_ACTION; 479 488 break; … … 567 576 { 568 577 case USB_HID_REPORT_TAG_USAGE: 569 report_item->usages[report_item->usages_count++] = usb_hid_report_tag_data_int32(data,item_size); 578 report_item->usages[report_item->usages_count] = usb_hid_report_tag_data_int32(data,item_size); 579 report_item->usages_count++; 570 580 break; 571 581 case USB_HID_REPORT_TAG_USAGE_MINIMUM: … … 1683 1693 } 1684 1694 1685 1695 void usb_hid_report_reset_local_items(usb_hid_report_item_t *report_item) 1696 { 1697 if(report_item == NULL) { 1698 return; 1699 } 1700 1701 report_item->usages_count = 0; 1702 memset(report_item->usages, 0, USB_HID_MAX_USAGES); 1703 1704 report_item->extended_usage_page = 0; 1705 report_item->usage_minimum = 0; 1706 report_item->usage_maximum = 0; 1707 report_item->designator_index = 0; 1708 report_item->designator_minimum = 0; 1709 report_item->designator_maximum = 0; 1710 report_item->string_index = 0; 1711 report_item->string_minimum = 0; 1712 report_item->string_maximum = 0; 1713 1714 return; 1715 } 1686 1716 /** 1687 1717 * @}
Note:
See TracChangeset
for help on using the changeset viewer.