Changes in uspace/lib/usbhid/src/hidparser.c [d861c22:14e1bcc] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhid/src/hidparser.c
rd861c22 r14e1bcc 119 119 } 120 120 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 } 122 127 } 123 128 } … … 162 167 while(list_item != &(report_des->report_items)) { 163 168 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); 166 170 167 171 if(USB_HID_ITEM_FLAG_CONSTANT(item->item_flags) == 0) { … … 170 174 171 175 // array 172 item->value = 173 usb_hid_translate_data(item, data); 176 item->value = usb_hid_translate_data(item, data); 174 177 175 178 item->usage = USB_HID_EXTENDED_USAGE( 176 item->usages[item->value - item->physical_minimum]); 177 179 item->usages[item->value - item->physical_minimum]); 178 180 item->usage_page = USB_HID_EXTENDED_USAGE_PAGE( 179 item->usages[item->value - item->physical_minimum]);181 item->usages[item->value - item->physical_minimum]); 180 182 181 183 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); 184 185 usb_hid_report_set_last_item (item->collection_path, 185 186 USB_HID_TAG_CLASS_LOCAL, item->usage); … … 272 273 } 273 274 274 return (int)(((value - item->logical_minimum) / resolution) + 275 item->physical_minimum); 275 return (int)(((value - item->logical_minimum) / resolution) + item->physical_minimum); 276 276 277 277 } … … 415 415 if(i == (offset/8)) { 416 416 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); 420 418 tmp_value = tmp_value << (offset%8); 421 419 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; 427 422 } 428 423 else if (i == ((offset + length -1)/8)) { 429 424 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); 435 428 436 mask = (1 << (length - 437 ((offset + length) % 8))) - 1; 438 429 mask = (1 << (length - ((offset + length) % 8))) - 1; 439 430 buffer[i] = (buffer[i] & mask) | value; 440 431 } … … 538 529 usb_hid_report_type_t type) 539 530 { 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); 542 533 543 534 link_t *field_it; … … 555 546 556 547 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); 559 549 560 550 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); 571 558 return field; 572 559 } 573 usb_hid_report_remove_last_item ( 574 field->collection_path); 560 usb_hid_report_remove_last_item (field->collection_path); 575 561 } 576 562 field_it = field_it->next;
Note:
See TracChangeset
for help on using the changeset viewer.