Changes in uspace/lib/usb/src/hidparser.c [c32688d:60a228f] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/hidparser.c
rc32688d r60a228f 178 178 } 179 179 memcpy(new_report_item,report_item, sizeof(usb_hid_report_item_t)); 180 /* reset local items */181 new_report_item->usage_minimum = 0;182 new_report_item->usage_maximum = 0;183 184 180 link_initialize(&(new_report_item->link)); 185 181 report_item = new_report_item; … … 505 501 usb_log_debug("\tCOUNT: %X\n", report_item->count); 506 502 usb_log_debug("\tSIZE: %X\n", report_item->size); 507 usb_log_debug("\tCONSTANT/VAR: %X\n", USB_HID_ITEM_FLAG_CONSTANT(report_item->item_flags)); 508 usb_log_debug("\tVARIABLE/ARRAY: %X\n", USB_HID_ITEM_FLAG_VARIABLE(report_item->item_flags)); 503 usb_log_debug("\tCONSTANT: %X\n", USB_HID_ITEM_FLAG_CONSTANT(report_item->item_flags)); 509 504 usb_log_debug("\tUSAGE: %X\n", report_item->usage); 510 505 usb_log_debug("\tUSAGE PAGE: %X\n", report_item->usage_page); … … 513 508 usb_log_debug("\tPHYMIN: %X\n", report_item->physical_minimum); 514 509 usb_log_debug("\tPHYMAX: %X\n", report_item->physical_maximum); 515 usb_log_debug("\tUSAGEMIN: %X\n", report_item->usage_minimum);516 usb_log_debug("\tUSAGEMAX: %X\n", report_item->usage_maximum);517 518 510 usb_log_debug("\n"); 519 511 … … 610 602 usb_hid_report_item_t *item; 611 603 uint8_t *keys; 612 uint8_t item_value;613 604 size_t key_count=0; 614 605 size_t i=0; … … 616 607 617 608 // get the size of result keycodes array 618 usb_hid_report_path_t path; 619 path.usage_page = BAD_HACK_USAGE_PAGE; 620 key_count = usb_hid_report_input_length(parser, &path); 621 609 list_item = parser->input.next; 610 while(list_item != &(parser->input)) { 611 612 item = list_get_instance(list_item, usb_hid_report_item_t, link); 613 if(item->usage_page == BAD_HACK_USAGE_PAGE) { 614 key_count += item->count; 615 } 616 617 list_item = list_item->next; 618 } 619 620 622 621 if(!(keys = malloc(sizeof(uint8_t) * key_count))){ 623 622 return ENOMEM; … … 629 628 630 629 item = list_get_instance(list_item, usb_hid_report_item_t, link); 631 if(!USB_HID_ITEM_FLAG_CONSTANT(item->item_flags) && 632 (item->usage_page == path.usage_page)) { 630 if(item->usage_page == BAD_HACK_USAGE_PAGE) { 633 631 for(j=0; j<(size_t)(item->count); j++) { 634 if((USB_HID_ITEM_FLAG_VARIABLE(item->item_flags) == 0) || 635 ((item->usage_minimum == 0) && (item->usage_maximum == 0))) { 636 // variable item 637 keys[i++] = usb_hid_translate_data(item, data,j); 638 } 639 else { 640 // bitmapa 641 if((item_value = usb_hid_translate_data(item, data, j)) != 0) { 642 keys[i++] = j + item->usage_minimum; 643 } 644 else { 645 keys[i++] = 0; 646 } 647 } 632 keys[i++] = usb_hid_translate_data(item, data,j); 648 633 } 649 634 } … … 734 719 735 720 } 736 737 int usb_hid_report_input_length(const usb_hid_report_parser_t *parser,738 const usb_hid_report_path_t *path)739 {740 int ret = 0;741 link_t *item;742 usb_hid_report_item_t *report_item;743 744 item = (&parser->input)->next;745 while(&parser->input != item) {746 report_item = list_get_instance(item, usb_hid_report_item_t, link);747 if(!USB_HID_ITEM_FLAG_CONSTANT(report_item->item_flags) &&748 (report_item->usage_page == path->usage_page)) {749 ret += report_item->count;750 }751 752 item = item->next;753 }754 755 return ret;756 }757 758 759 760 721 /** 761 722 * @}
Note:
See TracChangeset
for help on using the changeset viewer.