Changes in uspace/drv/bus/usb/usbhid/kbd/kbddev.c [2a5b62b:b803845] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/kbd/kbddev.c
r2a5b62b rb803845 88 88 89 89 /** Keyboard polling endpoint description for boot protocol class. */ 90 usb_endpoint_description_t usb_hid_kbd_poll_endpoint_description = {90 const 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( hid_dev->report, field,261 kbd_dev->led_path,262 263 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 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);435 434 assert(hid_dev != NULL); 436 435 assert(kbd_dev != NULL); … … 444 443 445 444 usb_hid_report_field_t *field = usb_hid_report_get_sibling( 446 hid_dev->report, NULL, path,447 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 445 &hid_dev->report, NULL, path, 446 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 448 447 USB_HID_REPORT_TYPE_INPUT); 449 448 unsigned i = 0; … … 454 453 455 454 assert(i < kbd_dev->key_count); 456 455 457 456 // save the key usage 458 457 if (field->value != 0) { … … 463 462 } 464 463 usb_log_debug2("Saved %u. key usage %d\n", i, kbd_dev->keys[i]); 465 464 466 465 ++i; 467 field = usb_hid_report_get_sibling( hid_dev->report, field, path,468 USB_HID_PATH_COMPARE_END469 | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,466 field = usb_hid_report_get_sibling( 467 &hid_dev->report, field, path, USB_HID_PATH_COMPARE_END 468 | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 470 469 USB_HID_REPORT_TYPE_INPUT); 471 470 } … … 616 615 617 616 kbd_dev->key_count = usb_hid_report_size( 618 hid_dev->report, 0, USB_HID_REPORT_TYPE_INPUT);617 &hid_dev->report, 0, USB_HID_REPORT_TYPE_INPUT); 619 618 usb_hid_report_path_free(path); 620 619 621 620 usb_log_debug("Size of the input report: %zu\n", kbd_dev->key_count); 622 621 623 kbd_dev->keys = (int32_t *)calloc(kbd_dev->key_count, sizeof(int32_t));622 kbd_dev->keys = calloc(kbd_dev->key_count, sizeof(int32_t)); 624 623 625 624 if (kbd_dev->keys == NULL) { … … 643 642 */ 644 643 kbd_dev->output_size = 0; 645 kbd_dev->output_buffer = usb_hid_report_output( hid_dev->report,644 kbd_dev->output_buffer = usb_hid_report_output(&hid_dev->report, 646 645 &kbd_dev->output_size, 0); 647 646 if (kbd_dev->output_buffer == NULL) { … … 657 656 kbd_dev->led_path, USB_HIDUT_PAGE_LED, 0); 658 657 659 kbd_dev->led_output_size = usb_hid_report_size( hid_dev->report,660 0, USB_HID_REPORT_TYPE_OUTPUT);658 kbd_dev->led_output_size = usb_hid_report_size( 659 &hid_dev->report, 0, USB_HID_REPORT_TYPE_OUTPUT); 661 660 662 661 usb_log_debug("Output report size (in items): %zu\n", … … 826 825 int usb_kbd_set_boot_protocol(usb_hid_dev_t *hid_dev) 827 826 { 828 int rc = usb_hid_parse_report_descriptor( hid_dev->report,829 USB_KBD_BOOT_REPORT_DESCRIPTOR,827 int rc = usb_hid_parse_report_descriptor( 828 &hid_dev->report, USB_KBD_BOOT_REPORT_DESCRIPTOR, 830 829 USB_KBD_BOOT_REPORT_DESCRIPTOR_SIZE); 831 830 … … 836 835 } 837 836 838 rc = usbhid_req_set_protocol(&hid_dev->usb_dev->ctrl_pipe, 837 rc = usbhid_req_set_protocol(&hid_dev->usb_dev->ctrl_pipe, 839 838 hid_dev->usb_dev->interface_no, USB_HID_PROTOCOL_BOOT); 840 839
Note:
See TracChangeset
for help on using the changeset viewer.