Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbkbd/kbddev.c

    rcfbbe1d3 r7f2e33a  
    128128        0x15, 0x00,  //   Logical Minimum (0),
    129129        0x25, 0x01,  //   Logical Maximum (1),
    130         //0x85, 0x00,  //   Report ID,
    131         //0xA4,      //   Push
    132130        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),
    136133        0x81, 0x01,  //   Input (Constant),                   ; Reserved byte
    137134        0x95, 0x05,  //   Report Count (5),
     
    271268                return;
    272269        }
    273 
     270       
    274271        unsigned i = 0;
    275272       
     
    293290       
    294291        usb_log_debug("Creating output report.\n");
    295 
    296         usb_hid_report_output_set_data(kbd_dev->parser, kbd_dev->led_path,
    297                                        USB_HID_PATH_COMPARE_END , kbd_dev->led_data,
    298                                        kbd_dev->led_output_size);
    299         int rc = usb_hid_report_output_translate(kbd_dev->parser, 0,
    300             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);
    301298       
    302299        if (rc != EOK) {
     
    566563        assert(kbd_dev != NULL);
    567564
    568         usb_log_debug("Got keys from parser (report id: %d): %s\n", report_id,
    569             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));
    570567       
    571568        if (count != kbd_dev->key_count) {
     
    617614        usb_hid_report_path_t *path = usb_hid_report_path();
    618615        usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
    619 
    620         uint8_t report_id;
    621         int rc = usb_hid_parse_report(kbd_dev->parser, buffer, actual_size, &report_id);
    622         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);
    623622
    624623        usb_hid_report_path_free (path);
     
    664663        memset(kbd_dev, 0, sizeof(usb_kbd_t));
    665664       
    666         kbd_dev->parser = (usb_hid_report_t *)(malloc(sizeof(
    667             usb_hid_report_t)));
     665        kbd_dev->parser = (usb_hid_report_parser_t *)(malloc(sizeof(
     666            usb_hid_report_parser_t)));
    668667        if (kbd_dev->parser == NULL) {
    669668                usb_log_fatal("No memory!\n");
     
    733732       
    734733        /* Initialize the report parser. */
    735         //rc = usb_hid_parser_init(kbd_dev->parser);
    736         //if (rc != EOK) {
    737         //      usb_log_error("Failed to initialize report parser.\n");
    738         //      return rc;
    739         //}
     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        }
    740739       
    741740        /* Get the report descriptor and parse it. */
     
    772771       
    773772        kbd_dev->key_count = usb_hid_report_input_length(
    774             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);
    775775        usb_hid_report_path_free (path);
    776776       
     
    789789        kbd_dev->output_size = 0;
    790790        kbd_dev->output_buffer = usb_hid_report_output(kbd_dev->parser,
    791             &kbd_dev->output_size, 0x00);
    792         if (kbd_dev->output_buffer == NULL) {
     791            &kbd_dev->output_size);
     792        if (kbd_dev->output_buffer == NULL && kbd_dev->output_size != 0) {
    793793                usb_log_warning("Error creating output report buffer.\n");
    794794                free(kbd_dev->keys);
     
    801801        usb_hid_report_path_append_item(
    802802            kbd_dev->led_path, USB_HIDUT_PAGE_LED, 0);
    803         usb_hid_report_path_set_report_id(kbd_dev->led_path, 0x00);
    804803       
    805804        kbd_dev->led_output_size = usb_hid_report_output_size(kbd_dev->parser,
     
    850849         * Set Idle rate
    851850         */
    852         usb_kbd_set_led(kbd_dev);       
     851        usb_kbd_set_led(kbd_dev);
    853852       
    854853        usbhid_req_set_idle(&kbd_dev->usb_dev->ctrl_pipe,
     
    935934        // destroy the parser
    936935        if ((*kbd_dev)->parser != NULL) {
    937                 usb_hid_free_report((*kbd_dev)->parser);
     936                usb_hid_free_report_parser((*kbd_dev)->parser);
    938937        }
    939938       
Note: See TracChangeset for help on using the changeset viewer.