Changes in uspace/lib/usb/src/hidparser.c [60a228f:32bfb96] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/hidparser.c
r60a228f r32bfb96 112 112 usb_hid_report_item_t *new_report_item; 113 113 114 size_t offset_input=0; 115 size_t offset_output=0; 116 size_t offset_feature=0; 114 size_t offset=0; 117 115 118 116 … … 120 118 return ENOMEM; 121 119 } 122 memset(report_item, 0, sizeof(usb_hid_report_item_t));123 124 120 link_initialize(&(report_item->link)); 125 121 … … 147 143 // store report item to report and create the new one 148 144 usb_log_debug("\nNEW REPORT ITEM: %X",tag); 145 146 report_item->offset = offset; 147 offset += report_item->count * report_item->size; 149 148 150 149 switch(tag) { 151 150 case USB_HID_REPORT_TAG_INPUT: 152 report_item->offset = offset_input;153 offset_input += report_item->count * report_item->size;154 151 usb_log_debug(" - INPUT\n"); 155 152 list_append(&(report_item->link), &(parser->input)); 156 153 break; 157 154 case USB_HID_REPORT_TAG_OUTPUT: 158 report_item->offset = offset_output;159 offset_output += report_item->count * report_item->size;160 155 usb_log_debug(" - OUTPUT\n"); 161 156 list_append(&(report_item->link), &(parser->output)); … … 163 158 break; 164 159 case USB_HID_REPORT_TAG_FEATURE: 165 report_item->offset = offset_feature;166 offset_feature += report_item->count * report_item->size;167 160 usb_log_debug(" - FEATURE\n"); 168 161 list_append(&(report_item->link), &(parser->feature)); … … 659 652 } 660 653 661 if((item->physical_minimum == 0) && (item->physical_maximum == 654 if((item->physical_minimum == 0) && (item->physical_maximum ==0)) { 662 655 item->physical_minimum = item->logical_minimum; 663 656 item->physical_maximum = item->logical_maximum; 664 657 } 665 658 666 if(item->physical_maximum == item->physical_minimum){ 667 resolution = 1; 668 } 669 else { 670 resolution = (item->logical_maximum - item->logical_minimum) / 671 ((item->physical_maximum - item->physical_minimum) * 672 (usb_pow(10,(item->unit_exponent)))); 673 } 659 resolution = (item->logical_maximum - item->logical_minimum) / ((item->physical_maximum - item->physical_minimum) * (usb_pow(10,(item->unit_exponent)))); 674 660 offset = item->offset + (j * item->size); 675 661 … … 708 694 709 695 usb_log_debug2("offset %d\n", offset); 710 711 696 usb_log_debug2("foo %x\n", *foo); 712 697 usb_log_debug2("maska %x\n", mask); … … 714 699 } 715 700 716 usb_log_debug2("---\n\n"); 701 usb_log_debug2("---\n\n"); 717 702 718 703 return (int)(((value - item->logical_minimum) / resolution) + item->physical_minimum);
Note:
See TracChangeset
for help on using the changeset viewer.