Changes in uspace/lib/usbhid/src/hidparser.c [1e371cf:feeac0d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhid/src/hidparser.c
r1e371cf rfeeac0d 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, rdes) { 296 if ((rdes->report_id == report_id) && 297 (rdes->type == USB_HID_REPORT_TYPE_OUTPUT)) { 298 report_des = rdes; 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)) { 299 298 break; 300 299 } … … 341 340 int length; 342 341 int32_t tmp_value; 343 342 344 343 if (report == NULL) { 345 344 return EINVAL; … … 353 352 report_des = usb_hid_report_find_description(report, report_id, 354 353 USB_HID_REPORT_TYPE_OUTPUT); 355 354 356 355 if (report_des == NULL) { 357 356 return EINVAL; … … 365 364 offset = report_des->bit_length - report_item->offset - 1; 366 365 length = report_item->size; 367 366 368 367 usb_log_debug("\ttranslated value: %x\n", value); 369 368 … … 376 375 value = value << shift; 377 376 value = value & (((1 << length) - 1) << shift); 378 377 379 378 uint8_t mask = 0; 380 379 mask = 0xff - (((1 << length) - 1) << shift); … … 392 391 393 392 tmp_value = tmp_value << (offset % 8); 394 393 395 394 mask = ~(((1 << (8 - (offset % 8))) - 1) 396 395 << (offset % 8)); … … 399 398 tmp_value; 400 399 } else if (i == ((offset + length - 1) / 8)) { 401 400 402 401 value = value >> (length - 403 402 ((offset + length) % 8)); … … 405 404 value = value & ((1 << (length - 406 405 ((offset + length) % 8))) - 1); 407 406 408 407 mask = (1 << (length - 409 408 ((offset + length) % 8))) - 1; … … 419 418 report_item->value = 0; 420 419 } 421 420 422 421 return EOK; 423 422 }
Note:
See TracChangeset
for help on using the changeset viewer.