Changeset f3b39b4 in mainline for uspace/lib/usbhid/src/hidparser.c
- Timestamp:
- 2011-05-26T20:43:26Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d861c22
- Parents:
- 14e1bcc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhid/src/hidparser.c
r14e1bcc rf3b39b4 167 167 while(list_item != &(report_des->report_items)) { 168 168 169 item = list_get_instance(list_item, usb_hid_report_field_t, link); 169 item = list_get_instance(list_item, usb_hid_report_field_t, 170 link); 170 171 171 172 if(USB_HID_ITEM_FLAG_CONSTANT(item->item_flags) == 0) { … … 174 175 175 176 // array 176 item->value = usb_hid_translate_data(item, data); 177 item->value = 178 usb_hid_translate_data(item, data); 177 179 178 180 item->usage = USB_HID_EXTENDED_USAGE( 179 item->usages[item->value - item->physical_minimum]); 181 item->usages[item->value - item->physical_minimum]); 182 180 183 item->usage_page = USB_HID_EXTENDED_USAGE_PAGE( 181 item->usages[item->value - item->physical_minimum]);184 item->usages[item->value - item->physical_minimum]); 182 185 183 186 usb_hid_report_set_last_item (item->collection_path, 184 USB_HID_TAG_CLASS_GLOBAL, item->usage_page); 187 USB_HID_TAG_CLASS_GLOBAL, item->usage_page); 188 185 189 usb_hid_report_set_last_item (item->collection_path, 186 190 USB_HID_TAG_CLASS_LOCAL, item->usage); … … 273 277 } 274 278 275 return (int)(((value - item->logical_minimum) / resolution) + item->physical_minimum); 279 return (int)(((value - item->logical_minimum) / resolution) + 280 item->physical_minimum); 276 281 277 282 } … … 415 420 if(i == (offset/8)) { 416 421 tmp_value = value; 417 tmp_value = tmp_value & ((1 << (8-(offset%8)))-1); 422 tmp_value = tmp_value & 423 ((1 << (8-(offset%8)))-1); 424 418 425 tmp_value = tmp_value << (offset%8); 419 426 420 mask = ~(((1 << (8-(offset%8)))-1) << (offset%8)); 421 buffer[i] = (buffer[i] & mask) | tmp_value; 427 mask = ~(((1 << (8-(offset%8)))-1) << 428 (offset%8)); 429 430 buffer[i] = (buffer[i] & mask) | 431 tmp_value; 422 432 } 423 433 else if (i == ((offset + length -1)/8)) { 424 434 425 value = value >> (length - ((offset + length) % 8)); 426 value = value & 427 ((1 << (length - ((offset + length) % 8))) - 1); 435 value = value >> (length - 436 ((offset + length) % 8)); 437 438 value = value & ((1 << (length - 439 ((offset + length) % 8))) - 1); 428 440 429 mask = (1 << (length - ((offset + length) % 8))) - 1; 441 mask = (1 << (length - 442 ((offset + length) % 8))) - 1; 443 430 444 buffer[i] = (buffer[i] & mask) | value; 431 445 } … … 529 543 usb_hid_report_type_t type) 530 544 { 531 usb_hid_report_description_t *report_des = usb_hid_report_find_description(532 report, path->report_id, type);545 usb_hid_report_description_t *report_des = 546 usb_hid_report_find_description(report, path->report_id, type); 533 547 534 548 link_t *field_it; … … 546 560 547 561 while(field_it != &report_des->report_items) { 548 field = list_get_instance(field_it, usb_hid_report_field_t, link); 562 field = list_get_instance(field_it, usb_hid_report_field_t, 563 link); 549 564 550 565 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); 566 usb_hid_report_path_append_item ( 567 field->collection_path, field->usage_page, 568 field->usage); 569 570 if(usb_hid_report_compare_usage_path( 571 field->collection_path, path, flags) == EOK){ 572 573 usb_hid_report_remove_last_item( 574 field->collection_path); 575 558 576 return field; 559 577 } 560 usb_hid_report_remove_last_item (field->collection_path); 578 usb_hid_report_remove_last_item ( 579 field->collection_path); 561 580 } 562 581 field_it = field_it->next;
Note:
See TracChangeset
for help on using the changeset viewer.