Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset ba7f671 in mainline


Ignore:
Timestamp:
2010-11-28T21:37:55Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master
Children:
1f43c8f
Parents:
fb1dca09
Message:

Code clean-up

Unified style for adding child devices.

Location:
uspace
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbkbd/usbkbd.ma

    rfb1dca09 rba7f671  
    1110 usb&class=hid
     210 usb&hid
  • uspace/lib/usb/src/hcdhubd.c

    rfb1dca09 rba7f671  
    4040#include <bool.h>
    4141#include <errno.h>
     42#include <str_error.h>
    4243#include <usb/classes/hub.h>
    4344
     
    150151        match_id->id = child_info->match_id;
    151152        match_id->score = 10;
    152         printf("adding child device with match \"%s\"\n", match_id->id);
    153153        add_match_id(&child->match_ids, match_id);
    154154
    155155        rc = child_device_register(child, child_info->parent);
     156        printf("%s: adding child device with match \"%s\" (%s)\n",
     157            hc_driver->name, match_id->id, str_error(rc));
    156158        if (rc != EOK) {
    157159                goto failure;
  • uspace/lib/usb/src/hcdrv.c

    rfb1dca09 rba7f671  
    7878        list_append(&hc_dev->link, &hc_list);
    7979
    80         //add keyboard
    81         /// @TODO this is not correct code
    82 
    8380        /*
    84          * Announce presence of child device.
     81         * FIXME: the following is a workaround to force loading of USB
     82         * keyboard driver.
     83         * Will be removed as soon as the hub driver is completed and
     84         * can detect connected devices.
    8585         */
    86         device_t *kbd = NULL;
    87         match_id_t *match_id = NULL;
    88 
    89         kbd = create_device();
    90         if (kbd == NULL) {
    91                 printf("ERROR: enomem\n");
    92         }
    93         kbd->name = USB_KBD_DEVICE_NAME;
    94 
    95         match_id = create_match_id();
    96         if (match_id == NULL) {
    97                 printf("ERROR: enomem\n");
     86        printf("%s: trying to add USB HID child device...\n", hc_driver->name);
     87        rc = usb_hc_add_child_device(dev, USB_KBD_DEVICE_NAME, "usb&hid");
     88        if (rc != EOK) {
     89                printf("%s: adding USB HID child failed...\n", hc_driver->name);
    9890        }
    9991
    100         char *id;
    101         rc = asprintf(&id, USB_KBD_DEVICE_NAME);
    102         if (rc <= 0) {
    103                 printf("ERROR: enomem\n");
    104                 return rc;
    105         }
    106 
    107         match_id->id = id;
    108         match_id->score = 30;
    109 
    110         add_match_id(&kbd->match_ids, match_id);
    111 
    112         rc = child_device_register(kbd, dev);
    113         if (rc != EOK) {
    114                 printf("ERROR: cannot register kbd\n");
    115                 return rc;
    116         }
    117 
    118         printf("%s: registered root hub\n", dev->name);
    11992        return EOK;
    12093}
Note: See TracChangeset for help on using the changeset viewer.