Changeset 4317827 in mainline for uspace/lib


Ignore:
Timestamp:
2010-12-04T14:00:41Z (15 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
36c410e
Parents:
62c9661
Message:

USB hub driver in separate task

The commit only includes changes necessary to get working (i.e. appearing
under /dev/devices) hub and VHC.

Clean-up will come later.

Location:
uspace/lib/usb
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/Makefile

    r62c9661 r4317827  
    3535        src/hcdhubd.c \
    3636        src/hcdrv.c \
    37         src/hubdrv.c \
    3837        src/localdrv.c \
    3938        src/remotedrv.c \
  • uspace/lib/usb/include/usb/hcdhubd.h

    r62c9661 r4317827  
    146146
    147147int usb_hcd_main(usb_hc_driver_t *);
    148 int usb_hcd_add_root_hub(usb_hc_device_t *dev);
     148int usb_hcd_add_root_hub(device_t *dev);
    149149
    150150
  • uspace/lib/usb/src/hcdhubd.c

    r62c9661 r4317827  
    5151 */
    5252static int add_device(device_t *dev) {
    53         bool is_hc = str_cmp(dev->name, USB_HUB_DEVICE_NAME) != 0;
    54         printf("%s: add_device(name=\"%s\")\n", hc_driver->name, dev->name);
    55 
    56         if (is_hc) {
    57                 /*
    58                  * We are the HC itself.
    59                  */
    60                 return usb_add_hc_device(dev);
    61         } else {
    62                 /*
    63                  * We are some (maybe deeply nested) hub.
    64                  * Thus, assign our own operations and explore already
    65                  * connected devices.
    66                  */
    67                 return usb_add_hub_device(dev);
    68         }
     53        return ENOTSUP;
    6954}
    7055
     
    10590 * @return Error code.
    10691 */
    107 int usb_hcd_add_root_hub(usb_hc_device_t *dev)
     92int usb_hcd_add_root_hub(device_t *dev)
    10893{
    10994        char *id;
    110         int rc = asprintf(&id, "usb&hc=%s&hub", hc_driver->name);
     95        int rc = asprintf(&id, "usb&hub");
    11196        if (rc <= 0) {
    11297                return rc;
    11398        }
    11499
    115         rc = usb_hc_add_child_device(dev->generic, USB_HUB_DEVICE_NAME, id, true);
     100        rc = usb_hc_add_child_device(dev, USB_HUB_DEVICE_NAME, id, true);
    116101        if (rc != EOK) {
    117102                free(id);
  • uspace/lib/usb/src/hcdhubd_private.h

    r62c9661 r4317827  
    4646usb_address_t usb_get_address_by_handle(devman_handle_t);
    4747int usb_add_hc_device(device_t *);
    48 int usb_add_hub_device(device_t *);
    4948
    5049#endif
  • uspace/lib/usb/src/hcdrv.c

    r62c9661 r4317827  
    4747LIST_INITIALIZE(hc_list);
    4848
     49/* Fake driver to have the name item initialized. */
     50static usb_hc_driver_t hc_driver_fake = {
     51        .name = "HCD",
     52};
     53
    4954/** Our HC driver. */
    50 usb_hc_driver_t *hc_driver = NULL;
     55usb_hc_driver_t *hc_driver = &hc_driver_fake;
    5156
    5257static device_ops_t usb_device_ops = {
     
    7176int usb_add_hc_device(device_t *dev)
    7277{
     78        return ENOTSUP;
    7379        usb_hc_device_t *hc_dev = usb_hc_device_create(dev);
    7480
Note: See TracChangeset for help on using the changeset viewer.