Changes in uspace/lib/usbhid/src/hidparser.c [feeac0d:1e371cf] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhid/src/hidparser.c
rfeeac0d r1e371cf 132 132 usb_hid_report_description_t *report_des; 133 133 usb_hid_report_type_t type = USB_HID_REPORT_TYPE_INPUT; 134 134 135 135 if (report == NULL) { 136 136 return EINVAL; … … 155 155 156 156 if (USB_HID_ITEM_FLAG_CONSTANT(item->item_flags) == 0) { 157 157 158 158 if (USB_HID_ITEM_FLAG_VARIABLE(item->item_flags) == 0) { 159 159 /* array */ 160 160 item->value = 161 161 usb_hid_translate_data(item, data); 162 162 163 163 item->usage = USB_HID_EXTENDED_USAGE( 164 164 item->usages[item->value - … … 185 185 } 186 186 } 187 187 188 188 return EOK; 189 189 } … … 293 293 294 294 list_foreach(report->reports, reports_link, 295 usb_hid_report_description_t, report_des) { 296 if ((report_des->report_id == report_id) && 297 (report_des->type == USB_HID_REPORT_TYPE_OUTPUT)) { 295 usb_hid_report_description_t, rdes) { 296 if ((rdes->report_id == report_id) && 297 (rdes->type == USB_HID_REPORT_TYPE_OUTPUT)) { 298 report_des = rdes; 298 299 break; 299 300 } … … 340 341 int length; 341 342 int32_t tmp_value; 342 343 343 344 if (report == NULL) { 344 345 return EINVAL; … … 352 353 report_des = usb_hid_report_find_description(report, report_id, 353 354 USB_HID_REPORT_TYPE_OUTPUT); 354 355 355 356 if (report_des == NULL) { 356 357 return EINVAL; … … 364 365 offset = report_des->bit_length - report_item->offset - 1; 365 366 length = report_item->size; 366 367 367 368 usb_log_debug("\ttranslated value: %x\n", value); 368 369 … … 375 376 value = value << shift; 376 377 value = value & (((1 << length) - 1) << shift); 377 378 378 379 uint8_t mask = 0; 379 380 mask = 0xff - (((1 << length) - 1) << shift); … … 391 392 392 393 tmp_value = tmp_value << (offset % 8); 393 394 394 395 mask = ~(((1 << (8 - (offset % 8))) - 1) 395 396 << (offset % 8)); … … 398 399 tmp_value; 399 400 } else if (i == ((offset + length - 1) / 8)) { 400 401 401 402 value = value >> (length - 402 403 ((offset + length) % 8)); … … 404 405 value = value & ((1 << (length - 405 406 ((offset + length) % 8))) - 1); 406 407 407 408 mask = (1 << (length - 408 409 ((offset + length) % 8))) - 1; … … 418 419 report_item->value = 0; 419 420 } 420 421 421 422 return EOK; 422 423 }
Note:
See TracChangeset
for help on using the changeset viewer.