Changeset e27595b in mainline for uspace/lib/usbvirt/main.c
- Timestamp:
- 2010-11-20T13:04:15Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0e126be7
- Parents:
- 7034be15
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbvirt/main.c
r7034be15 re27595b 33 33 * @brief Device registration with virtual USB framework. 34 34 */ 35 #include <devmap.h> 36 #include <fcntl.h> 37 #include <vfs/vfs.h> 35 #include <devman.h> 38 36 #include <errno.h> 39 37 #include <stdlib.h> … … 181 179 return; 182 180 } 183 181 184 182 device_callback_connection(dev->device, iid, icall); 185 183 } … … 187 185 /** Create necessary phones for comunication with virtual HCD. 188 186 * This function wraps following calls: 189 * -# open <code>/dev/ usb/<i>hcd_path</i></code>for reading187 * -# open <code>/dev/devices/\\vhc for reading 190 188 * -# access phone of file opened in previous step 191 189 * -# create callback through just opened phone … … 202 200 * @return EOK on success or error code from errno.h. 203 201 */ 204 int usbvirt_connect(usbvirt_device_t *dev , const char *hcd_path)202 int usbvirt_connect(usbvirt_device_t *dev) 205 203 { 206 204 virtual_device_t *virtual_device = find_device(dev); … … 209 207 } 210 208 211 char dev_path[DEVMAP_NAME_MAXLEN + 1]; 212 snprintf(dev_path, DEVMAP_NAME_MAXLEN, 213 "/dev/%s/%s", NAMESPACE, hcd_path); 214 215 int fd = open(dev_path, O_RDONLY); 216 if (fd < 0) { 217 return fd; 218 } 219 220 int hcd_phone = fd_phone(fd); 209 const char *vhc_path = "/vhc"; 210 int rc; 211 devman_handle_t handle; 212 213 rc = devman_device_get_handle(vhc_path, &handle, 0); 214 if (rc != EOK) { 215 printf("devman_device_get_handle() failed\n"); 216 return rc; 217 } 218 219 int hcd_phone = devman_device_connect(handle, 0); 221 220 222 221 if (hcd_phone < 0) { 222 printf("devman_device_connect() failed\n"); 223 223 return hcd_phone; 224 224 } 225 225 226 226 ipcarg_t phonehash; 227 intrc = ipc_connect_to_me(hcd_phone, 0, 0, 0, &phonehash);227 rc = ipc_connect_to_me(hcd_phone, 0, 0, 0, &phonehash); 228 228 if (rc != EOK) { 229 printf("ipc_connect_to_me() failed\n"); 229 230 return rc; 230 231 }
Note:
See TracChangeset
for help on using the changeset viewer.