Changeset 1c6f4ff in mainline for uspace/drv/usbkbd/kbddev.c


Ignore:
Timestamp:
2011-04-08T07:58:15Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8b74997f
Parents:
a8a7063 (diff), fec47d4 (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:

General HID driver for handling all HID devices.

Now handles only keyboard. For generic HID device and mouse there are some
dummy functions.

File:
1 edited

Legend:

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

    ra8a7063 r1c6f4ff  
    265265static void usb_kbd_set_led(usb_kbd_t *kbd_dev)
    266266{
     267        if (kbd_dev->output_size == 0) {
     268                return;
     269        }
     270       
    267271        unsigned i = 0;
    268272       
     
    288292       
    289293        int rc = usb_hid_report_output_translate(kbd_dev->parser,
    290             kbd_dev->led_path, USB_HID_PATH_COMPARE_END, kbd_dev->output_buffer,
     294            kbd_dev->led_path,
     295            USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
     296            kbd_dev->output_buffer,
    291297            kbd_dev->output_size, kbd_dev->led_data, kbd_dev->led_output_size);
    292298       
     
    539545 *                  according to HID Usage Tables.
    540546 * @param count Number of key codes in report (size of the report).
    541  * @param modifiers Bitmap of modifiers (Ctrl, Alt, Shift, GUI).
     547 * @param report_id
    542548 * @param arg User-specified argument. Expects pointer to the keyboard device
    543549 *            structure representing the keyboard.
     
    546552 */
    547553static void usb_kbd_process_keycodes(const uint8_t *key_codes, size_t count,
    548     uint8_t modifiers, void *arg)
     554    uint8_t report_id, void *arg)
    549555{
    550556        if (arg == NULL) {
     
    557563        assert(kbd_dev != NULL);
    558564
    559         usb_log_debug("Got keys from parser: %s\n",
    560             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));
    561567       
    562568        if (count != kbd_dev->key_count) {
     
    608614        usb_hid_report_path_t *path = usb_hid_report_path();
    609615        usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
     616        usb_hid_report_path_set_report_id(path, 0);
    610617       
    611618        int rc = usb_hid_parse_report(kbd_dev->parser, buffer,
    612             actual_size, path, USB_HID_PATH_COMPARE_STRICT, callbacks, kbd_dev);
     619            actual_size, path,
     620            USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
     621            callbacks, kbd_dev);
    613622
    614623        usb_hid_report_path_free (path);
     
    758767        usb_hid_report_path_t *path = usb_hid_report_path();
    759768        usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
     769       
     770        usb_hid_report_path_set_report_id(path, 0);
     771       
    760772        kbd_dev->key_count = usb_hid_report_input_length(
    761             kbd_dev->parser, path, USB_HID_PATH_COMPARE_STRICT);
     773            kbd_dev->parser, path,
     774            USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY);
    762775        usb_hid_report_path_free (path);
    763776       
     
    777790        kbd_dev->output_buffer = usb_hid_report_output(kbd_dev->parser,
    778791            &kbd_dev->output_size);
    779         if (kbd_dev->output_buffer == NULL) {
     792        if (kbd_dev->output_buffer == NULL && kbd_dev->output_size != 0) {
    780793                usb_log_warning("Error creating output report buffer.\n");
    781794                free(kbd_dev->keys);
     
    790803       
    791804        kbd_dev->led_output_size = usb_hid_report_output_size(kbd_dev->parser,
    792             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);
    793807       
    794808        usb_log_debug("Output report size (in items): %zu\n",
Note: See TracChangeset for help on using the changeset viewer.