Changeset 07525cd in mainline for uspace/lib/usbhid/src/hidparser.c
- Timestamp:
- 2013-09-10T18:34:16Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 08bc23d
- Parents:
- 85147f3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhid/src/hidparser.c
r85147f3 r07525cd 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 } … … 340 340 int length; 341 341 int32_t tmp_value; 342 342 343 343 if (report == NULL) { 344 344 return EINVAL; … … 352 352 report_des = usb_hid_report_find_description(report, report_id, 353 353 USB_HID_REPORT_TYPE_OUTPUT); 354 354 355 355 if (report_des == NULL) { 356 356 return EINVAL; … … 364 364 offset = report_des->bit_length - report_item->offset - 1; 365 365 length = report_item->size; 366 366 367 367 usb_log_debug("\ttranslated value: %x\n", value); 368 368 … … 375 375 value = value << shift; 376 376 value = value & (((1 << length) - 1) << shift); 377 377 378 378 uint8_t mask = 0; 379 379 mask = 0xff - (((1 << length) - 1) << shift); … … 391 391 392 392 tmp_value = tmp_value << (offset % 8); 393 393 394 394 mask = ~(((1 << (8 - (offset % 8))) - 1) 395 395 << (offset % 8)); … … 398 398 tmp_value; 399 399 } else if (i == ((offset + length - 1) / 8)) { 400 400 401 401 value = value >> (length - 402 402 ((offset + length) % 8)); … … 404 404 value = value & ((1 << (length - 405 405 ((offset + length) % 8))) - 1); 406 406 407 407 mask = (1 << (length - 408 408 ((offset + length) % 8))) - 1; … … 418 418 report_item->value = 0; 419 419 } 420 420 421 421 return EOK; 422 422 }
Note:
See TracChangeset
for help on using the changeset viewer.