Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhid/src/hidparser.c

    rd861c22 r14e1bcc  
    119119        }
    120120        else {
    121                 return ((report_des->bit_length + 7) / 8) ;
     121                if(report_id == 0) {                   
     122                        return ((report_des->bit_length + 7) / 8) ;
     123                }
     124                else {
     125                        return 1 + ((report_des->bit_length + 7) / 8);
     126                }
    122127        }
    123128}
     
    162167        while(list_item != &(report_des->report_items)) {
    163168
    164                 item = list_get_instance(list_item, usb_hid_report_field_t,
    165                                 link);
     169                item = list_get_instance(list_item, usb_hid_report_field_t, link);
    166170
    167171                if(USB_HID_ITEM_FLAG_CONSTANT(item->item_flags) == 0) {
     
    170174
    171175                                // array
    172                                 item->value =
    173                                         usb_hid_translate_data(item, data);
     176                                item->value = usb_hid_translate_data(item, data);
    174177               
    175178                                item->usage = USB_HID_EXTENDED_USAGE(
    176                                     item->usages[item->value - item->physical_minimum]);
    177 
     179                                        item->usages[item->value - item->physical_minimum]);
    178180                                item->usage_page = USB_HID_EXTENDED_USAGE_PAGE(
    179                                     item->usages[item->value - item->physical_minimum]);
     181                                        item->usages[item->value - item->physical_minimum]);                           
    180182
    181183                                usb_hid_report_set_last_item (item->collection_path,
    182                                     USB_HID_TAG_CLASS_GLOBAL, item->usage_page);
    183 
     184                                        USB_HID_TAG_CLASS_GLOBAL, item->usage_page);
    184185                                usb_hid_report_set_last_item (item->collection_path,
    185186                                    USB_HID_TAG_CLASS_LOCAL, item->usage);
     
    272273        }
    273274
    274         return (int)(((value - item->logical_minimum) / resolution) +
    275                 item->physical_minimum);
     275        return (int)(((value - item->logical_minimum) / resolution) + item->physical_minimum);
    276276       
    277277}
     
    415415                                if(i == (offset/8)) {
    416416                                        tmp_value = value;
    417                                         tmp_value = tmp_value &
    418                                                 ((1 << (8-(offset%8)))-1);
    419 
     417                                        tmp_value = tmp_value & ((1 << (8-(offset%8)))-1);                             
    420418                                        tmp_value = tmp_value << (offset%8);
    421419       
    422                                         mask = ~(((1 << (8-(offset%8)))-1) <<
    423                                                         (offset%8));
    424 
    425                                         buffer[i] = (buffer[i] & mask) |
    426                                                 tmp_value;
     420                                        mask = ~(((1 << (8-(offset%8)))-1) << (offset%8));
     421                                        buffer[i] = (buffer[i] & mask) | tmp_value;                     
    427422                                }
    428423                                else if (i == ((offset + length -1)/8)) {
    429424                                       
    430                                         value = value >> (length -
    431                                                 ((offset + length) % 8));
    432 
    433                                         value = value & ((1 << (length -
    434                                                 ((offset + length) % 8))) - 1);
     425                                        value = value >> (length - ((offset + length) % 8));
     426                                        value = value &
     427                                                ((1 << (length - ((offset + length) % 8))) - 1);
    435428                               
    436                                         mask = (1 << (length -
    437                                                 ((offset + length) % 8))) - 1;
    438 
     429                                        mask = (1 << (length - ((offset + length) % 8))) - 1;
    439430                                        buffer[i] = (buffer[i] & mask) | value;
    440431                                }
     
    538529        usb_hid_report_type_t type)
    539530{
    540         usb_hid_report_description_t *report_des =
    541                 usb_hid_report_find_description(report, path->report_id, type);
     531        usb_hid_report_description_t *report_des = usb_hid_report_find_description(
     532                report, path->report_id, type);
    542533
    543534        link_t *field_it;
     
    555546
    556547        while(field_it != &report_des->report_items) {
    557                 field = list_get_instance(field_it, usb_hid_report_field_t,
    558                         link);
     548                field = list_get_instance(field_it, usb_hid_report_field_t, link);
    559549
    560550                if(USB_HID_ITEM_FLAG_CONSTANT(field->item_flags) == 0) {
    561                         usb_hid_report_path_append_item (
    562                                 field->collection_path, field->usage_page,
    563                                 field->usage);
    564 
    565                         if(usb_hid_report_compare_usage_path(
    566                                 field->collection_path, path, flags) == EOK){
    567 
    568                                 usb_hid_report_remove_last_item(
    569                                         field->collection_path);
    570 
     551                        usb_hid_report_path_append_item (field->collection_path,
     552                                field->usage_page, field->usage);
     553
     554                        if(usb_hid_report_compare_usage_path(field->collection_path, path,
     555                                flags) == EOK){
     556
     557                                usb_hid_report_remove_last_item(field->collection_path);
    571558                                return field;
    572559                        }
    573                         usb_hid_report_remove_last_item (
    574                                 field->collection_path);
     560                        usb_hid_report_remove_last_item (field->collection_path);
    575561                }
    576562                field_it = field_it->next;
Note: See TracChangeset for help on using the changeset viewer.