Changes in uspace/drv/usbkbd/kbddev.c [ef354b6:4125b7d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbkbd/kbddev.c
ref354b6 r4125b7d 128 128 0x15, 0x00, // Logical Minimum (0), 129 129 0x25, 0x01, // Logical Maximum (1), 130 //0x85, 0x00, // Report ID,131 //0xA4, // Push132 130 0x81, 0x02, // Input (Data, Variable, Absolute), ; Modifier byte 133 //0xB4, // Pop 134 0x75, 0x08, // Report Size (1), 135 0x95, 0x01, // Report Count (8), 131 0x95, 0x01, // Report Count (1), 132 0x75, 0x08, // Report Size (8), 136 133 0x81, 0x01, // Input (Constant), ; Reserved byte 137 134 0x95, 0x05, // Report Count (5), … … 268 265 static void usb_kbd_set_led(usb_kbd_t *kbd_dev) 269 266 { 267 if (kbd_dev->output_size == 0) { 268 return; 269 } 270 270 271 unsigned i = 0; 271 272 … … 289 290 290 291 usb_log_debug("Creating output report.\n"); 291 292 usb_hid_report_output_set_data(kbd_dev->parser, kbd_dev->led_path,293 USB_HID_PATH_COMPARE_END , kbd_dev->led_data,294 kbd_dev->led_output_size);295 int rc = usb_hid_report_output_translate(kbd_dev->parser, 0,296 kbd_dev->output_ buffer, kbd_dev->output_size);292 293 int rc = usb_hid_report_output_translate(kbd_dev->parser, 294 kbd_dev->led_path, 295 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 296 kbd_dev->output_buffer, 297 kbd_dev->output_size, kbd_dev->led_data, kbd_dev->led_output_size); 297 298 298 299 if (rc != EOK) { … … 544 545 * according to HID Usage Tables. 545 546 * @param count Number of key codes in report (size of the report). 546 * @param modifiers Bitmap of modifiers (Ctrl, Alt, Shift, GUI).547 * @param report_id 547 548 * @param arg User-specified argument. Expects pointer to the keyboard device 548 549 * structure representing the keyboard. … … 551 552 */ 552 553 static void usb_kbd_process_keycodes(const uint8_t *key_codes, size_t count, 553 uint8_t modifiers, void *arg)554 uint8_t report_id, void *arg) 554 555 { 555 556 if (arg == NULL) { … … 562 563 assert(kbd_dev != NULL); 563 564 564 usb_log_debug("Got keys from parser (report id: % d): %s\n", modifiers,565 usb_debug_str_buffer(key_codes, count, 0));565 usb_log_debug("Got keys from parser (report id: %u): %s\n", 566 report_id, usb_debug_str_buffer(key_codes, count, 0)); 566 567 567 568 if (count != kbd_dev->key_count) { 568 usb_log_warning("Number of received keycodes (% d) differs from"569 " expected number (%d).\n", count, kbd_dev->key_count);569 usb_log_warning("Number of received keycodes (%zu) differs from" 570 " expected (%zu).\n", count, kbd_dev->key_count); 570 571 return; 571 572 } … … 613 614 usb_hid_report_path_t *path = usb_hid_report_path(); 614 615 usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0); 615 616 int rc = usb_hid_parse_report(kbd_dev->parser, buffer, actual_size); 617 usb_hid_descriptor_print (kbd_dev->parser); 616 usb_hid_report_path_set_report_id(path, 0); 617 618 int rc = usb_hid_parse_report(kbd_dev->parser, buffer, 619 actual_size, path, 620 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 621 callbacks, kbd_dev); 618 622 619 623 usb_hid_report_path_free (path); … … 659 663 memset(kbd_dev, 0, sizeof(usb_kbd_t)); 660 664 661 kbd_dev->parser = (usb_hid_report_ t *)(malloc(sizeof(662 usb_hid_report_ t)));665 kbd_dev->parser = (usb_hid_report_parser_t *)(malloc(sizeof( 666 usb_hid_report_parser_t))); 663 667 if (kbd_dev->parser == NULL) { 664 668 usb_log_fatal("No memory!\n"); … … 728 732 729 733 /* Initialize the report parser. */ 730 //rc = usb_hid_parser_init(kbd_dev->parser);731 //if (rc != EOK) {732 //usb_log_error("Failed to initialize report parser.\n");733 //return rc;734 //}734 rc = usb_hid_parser_init(kbd_dev->parser); 735 if (rc != EOK) { 736 usb_log_error("Failed to initialize report parser.\n"); 737 return rc; 738 } 735 739 736 740 /* Get the report descriptor and parse it. */ … … 763 767 usb_hid_report_path_t *path = usb_hid_report_path(); 764 768 usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0); 769 770 usb_hid_report_path_set_report_id(path, 0); 771 765 772 kbd_dev->key_count = usb_hid_report_input_length( 766 kbd_dev->parser, path, USB_HID_PATH_COMPARE_END); 773 kbd_dev->parser, path, 774 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY); 767 775 usb_hid_report_path_free (path); 768 776 … … 781 789 kbd_dev->output_size = 0; 782 790 kbd_dev->output_buffer = usb_hid_report_output(kbd_dev->parser, 783 &kbd_dev->output_size , 0x00);784 if (kbd_dev->output_buffer == NULL ) {791 &kbd_dev->output_size); 792 if (kbd_dev->output_buffer == NULL && kbd_dev->output_size != 0) { 785 793 usb_log_warning("Error creating output report buffer.\n"); 786 794 free(kbd_dev->keys); … … 793 801 usb_hid_report_path_append_item( 794 802 kbd_dev->led_path, USB_HIDUT_PAGE_LED, 0); 795 usb_hid_report_path_set_report_id(kbd_dev->led_path, 0x00);796 803 797 804 kbd_dev->led_output_size = usb_hid_report_output_size(kbd_dev->parser, 798 kbd_dev->led_path, USB_HID_PATH_COMPARE_END); 805 kbd_dev->led_path, 806 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY); 799 807 800 808 usb_log_debug("Output report size (in items): %zu\n", … … 841 849 * Set Idle rate 842 850 */ 843 usb_kbd_set_led(kbd_dev); 851 usb_kbd_set_led(kbd_dev); 844 852 845 853 usbhid_req_set_idle(&kbd_dev->usb_dev->ctrl_pipe, … … 926 934 // destroy the parser 927 935 if ((*kbd_dev)->parser != NULL) { 928 usb_hid_free_report ((*kbd_dev)->parser);936 usb_hid_free_report_parser((*kbd_dev)->parser); 929 937 } 930 938
Note:
See TracChangeset
for help on using the changeset viewer.