Changeset 0a5a950 in mainline for uspace


Ignore:
Timestamp:
2010-12-09T00:25:14Z (15 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

Location:
uspace
Files:
4 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}
  • uspace/drv/rootvirt/devices.def

    rfe2333d r0a5a950  
    1818},
    1919#endif
     20/* Virtual USB host controller. */
     21{
     22        .name = "usbhc",
     23        .match_id = "usb&hc=vhc"
     24},
  • uspace/lib/usb/src/usbdrv.c

    rfe2333d r0a5a950  
    7171        devman_handle_t handle;
    7272
    73         rc = devman_device_get_handle("/vhc", &handle, 0);
     73        rc = devman_device_get_handle("/virt/usbhc", &handle, 0);
    7474        if (rc != EOK) {
    7575                return rc;
  • uspace/lib/usbvirt/main.c

    rfe2333d r0a5a950  
    183183}
    184184
    185 /** Create necessary phones for comunication with virtual HCD.
     185/** Create necessary phones for communication with virtual HCD.
    186186 * This function wraps following calls:
    187  * -# open <code>/dev/devices/\\vhc for reading
     187 * -# open <code>/dev/devices/\\virt\\usbhc for reading
    188188 * -# access phone of file opened in previous step
    189189 * -# create callback through just opened phone
     
    193193 * @warning This function is wrapper for several actions and therefore
    194194 * it is not possible - in case of error - to determine at which point
    195  * error occured.
    196  *
    197  * @param hcd_path HCD identification under devfs
    198  *     (without <code>/dev/usb/</code>).
     195 * error occurred.
     196 *
    199197 * @param dev Device to connect.
    200198 * @return EOK on success or error code from errno.h.
     
    207205        }
    208206       
    209         const char *vhc_path = "/vhc";
     207        const char *vhc_path = "/virt/usbhc";
    210208        int rc;
    211209        devman_handle_t handle;
Note: See TracChangeset for help on using the changeset viewer.