Changeset e50cd7f in mainline for uspace/drv/usbkbd


Ignore:
Timestamp:
2011-04-17T19:17:55Z (15 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63517c2, cfbbe1d3
Parents:
ef354b6 (diff), 8595577b (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:

new report structure fixes

Location:
uspace/drv/usbkbd
Files:
3 edited

Legend:

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

    ref354b6 re50cd7f  
    268268static void usb_kbd_set_led(usb_kbd_t *kbd_dev)
    269269{
     270        if (kbd_dev->output_size == 0) {
     271                return;
     272        }
     273
    270274        unsigned i = 0;
    271275       
     
    544548 *                  according to HID Usage Tables.
    545549 * @param count Number of key codes in report (size of the report).
    546  * @param modifiers Bitmap of modifiers (Ctrl, Alt, Shift, GUI).
     550 * @param report_id
    547551 * @param arg User-specified argument. Expects pointer to the keyboard device
    548552 *            structure representing the keyboard.
     
    551555 */
    552556static void usb_kbd_process_keycodes(const uint8_t *key_codes, size_t count,
    553     uint8_t modifiers, void *arg)
     557    uint8_t report_id, void *arg)
    554558{
    555559        if (arg == NULL) {
     
    562566        assert(kbd_dev != NULL);
    563567
    564         usb_log_debug("Got keys from parser (report id: %d): %s\n", modifiers,
     568        usb_log_debug("Got keys from parser (report id: %d): %s\n", report_id,
    565569            usb_debug_str_buffer(key_codes, count, 0));
    566570       
     
    763767        usb_hid_report_path_t *path = usb_hid_report_path();
    764768        usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
     769       
     770        usb_hid_report_path_set_report_id(path, 0);
     771       
    765772        kbd_dev->key_count = usb_hid_report_input_length(
    766773            kbd_dev->parser, path, USB_HID_PATH_COMPARE_END);
     
    796803       
    797804        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);
    799807       
    800808        usb_log_debug("Output report size (in items): %zu\n",
  • uspace/drv/usbkbd/main.c

    ref354b6 re50cd7f  
    3333/**
    3434 * @file
    35  * Main routines of USB HID driver.
     35 * Main routines of USB KBD driver.
    3636 */
    3737
     
    4242
    4343#include <usb/devdrv.h>
     44#include <usb/devpoll.h>
    4445
    4546#include "kbddev.h"
     
    7576 * @sa usb_kbd_fibril(), usb_kbd_repeat_fibril()
    7677 */
    77 static int usbhid_try_add_device(usb_device_t *dev)
     78static int usb_kbd_try_add_device(usb_device_t *dev)
    7879{
    7980        /* Create the function exposed under /dev/devices. */
     
    105106                usb_kbd_free(&kbd_dev);
    106107                return rc;
    107         }       
     108        }
    108109       
    109110        usb_log_debug("USB/HID KBD device structure initialized.\n");
     
    195196 * @retval EREFUSED if the device is not supported.
    196197 */
    197 static int usbhid_add_device(usb_device_t *dev)
     198static int usb_kbd_add_device(usb_device_t *dev)
    198199{
    199         usb_log_debug("usbhid_add_device()\n");
     200        usb_log_debug("usb_kbd_add_device()\n");
    200201       
    201202        if (dev->interface_no < 0) {
    202203                usb_log_warning("Device is not a supported keyboard.\n");
    203                 usb_log_error("Failed to add HID device: endpoint not found."
    204                     "\n");
     204                usb_log_error("Failed to add USB KBD device: endpoint not "
     205                    "found.\n");
    205206                return ENOTSUP;
    206207        }
    207208       
    208         int rc = usbhid_try_add_device(dev);
     209        int rc = usb_kbd_try_add_device(dev);
    209210       
    210211        if (rc != EOK) {
    211212                usb_log_warning("Device is not a supported keyboard.\n");
    212                 usb_log_error("Failed to add HID device: %s.\n",
     213                usb_log_error("Failed to add KBD device: %s.\n",
    213214                    str_error(rc));
    214215                return rc;
     
    224225/* Currently, the framework supports only device adding. Once the framework
    225226 * supports unplug, more callbacks will be added. */
    226 static usb_driver_ops_t usbhid_driver_ops = {
    227         .add_device = usbhid_add_device,
     227static usb_driver_ops_t usb_kbd_driver_ops = {
     228        .add_device = usb_kbd_add_device,
    228229};
    229230
    230231
    231232/* The driver itself. */
    232 static usb_driver_t usbhid_driver = {
     233static usb_driver_t usb_kbd_driver = {
    233234        .name = NAME,
    234         .ops = &usbhid_driver_ops,
     235        .ops = &usb_kbd_driver_ops,
    235236        .endpoints = usb_kbd_endpoints
    236237};
     
    238239/*----------------------------------------------------------------------------*/
    239240
    240 //static driver_ops_t kbd_driver_ops = {
    241 //      .add_device = usbhid_add_device,
    242 //};
    243 
    244 ///*----------------------------------------------------------------------------*/
    245 
    246 //static driver_t kbd_driver = {
    247 //      .name = NAME,
    248 //      .driver_ops = &kbd_driver_ops
    249 //};
    250 
    251 /*----------------------------------------------------------------------------*/
    252 
    253241int main(int argc, char *argv[])
    254242{
    255         printf(NAME ": HelenOS USB HID driver.\n");
     243        printf(NAME ": HelenOS USB KBD driver.\n");
    256244
    257245        usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);
    258246
    259         return usb_driver_main(&usbhid_driver);
     247        return usb_driver_main(&usb_kbd_driver);
    260248}
    261249
  • uspace/drv/usbkbd/usbkbd.ma

    ref354b6 re50cd7f  
    1 100 usb&interface&class=HID&subclass=0x01&protocol=0x01
    2 10 usb&interface&class=HID
     110 usb&interface&class=HID&subclass=0x01&protocol=0x01
Note: See TracChangeset for help on using the changeset viewer.