Changeset 8242dd86 in mainline


Ignore:
Timestamp:
2011-05-27T09:53:49Z (13 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e56b8a3
Parents:
1432fcf3
Message:

report parsing bug fix - multibyte items

File:
1 edited

Legend:

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

    r1432fcf3 r8242dd86  
    153153
    154154
    155         report_des = usb_hid_report_find_description(report, *report_id, type);
     155        report_des = usb_hid_report_find_description(report, *report_id,
     156                type);
     157
    156158        if(report_des == NULL) {
    157159                return EINVAL;
     
    167169                if(USB_HID_ITEM_FLAG_CONSTANT(item->item_flags) == 0) {
    168170                       
    169                         if(USB_HID_ITEM_FLAG_VARIABLE(item->item_flags) == 0) {
     171                        if(USB_HID_ITEM_FLAG_VARIABLE(item->item_flags) == 0){
    170172
    171173                                // array
     
    174176               
    175177                                item->usage = USB_HID_EXTENDED_USAGE(
    176                                     item->usages[item->value - item->physical_minimum]);
    177 
    178                                 item->usage_page = USB_HID_EXTENDED_USAGE_PAGE(
    179                                     item->usages[item->value - item->physical_minimum]);
    180 
    181                                 usb_hid_report_set_last_item (item->collection_path,
    182                                     USB_HID_TAG_CLASS_GLOBAL, item->usage_page);
    183 
    184                                 usb_hid_report_set_last_item (item->collection_path,
     178                                    item->usages[
     179                                    item->value - item->physical_minimum]);
     180
     181                                item->usage_page =
     182                                    USB_HID_EXTENDED_USAGE_PAGE(
     183                                    item->usages[
     184                                    item->value - item->physical_minimum]);
     185
     186                                usb_hid_report_set_last_item (
     187                                    item->collection_path,
     188                                    USB_HID_TAG_CLASS_GLOBAL,
     189                                    item->usage_page);
     190
     191                                usb_hid_report_set_last_item (
     192                                    item->collection_path,
    185193                                    USB_HID_TAG_CLASS_LOCAL, item->usage);
    186194                               
     
    188196                        else {
    189197                                // variable item
    190                                 item->value = usb_hid_translate_data(item, data);                               
     198                                item->value = usb_hid_translate_data(item,
     199                                    data);                             
    191200                        }                               
    192201                }
     
    213222       
    214223        int32_t value=0;
    215         int32_t mask;
    216         const uint8_t *foo;
     224        int32_t mask=0;
     225        const uint8_t *foo=0;
    217226
    218227        // now only shot tags are allowed
     
    240249        if((size_t)(offset/8) != (size_t)((offset+item->size-1)/8)) {
    241250               
    242                 part_size = ((offset+item->size)%8);
     251                part_size = 0;
    243252
    244253                size_t i=0;
     
    246255                        if(i == (size_t)(offset/8)) {
    247256                                // the higher one
     257                                part_size = 8 - (offset % 8);
    248258                                foo = data + i;
    249259                                mask =  ((1 << (item->size-part_size))-1);
     
    259269                                value = value << 8;
    260270                                value += *(data + 1);
     271                                part_size += 8;
    261272                        }
    262273                }
Note: See TracChangeset for help on using the changeset viewer.