Changeset 0a5a950 in mainline for uspace/drv/root/root.c


Ignore:
Timestamp:
2010-12-09T00:25:14Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
040068c, 11feca8
Parents:
fe2333d
Message:

Virtual USB HC under devman:/virt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/root/root.c

    rfe2333d r0a5a950  
    109109}
    110110
    111 /** Create virtual USB host controller device.
    112  * Note that the virtual HC is actually device and driver in one
    113  * task.
    114  *
    115  * @param parent Parent device.
    116  * @return Error code.
    117  */
    118 static int add_virtual_usb_host_controller(device_t *parent)
    119 {
    120         printf(NAME ": adding virtual host contoller.\n");
    121 
    122         int rc;
    123         device_t *vhc = NULL;
    124         match_id_t *match_id = NULL;
    125 
    126         vhc = create_device();
    127         if (vhc == NULL) {
    128                 rc = ENOMEM;
    129                 goto failure;
    130         }
    131 
    132         vhc->name = "vhc";
    133         printf(NAME ": the new device's name is %s.\n", vhc->name);
    134 
    135         /* Initialize match id list. */
    136         match_id = create_match_id();
    137         if (match_id == NULL) {
    138                 rc = ENOMEM;
    139                 goto failure;
    140         }
    141 
    142         match_id->id = "usb&hc=vhc";
    143         match_id->score = 100;
    144         add_match_id(&vhc->match_ids, match_id);
    145 
    146         /* Register child device. */
    147         rc = child_device_register(vhc, parent);
    148         if (rc != EOK)
    149                 goto failure;
    150 
    151         return EOK;
    152 
    153 failure:
    154         if (match_id != NULL)
    155                 match_id->id = NULL;
    156 
    157         if (vhc != NULL) {
    158                 vhc->name = NULL;
    159                 delete_device(vhc);
    160         }
    161 
    162         return rc;
    163 }
    164 
    165111/** Get the root device.
    166112 *
     
    185131                printf(NAME ": failed to add child device for platform.\n");
    186132       
    187         /* Register virtual USB host controller. */
    188         int rc = add_virtual_usb_host_controller(dev);
    189         if (EOK != rc) {
    190                 printf(NAME ": failed to add child device - virtual USB HC.\n");
    191         }
    192 
    193133        return res;
    194134}
Note: See TracChangeset for help on using the changeset viewer.