Changeset 0a5a950 in mainline


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

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • .bzrignore

    rfe2333d r0a5a950  
    6868./uspace/dist/cfg/net/lo
    6969./uspace/dist/cfg/net/ne2k
    70 ./uspace/dist/drv/isa/
    71 ./uspace/dist/drv/ns8250/
    72 ./uspace/dist/drv/pciintel/
    73 ./uspace/dist/drv/root/
    74 ./uspace/dist/drv/rootia32/
    75 ./uspace/dist/drv/uhci/
    76 ./uspace/dist/drv/usbhub/
    77 ./uspace/dist/drv/usbkbd/
    78 ./uspace/dist/drv/vhc/
    79 ./uspace/dist/srv/arp
    80 ./uspace/dist/srv/ata_bd
    81 ./uspace/dist/srv/char_ms
    82 ./uspace/dist/srv/clip
    83 ./uspace/dist/srv/console
    84 ./uspace/dist/srv/devfs
    85 ./uspace/dist/srv/devman
    86 ./uspace/dist/srv/dp8390
    87 ./uspace/dist/srv/eth
    88 ./uspace/dist/srv/fat
    89 ./uspace/dist/srv/fb
    90 ./uspace/dist/srv/file_bd
    91 ./uspace/dist/srv/g_part
    92 ./uspace/dist/srv/i8042
    93 ./uspace/dist/srv/icmp
    94 ./uspace/dist/srv/ip
    95 ./uspace/dist/srv/kbd
    96 ./uspace/dist/srv/lo
    97 ./uspace/dist/srv/mbr_part
    98 ./uspace/dist/srv/net
    99 ./uspace/dist/srv/netstart
    100 ./uspace/dist/srv/nildummy
    101 ./uspace/dist/srv/pci
    102 ./uspace/dist/srv/taskmon
    103 ./uspace/dist/srv/tcp
    104 ./uspace/dist/srv/tmpfs
    105 ./uspace/dist/srv/udp
    106 ./uspace/dist/srv/vhcd
     70./uspace/dist/drv/*
     71./uspace/dist/srv/*
    10772./uspace/drv/root/root
    10873./uspace/drv/isa/isa
    10974./uspace/drv/ns8250/ns8250
    11075./uspace/drv/pciintel/pciintel
    111 ./uspace/drv/rootia32/rootia32
     76./uspace/drv/rootpc/rootpc
     77./uspace/drv/rootvirt/rootvirt
     78./uspace/drv/test1/test1
     79./uspace/drv/test2/test2
    11280./uspace/drv/uhci/uhci
    11381./uspace/drv/usbhub/usbhub
  • 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.