Changeset e1dbcbc in mainline for uspace/drv/usbkbd/kbddev.c


Ignore:
Timestamp:
2011-04-29T13:43:01Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a81a1d09
Parents:
380e0364 (diff), f19f1b7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge development/ changes

File:
1 edited

Legend:

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

    r380e0364 re1dbcbc  
    128128        0x15, 0x00,  //   Logical Minimum (0),
    129129        0x25, 0x01,  //   Logical Maximum (1),
     130        //0x85, 0x00,  //   Report ID,
     131        //0xA4,      //   Push
    130132        0x81, 0x02,  //   Input (Data, Variable, Absolute),   ; Modifier byte
    131         0x95, 0x01,  //   Report Count (1),
    132         0x75, 0x08,  //   Report Size (8),
     133        //0xB4,      //   Pop
     134        0x75, 0x08,  //   Report Size (1),
     135        0x95, 0x01,  //   Report Count (8),       
    133136        0x81, 0x01,  //   Input (Constant),                   ; Reserved byte
    134137        0x95, 0x05,  //   Report Count (5),
     
    268271                return;
    269272        }
    270        
     273
    271274        unsigned i = 0;
    272275       
     
    290293       
    291294        usb_log_debug("Creating output report.\n");
    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);
     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);
    298301       
    299302        if (rc != EOK) {
     
    563566        assert(kbd_dev != NULL);
    564567
    565         usb_log_debug("Got keys from parser (report id: %u): %s\n",
    566             report_id, usb_debug_str_buffer(key_codes, count, 0));
     568        usb_log_debug("Got keys from parser (report id: %d): %s\n", report_id,
     569            usb_debug_str_buffer(key_codes, count, 0));
    567570       
    568571        if (count != kbd_dev->key_count) {
    569                 usb_log_warning("Number of received keycodes (%d) differs from"
    570                     " expected number (%d).\n", count, kbd_dev->key_count);
     572                usb_log_warning("Number of received keycodes (%zu) differs from"
     573                    " expected (%zu).\n", count, kbd_dev->key_count);
    571574                return;
    572575        }
     
    614617        usb_hid_report_path_t *path = usb_hid_report_path();
    615618        usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
    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);
     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);
    622623
    623624        usb_hid_report_path_free (path);
     
    663664        memset(kbd_dev, 0, sizeof(usb_kbd_t));
    664665       
    665         kbd_dev->parser = (usb_hid_report_parser_t *)(malloc(sizeof(
    666             usb_hid_report_parser_t)));
     666        kbd_dev->parser = (usb_hid_report_t *)(malloc(sizeof(
     667            usb_hid_report_t)));
    667668        if (kbd_dev->parser == NULL) {
    668669                usb_log_fatal("No memory!\n");
     
    732733       
    733734        /* Initialize the report parser. */
    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        //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        //}
    739740       
    740741        /* Get the report descriptor and parse it. */
     
    771772       
    772773        kbd_dev->key_count = usb_hid_report_input_length(
    773             kbd_dev->parser, path,
    774             USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY);
     774            kbd_dev->parser, path, USB_HID_PATH_COMPARE_END);
    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);
    792         if (kbd_dev->output_buffer == NULL && kbd_dev->output_size != 0) {
     791            &kbd_dev->output_size, 0x00);
     792        if (kbd_dev->output_buffer == NULL) {
    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);
    803804       
    804805        kbd_dev->led_output_size = usb_hid_report_output_size(kbd_dev->parser,
     
    849850         * Set Idle rate
    850851         */
    851         usb_kbd_set_led(kbd_dev);
     852        usb_kbd_set_led(kbd_dev);       
    852853       
    853854        usbhid_req_set_idle(&kbd_dev->usb_dev->ctrl_pipe,
     
    934935        // destroy the parser
    935936        if ((*kbd_dev)->parser != NULL) {
    936                 usb_hid_free_report_parser((*kbd_dev)->parser);
     937                usb_hid_free_report((*kbd_dev)->parser);
    937938        }
    938939       
Note: See TracChangeset for help on using the changeset viewer.