Changeset 45a2688 in mainline for uspace/lib/usb/src/hiddescriptor.c


Ignore:
Timestamp:
2011-05-07T08:31:10Z (14 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
78dbf5b, c7fbb90
Parents:
1ce4189 (diff), 5f7b75a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Changes from maklf - delimiters + usage paths comparison

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/src/hiddescriptor.c

    r1ce4189 r45a2688  
    437437int usb_hid_report_parse_main_tag(uint8_t tag, const uint8_t *data, size_t item_size,
    438438                             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       
    440442        switch(tag)
    441443        {
     
    448450                       
    449451                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;       
    451455                       
    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 
    455456                        // set last item
    456457                        usb_hid_report_set_last_item(usage_path, USB_HID_TAG_CLASS_GLOBAL, report_item->usage_page);
    457458                        usb_hid_report_set_last_item(usage_path, USB_HID_TAG_CLASS_LOCAL, report_item->usages[report_item->usages_count-1]);
     459                       
    458460                        // append the new one which will be set by common
    459461                        // usage/usage page
    460462                        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 
    463463                        usb_hid_report_reset_local_items (report_item);
    464464                        return USB_HID_NO_ACTION;
     
    551551                             usb_hid_report_item_t *report_item, usb_hid_report_path_t *usage_path)
    552552{
    553         switch(tag)
    554         {
     553        switch(tag) {
    555554                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++;
     555                        switch(report_item->in_delimiter) {
     556                                case INSIDE_DELIMITER_SET:
     557                                        // nothing to do
     558                                        break;
     559                                case START_DELIMITER_SET:
     560                                        report_item->in_delimiter = INSIDE_DELIMITER_SET;
     561                                case OUTSIDE_DELIMITER_SET:
     562                                        report_item->usages[report_item->usages_count] = usb_hid_report_tag_data_uint32(data,item_size);
     563                                        report_item->usages_count++;
     564                                        break;
     565                        }
    558566                        break;
    559567                case USB_HID_REPORT_TAG_USAGE_MINIMUM:
     
    596604                        break;                 
    597605                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                
     606                        report_item->in_delimiter = usb_hid_report_tag_data_uint32(data,item_size);
     607                        break;
     608
    607609                default:
    608610                        return USB_HID_NO_ACTION;
    609611        }
    610        
     612
    611613        return EOK;
    612614}
Note: See TracChangeset for help on using the changeset viewer.