Ignore:
File:
1 edited

Legend:

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

    r14e1bcc rd861c22  
    119119        }
    120120        else {
    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                 }
     121                return ((report_des->bit_length + 7) / 8) ;
    127122        }
    128123}
     
    167162        while(list_item != &(report_des->report_items)) {
    168163
    169                 item = list_get_instance(list_item, usb_hid_report_field_t, link);
     164                item = list_get_instance(list_item, usb_hid_report_field_t,
     165                                link);
    170166
    171167                if(USB_HID_ITEM_FLAG_CONSTANT(item->item_flags) == 0) {
     
    174170
    175171                                // array
    176                                 item->value = usb_hid_translate_data(item, data);
     172                                item->value =
     173                                        usb_hid_translate_data(item, data);
    177174               
    178175                                item->usage = USB_HID_EXTENDED_USAGE(
    179                                         item->usages[item->value - item->physical_minimum]);
     176                                    item->usages[item->value - item->physical_minimum]);
     177
    180178                                item->usage_page = USB_HID_EXTENDED_USAGE_PAGE(
    181                                         item->usages[item->value - item->physical_minimum]);                           
     179                                    item->usages[item->value - item->physical_minimum]);
    182180
    183181                                usb_hid_report_set_last_item (item->collection_path,
    184                                         USB_HID_TAG_CLASS_GLOBAL, item->usage_page);
     182                                    USB_HID_TAG_CLASS_GLOBAL, item->usage_page);
     183
    185184                                usb_hid_report_set_last_item (item->collection_path,
    186185                                    USB_HID_TAG_CLASS_LOCAL, item->usage);
     
    273272        }
    274273
    275         return (int)(((value - item->logical_minimum) / resolution) + item->physical_minimum);
     274        return (int)(((value - item->logical_minimum) / resolution) +
     275                item->physical_minimum);
    276276       
    277277}
     
    415415                                if(i == (offset/8)) {
    416416                                        tmp_value = value;
    417                                         tmp_value = tmp_value & ((1 << (8-(offset%8)))-1);                             
     417                                        tmp_value = tmp_value &
     418                                                ((1 << (8-(offset%8)))-1);
     419
    418420                                        tmp_value = tmp_value << (offset%8);
    419421       
    420                                         mask = ~(((1 << (8-(offset%8)))-1) << (offset%8));
    421                                         buffer[i] = (buffer[i] & mask) | tmp_value;                     
     422                                        mask = ~(((1 << (8-(offset%8)))-1) <<
     423                                                        (offset%8));
     424
     425                                        buffer[i] = (buffer[i] & mask) |
     426                                                tmp_value;
    422427                                }
    423428                                else if (i == ((offset + length -1)/8)) {
    424429                                       
    425                                         value = value >> (length - ((offset + length) % 8));
    426                                         value = value &
    427                                                 ((1 << (length - ((offset + length) % 8))) - 1);
     430                                        value = value >> (length -
     431                                                ((offset + length) % 8));
     432
     433                                        value = value & ((1 << (length -
     434                                                ((offset + length) % 8))) - 1);
    428435                               
    429                                         mask = (1 << (length - ((offset + length) % 8))) - 1;
     436                                        mask = (1 << (length -
     437                                                ((offset + length) % 8))) - 1;
     438
    430439                                        buffer[i] = (buffer[i] & mask) | value;
    431440                                }
     
    529538        usb_hid_report_type_t type)
    530539{
    531         usb_hid_report_description_t *report_des = usb_hid_report_find_description(
    532                 report, path->report_id, type);
     540        usb_hid_report_description_t *report_des =
     541                usb_hid_report_find_description(report, path->report_id, type);
    533542
    534543        link_t *field_it;
     
    546555
    547556        while(field_it != &report_des->report_items) {
    548                 field = list_get_instance(field_it, usb_hid_report_field_t, link);
     557                field = list_get_instance(field_it, usb_hid_report_field_t,
     558                        link);
    549559
    550560                if(USB_HID_ITEM_FLAG_CONSTANT(field->item_flags) == 0) {
    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);
     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
    558571                                return field;
    559572                        }
    560                         usb_hid_report_remove_last_item (field->collection_path);
     573                        usb_hid_report_remove_last_item (
     574                                field->collection_path);
    561575                }
    562576                field_it = field_it->next;
Note: See TracChangeset for help on using the changeset viewer.