Changeset 674cf89 in mainline
- Timestamp:
- 2011-05-06T13:33:56Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1be39e9
- Parents:
- 22ded10
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/hiddescriptor.c
r22ded10 r674cf89 437 437 int usb_hid_report_parse_main_tag(uint8_t tag, const uint8_t *data, size_t item_size, 438 438 usb_hid_report_item_t *report_item, usb_hid_report_path_t *usage_path) 439 { 439 { 440 usb_hid_report_usage_path_t *path_item; 441 440 442 switch(tag) 441 443 { … … 448 450 449 451 case USB_HID_REPORT_TAG_COLLECTION: 450 //TODO: usage_path->flags = *data; 452 // store collection atributes 453 path_item = list_get_instance(usage_path->head.prev, usb_hid_report_usage_path_t, link); 454 path_item->flags = *data; 451 455 452 usb_log_debug("APPENDED ITEM TO USAGE PATH (PAGE %d, USAGE %d\n", report_item->usage_page, report_item->usages[report_item->usages_count-1]);453 usb_hid_print_usage_path(usage_path);454 455 456 // set last item 456 457 usb_hid_report_set_last_item(usage_path, USB_HID_TAG_CLASS_GLOBAL, report_item->usage_page); 457 458 usb_hid_report_set_last_item(usage_path, USB_HID_TAG_CLASS_LOCAL, report_item->usages[report_item->usages_count-1]); 459 458 460 // append the new one which will be set by common 459 461 // usage/usage page 460 462 usb_hid_report_path_append_item(usage_path, report_item->usage_page, report_item->usages[report_item->usages_count-1]); 461 usb_hid_print_usage_path(usage_path);462 463 463 usb_hid_report_reset_local_items (report_item); 464 464 return USB_HID_NO_ACTION; … … 551 551 usb_hid_report_item_t *report_item, usb_hid_report_path_t *usage_path) 552 552 { 553 switch(tag) 554 { 555 case USB_HID_REPORT_TAG_USAGE: 556 report_item->usages[report_item->usages_count] = usb_hid_report_tag_data_uint32(data,item_size); 557 report_item->usages_count++; 558 break; 559 case USB_HID_REPORT_TAG_USAGE_MINIMUM: 560 if (item_size == 3) { 561 // usage extended usages 562 report_item->extended_usage_page = (usb_hid_report_tag_data_uint32(data,item_size) & 0xFF00) >> 16; 563 report_item->usage_minimum = usb_hid_report_tag_data_uint32(data,item_size) & 0xFF; 553 switch(report_item->in_delimiter) { 554 case INSIDE_DELIMITER_SET: 555 // nothing to do 556 break; 557 case START_DELIMITER_SET: 558 report_item->in_delimiter = INSIDE_DELIMITER_SET; 559 case OUTSIDE_DELIMITER_SET: 560 561 switch(tag) { 562 case USB_HID_REPORT_TAG_USAGE: 563 report_item->usages[report_item->usages_count] = usb_hid_report_tag_data_uint32(data,item_size); 564 report_item->usages_count++; 565 break; 566 case USB_HID_REPORT_TAG_USAGE_MINIMUM: 567 if (item_size == 3) { 568 // usage extended usages 569 report_item->extended_usage_page = (usb_hid_report_tag_data_uint32(data,item_size) & 0xFF00) >> 16; 570 report_item->usage_minimum = usb_hid_report_tag_data_uint32(data,item_size) & 0xFF; 571 } 572 else { 573 report_item->usage_minimum = usb_hid_report_tag_data_uint32(data,item_size); 574 } 575 break; 576 case USB_HID_REPORT_TAG_USAGE_MAXIMUM: 577 if (item_size == 3) { 578 // usage extended usages 579 report_item->extended_usage_page = (usb_hid_report_tag_data_uint32(data,item_size) & 0xFF00) >> 16; 580 report_item->usage_maximum = usb_hid_report_tag_data_uint32(data,item_size) & 0xFF; 581 } 582 else { 583 report_item->usage_maximum = usb_hid_report_tag_data_uint32(data,item_size); 584 } 585 break; 586 case USB_HID_REPORT_TAG_DESIGNATOR_INDEX: 587 report_item->designator_index = usb_hid_report_tag_data_uint32(data,item_size); 588 break; 589 case USB_HID_REPORT_TAG_DESIGNATOR_MINIMUM: 590 report_item->designator_minimum = usb_hid_report_tag_data_uint32(data,item_size); 591 break; 592 case USB_HID_REPORT_TAG_DESIGNATOR_MAXIMUM: 593 report_item->designator_maximum = usb_hid_report_tag_data_uint32(data,item_size); 594 break; 595 case USB_HID_REPORT_TAG_STRING_INDEX: 596 report_item->string_index = usb_hid_report_tag_data_uint32(data,item_size); 597 break; 598 case USB_HID_REPORT_TAG_STRING_MINIMUM: 599 report_item->string_minimum = usb_hid_report_tag_data_uint32(data,item_size); 600 break; 601 case USB_HID_REPORT_TAG_STRING_MAXIMUM: 602 report_item->string_maximum = usb_hid_report_tag_data_uint32(data,item_size); 603 break; 604 case USB_HID_REPORT_TAG_DELIMITER: 605 report_item->in_delimiter = usb_hid_report_tag_data_uint32(data,item_size); 606 break; 607 608 default: 609 return USB_HID_NO_ACTION; 564 610 } 565 else { 566 report_item->usage_minimum = usb_hid_report_tag_data_uint32(data,item_size); 567 } 568 break; 569 case USB_HID_REPORT_TAG_USAGE_MAXIMUM: 570 if (item_size == 3) { 571 // usage extended usages 572 report_item->extended_usage_page = (usb_hid_report_tag_data_uint32(data,item_size) & 0xFF00) >> 16; 573 report_item->usage_maximum = usb_hid_report_tag_data_uint32(data,item_size) & 0xFF; 574 } 575 else { 576 report_item->usage_maximum = usb_hid_report_tag_data_uint32(data,item_size); 577 } 578 break; 579 case USB_HID_REPORT_TAG_DESIGNATOR_INDEX: 580 report_item->designator_index = usb_hid_report_tag_data_uint32(data,item_size); 581 break; 582 case USB_HID_REPORT_TAG_DESIGNATOR_MINIMUM: 583 report_item->designator_minimum = usb_hid_report_tag_data_uint32(data,item_size); 584 break; 585 case USB_HID_REPORT_TAG_DESIGNATOR_MAXIMUM: 586 report_item->designator_maximum = usb_hid_report_tag_data_uint32(data,item_size); 587 break; 588 case USB_HID_REPORT_TAG_STRING_INDEX: 589 report_item->string_index = usb_hid_report_tag_data_uint32(data,item_size); 590 break; 591 case USB_HID_REPORT_TAG_STRING_MINIMUM: 592 report_item->string_minimum = usb_hid_report_tag_data_uint32(data,item_size); 593 break; 594 case USB_HID_REPORT_TAG_STRING_MAXIMUM: 595 report_item->string_maximum = usb_hid_report_tag_data_uint32(data,item_size); 596 break; 597 case USB_HID_REPORT_TAG_DELIMITER: 598 if (report_item->in_delimiter == OUTSIDE_DELIMITER_SET) { 599 report_item->in_delimiter = START_DELIMITER_SET; 600 } 601 else { 602 report_item->in_delimiter = OUTSIDE_DELIMITER_SET; 603 } 604 605 break; 606 607 default: 608 return USB_HID_NO_ACTION; 611 612 break; 609 613 } 610 614
Note:
See TracChangeset
for help on using the changeset viewer.