Changeset 68b614e in mainline for uspace/lib/usb/src/hiddescriptor.c


Ignore:
Timestamp:
2011-05-08T16:00:58Z (14 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f50f722
Parents:
cc5908e
Message:

Correct parsing of usages in case of array items

File:
1 edited

Legend:

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

    rcc5908e r68b614e  
    6464{
    6565        /* 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;
    6768        usb_hid_report_path_t *path = NULL;
     69       
     70       
    6871        while(path_it != &report->collection_paths) {
    6972                path = list_get_instance(path_it, usb_hid_report_path_t, link);
     
    115118        usb_hid_report_field_t *field;
    116119        int i;
    117 
    118         usb_log_debug("usages_count  - %zu\n", report_item->usages_count);
    119120
    120121        uint32_t *usages;
     
    147148                        */
    148149                        field->usage = 0;
    149                         field->usage_page = report_item->usage_page;
     150                        field->usage_page = 0; //report_item->usage_page;
    150151
    151152                        field->usages_count = report_item->usages_count;
     
    168169                        }
    169170                        else {
     171                                // should not occur
    170172                                field->usage = usage;
    171173                                field->usage_page = report_item->usage_page;
     
    465467                       
    466468                        // 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]));
    469475                       
    470476                        // append the new one which will be set by common
     
    561567                             usb_hid_report_item_t *report_item, usb_hid_report_path_t *usage_path)
    562568{
     569        int32_t extended_usage;
     570       
    563571        switch(tag) {
    564572                case USB_HID_REPORT_TAG_USAGE:
     
    570578                                        report_item->in_delimiter = INSIDE_DELIMITER_SET;
    571579                                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;
    573583                                        report_item->usages_count++;
    574584                                        break;
     
    607617                                }
    608618                                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;
    610621                                }
    611622                        }
     
    691702                usb_log_debug("\t\ttUSAGEMIN: %X\n", report_item->usage_minimum);
    692703                usb_log_debug("\t\tUSAGEMAX: %X\n", report_item->usage_maximum);
     704                usb_log_debug("\t\tUSAGES COUNT: %zu\n", report_item->usages_count);
    693705
    694706                usb_log_debug("\t\tVALUE: %X\n", report_item->value);
     
    696708                usb_log_debug("\t\tUSAGE PAGE: %X\n", report_item->usage_page);
    697709               
    698                 //usb_hid_print_usage_path(report_item->collection_path);
     710                usb_hid_print_usage_path(report_item->collection_path);
    699711
    700712                usb_log_debug("\n");           
     
    728740                usb_hid_descriptor_print_list(&report_des->report_items);
    729741
    730 
     742/*
    731743                link_t *path_it = report->collection_paths.next;
    732744                while(path_it != &report->collection_paths) {
     
    734746                        path_it = path_it->next;
    735747                }
    736                
     748*/             
    737749                report_it = report_it->next;
    738750        }
Note: See TracChangeset for help on using the changeset viewer.