Changeset 68b614e in mainline
- Timestamp:
- 2011-05-08T16:00:58Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f50f722
- Parents:
- cc5908e
- Location:
- uspace/lib/usb/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/hiddescriptor.c
rcc5908e r68b614e 64 64 { 65 65 /* find or append current collection path to the list */ 66 link_t *path_it = report->collection_paths.next; 66 //link_t *path_it = report->collection_paths.next; 67 link_t *path_it = report->collection_paths.prev->next; 67 68 usb_hid_report_path_t *path = NULL; 69 70 68 71 while(path_it != &report->collection_paths) { 69 72 path = list_get_instance(path_it, usb_hid_report_path_t, link); … … 115 118 usb_hid_report_field_t *field; 116 119 int i; 117 118 usb_log_debug("usages_count - %zu\n", report_item->usages_count);119 120 120 121 uint32_t *usages; … … 147 148 */ 148 149 field->usage = 0; 149 field->usage_page = report_item->usage_page;150 field->usage_page = 0; //report_item->usage_page; 150 151 151 152 field->usages_count = report_item->usages_count; … … 168 169 } 169 170 else { 171 // should not occur 170 172 field->usage = usage; 171 173 field->usage_page = report_item->usage_page; … … 465 467 466 468 // set last item 467 usb_hid_report_set_last_item(usage_path, USB_HID_TAG_CLASS_GLOBAL, report_item->usage_page); 468 usb_hid_report_set_last_item(usage_path, USB_HID_TAG_CLASS_LOCAL, report_item->usages[report_item->usages_count-1]); 469 usb_hid_report_set_last_item(usage_path, 470 USB_HID_TAG_CLASS_GLOBAL, 471 USB_HID_EXTENDED_USAGE_PAGE(report_item->usages[report_item->usages_count-1])); 472 usb_hid_report_set_last_item(usage_path, 473 USB_HID_TAG_CLASS_LOCAL, 474 USB_HID_EXTENDED_USAGE(report_item->usages[report_item->usages_count-1])); 469 475 470 476 // append the new one which will be set by common … … 561 567 usb_hid_report_item_t *report_item, usb_hid_report_path_t *usage_path) 562 568 { 569 int32_t extended_usage; 570 563 571 switch(tag) { 564 572 case USB_HID_REPORT_TAG_USAGE: … … 570 578 report_item->in_delimiter = INSIDE_DELIMITER_SET; 571 579 case OUTSIDE_DELIMITER_SET: 572 report_item->usages[report_item->usages_count] = usb_hid_report_tag_data_uint32(data,item_size); 580 extended_usage = ((report_item->usage_page) << 16); 581 extended_usage += usb_hid_report_tag_data_uint32(data,item_size); 582 report_item->usages[report_item->usages_count] = extended_usage; 573 583 report_item->usages_count++; 574 584 break; … … 607 617 } 608 618 else { 609 report_item->usages[report_item->usages_count++] = i; 619 620 report_item->usages[report_item->usages_count++] = (report_item->usage_page << 16) + i; 610 621 } 611 622 } … … 691 702 usb_log_debug("\t\ttUSAGEMIN: %X\n", report_item->usage_minimum); 692 703 usb_log_debug("\t\tUSAGEMAX: %X\n", report_item->usage_maximum); 704 usb_log_debug("\t\tUSAGES COUNT: %zu\n", report_item->usages_count); 693 705 694 706 usb_log_debug("\t\tVALUE: %X\n", report_item->value); … … 696 708 usb_log_debug("\t\tUSAGE PAGE: %X\n", report_item->usage_page); 697 709 698 //usb_hid_print_usage_path(report_item->collection_path);710 usb_hid_print_usage_path(report_item->collection_path); 699 711 700 712 usb_log_debug("\n"); … … 728 740 usb_hid_descriptor_print_list(&report_des->report_items); 729 741 730 742 /* 731 743 link_t *path_it = report->collection_paths.next; 732 744 while(path_it != &report->collection_paths) { … … 734 746 path_it = path_it->next; 735 747 } 736 748 */ 737 749 report_it = report_it->next; 738 750 } -
uspace/lib/usb/src/hidparser.c
rcc5908e r68b614e 111 111 usb_hid_report_description_t *report_des; 112 112 usb_hid_report_type_t type = USB_HID_REPORT_TYPE_INPUT; 113 113 114 114 if(report == NULL) { 115 115 return EINVAL; … … 140 140 141 141 item->usage = USB_HID_EXTENDED_USAGE(item->usages[item->value - item->physical_minimum]); 142 item->usage_page = USB_HID_EXTENDED_USAGE_PAGE(item->usages[item->value - item->physical_minimum]); 143 142 item->usage_page = USB_HID_EXTENDED_USAGE_PAGE(item->usages[item->value - item->physical_minimum]); 143 144 usb_hid_report_set_last_item (item->collection_path, 145 USB_HID_TAG_CLASS_GLOBAL, 146 item->usage_page); 147 usb_hid_report_set_last_item (item->collection_path, 148 USB_HID_TAG_CLASS_LOCAL, 149 item->usage); 150 144 151 } 145 152 else { … … 150 157 list_item = list_item->next; 151 158 } 152 159 153 160 return EOK; 154 161 -
uspace/lib/usb/src/hidpath.c
rcc5908e r68b614e 42 42 43 43 44 #define USB_HID_SAME_USAGE(usage1, usage2) ((usage1 == usage2) || (usage1 == 0) || (usage2 == 0)) 45 #define USB_HID_SAME_USAGE_PAGE(page1, page2) ((page1 == page2) || (page1 == 0) || (page2 == 0)) 46 44 47 /** 45 48 * Appends one item (couple of usage_path and usage) into the usage path … … 203 206 while(report_link != &report_path->head) { 204 207 report_item = list_get_instance(report_link, usb_hid_report_usage_path_t, link); 205 if( report_item->usage_page == path_item->usage_page){208 if(USB_HID_SAME_USAGE_PAGE(report_item->usage_page, path_item->usage_page)){ 206 209 if(only_page == 0){ 207 if( report_item->usage == path_item->usage) {210 if(USB_HID_SAME_USAGE(report_item->usage, path_item->usage)) { 208 211 return EOK; 209 212 } … … 242 245 link); 243 246 244 if( (report_item->usage_page !=path_item->usage_page) ||247 if(!USB_HID_SAME_USAGE_PAGE(report_item->usage_page, path_item->usage_page) || 245 248 ((only_page == 0) && 246 (report_item->usage !=path_item->usage))) {249 !USB_HID_SAME_USAGE(report_item->usage, path_item->usage))) { 247 250 248 251 return 1; … … 282 285 usb_hid_report_usage_path_t, 283 286 link); 284 285 if( (report_item->usage_page !=path_item->usage_page) ||287 288 if(!USB_HID_SAME_USAGE_PAGE(report_item->usage_page, path_item->usage_page) || 286 289 ((only_page == 0) && 287 (report_item->usage !=path_item->usage))) {288 290 !USB_HID_SAME_USAGE(report_item->usage, path_item->usage))) { 291 return 1; 289 292 } else { 290 293 report_link = report_link->prev;
Note:
See TracChangeset
for help on using the changeset viewer.