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