Changes in uspace/drv/bus/usb/usbhid/kbd/kbddev.c [b803845:2a5b62b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/kbd/kbddev.c
rb803845 r2a5b62b 88 88 89 89 /** Keyboard polling endpoint description for boot protocol class. */ 90 constusb_endpoint_description_t usb_hid_kbd_poll_endpoint_description = {90 usb_endpoint_description_t usb_hid_kbd_poll_endpoint_description = { 91 91 .transfer_type = USB_TRANSFER_INTERRUPT, 92 92 .direction = USB_DIRECTION_IN, … … 237 237 238 238 usb_hid_report_field_t *field = usb_hid_report_get_sibling( 239 &hid_dev->report, NULL, kbd_dev->led_path,239 hid_dev->report, NULL, kbd_dev->led_path, 240 240 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 241 241 USB_HID_REPORT_TYPE_OUTPUT); 242 242 243 243 while (field != NULL) { 244 245 if ((field->usage == USB_HID_LED_NUM_LOCK) 244 245 if ((field->usage == USB_HID_LED_NUM_LOCK) 246 246 && (kbd_dev->mods & KM_NUM_LOCK)){ 247 247 field->value = 1; 248 248 } 249 249 250 if ((field->usage == USB_HID_LED_CAPS_LOCK) 250 if ((field->usage == USB_HID_LED_CAPS_LOCK) 251 251 && (kbd_dev->mods & KM_CAPS_LOCK)){ 252 252 field->value = 1; 253 253 } 254 254 255 if ((field->usage == USB_HID_LED_SCROLL_LOCK) 255 if ((field->usage == USB_HID_LED_SCROLL_LOCK) 256 256 && (kbd_dev->mods & KM_SCROLL_LOCK)){ 257 257 field->value = 1; 258 258 } 259 260 field = usb_hid_report_get_sibling( 261 &hid_dev->report, field, kbd_dev->led_path,262 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,263 259 260 field = usb_hid_report_get_sibling(hid_dev->report, field, 261 kbd_dev->led_path, 262 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 263 USB_HID_REPORT_TYPE_OUTPUT); 264 264 } 265 265 266 266 // TODO: what about the Report ID? 267 int rc = usb_hid_report_output_translate( &hid_dev->report, 0,267 int rc = usb_hid_report_output_translate(hid_dev->report, 0, 268 268 kbd_dev->output_buffer, kbd_dev->output_size); 269 269 … … 432 432 static void usb_kbd_process_data(usb_hid_dev_t *hid_dev, usb_kbd_t *kbd_dev) 433 433 { 434 assert(hid_dev->report != NULL); 434 435 assert(hid_dev != NULL); 435 436 assert(kbd_dev != NULL); … … 443 444 444 445 usb_hid_report_field_t *field = usb_hid_report_get_sibling( 445 &hid_dev->report, NULL, path,446 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 446 hid_dev->report, NULL, path, 447 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 447 448 USB_HID_REPORT_TYPE_INPUT); 448 449 unsigned i = 0; … … 453 454 454 455 assert(i < kbd_dev->key_count); 455 456 456 457 // save the key usage 457 458 if (field->value != 0) { … … 462 463 } 463 464 usb_log_debug2("Saved %u. key usage %d\n", i, kbd_dev->keys[i]); 464 465 465 466 ++i; 466 field = usb_hid_report_get_sibling( 467 &hid_dev->report, field, path, USB_HID_PATH_COMPARE_END468 | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,467 field = usb_hid_report_get_sibling(hid_dev->report, field, path, 468 USB_HID_PATH_COMPARE_END 469 | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 469 470 USB_HID_REPORT_TYPE_INPUT); 470 471 } … … 615 616 616 617 kbd_dev->key_count = usb_hid_report_size( 617 &hid_dev->report, 0, USB_HID_REPORT_TYPE_INPUT);618 hid_dev->report, 0, USB_HID_REPORT_TYPE_INPUT); 618 619 usb_hid_report_path_free(path); 619 620 620 621 usb_log_debug("Size of the input report: %zu\n", kbd_dev->key_count); 621 622 622 kbd_dev->keys = calloc(kbd_dev->key_count, sizeof(int32_t));623 kbd_dev->keys = (int32_t *)calloc(kbd_dev->key_count, sizeof(int32_t)); 623 624 624 625 if (kbd_dev->keys == NULL) { … … 642 643 */ 643 644 kbd_dev->output_size = 0; 644 kbd_dev->output_buffer = usb_hid_report_output( &hid_dev->report,645 kbd_dev->output_buffer = usb_hid_report_output(hid_dev->report, 645 646 &kbd_dev->output_size, 0); 646 647 if (kbd_dev->output_buffer == NULL) { … … 656 657 kbd_dev->led_path, USB_HIDUT_PAGE_LED, 0); 657 658 658 kbd_dev->led_output_size = usb_hid_report_size( 659 &hid_dev->report,0, USB_HID_REPORT_TYPE_OUTPUT);659 kbd_dev->led_output_size = usb_hid_report_size(hid_dev->report, 660 0, USB_HID_REPORT_TYPE_OUTPUT); 660 661 661 662 usb_log_debug("Output report size (in items): %zu\n", … … 825 826 int usb_kbd_set_boot_protocol(usb_hid_dev_t *hid_dev) 826 827 { 827 int rc = usb_hid_parse_report_descriptor( 828 &hid_dev->report, USB_KBD_BOOT_REPORT_DESCRIPTOR,828 int rc = usb_hid_parse_report_descriptor(hid_dev->report, 829 USB_KBD_BOOT_REPORT_DESCRIPTOR, 829 830 USB_KBD_BOOT_REPORT_DESCRIPTOR_SIZE); 830 831 … … 835 836 } 836 837 837 rc = usbhid_req_set_protocol(&hid_dev->usb_dev->ctrl_pipe, 838 rc = usbhid_req_set_protocol(&hid_dev->usb_dev->ctrl_pipe, 838 839 hid_dev->usb_dev->interface_no, USB_HID_PROTOCOL_BOOT); 839 840
Note:
See TracChangeset
for help on using the changeset viewer.