Changes in uspace/lib/usb/src/hiddescriptor.c [3b5d5b9d:b9d7965] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/hiddescriptor.c
r3b5d5b9d rb9d7965 101 101 } 102 102 103 104 /*105 *106 *107 */108 103 int usb_hid_report_append_fields(usb_hid_report_t *report, usb_hid_report_item_t *report_item) 109 104 { … … 139 134 if(report_item->usages_count > 0 && ((report_item->usage_minimum == 0) && (report_item->usage_maximum == 0))) { 140 135 uint32_t usage; 141 if(i < report_item->usages_count){ 142 usage = report_item->usages[i]; 136 if(report_item->type != USB_HID_REPORT_TYPE_OUTPUT) { 137 if(i < report_item->usages_count){ 138 usage = report_item->usages[i]; 139 } 140 else { 141 usage = report_item->usages[report_item->usages_count - 1]; 142 } 143 143 } 144 144 else { 145 usage = report_item->usages[report_item->usages_count - 1]; 145 if((report_item->count - i - 1) < report_item->usages_count){ 146 usage = report_item->usages[(report_item->count - i - 1)]; 147 } 148 else { 149 usage = report_item->usages[report_item->usages_count - 1]; 150 } 146 151 } 147 152 … … 159 164 160 165 if((USB_HID_ITEM_FLAG_VARIABLE(report_item->item_flags) != 0) && (!((report_item->usage_minimum == 0) && (report_item->usage_maximum == 0)))) { 161 field->usage = report_item->usage_minimum + i; 166 if(report_item->type == USB_HID_REPORT_TYPE_INPUT) { 167 field->usage = report_item->usage_maximum - i; 168 } 169 else { 170 field->usage = report_item->usage_minimum + i; 171 } 172 162 173 } 163 174 … … 168 179 169 180 field->size = report_item->size; 170 171 size_t offset_byte = (report_item->offset + (i * report_item->size)) / 8; 172 size_t offset_bit = 8 - ((report_item->offset + (i * report_item->size)) % 8) - report_item->size; 173 174 field->offset = 8 * offset_byte + offset_bit; 181 field->offset = report_item->offset + (i * report_item->size); 175 182 if(report_item->id != 0) { 176 183 field->offset += 8;
Note:
See TracChangeset
for help on using the changeset viewer.