Changeset 79ae36dd in mainline for uspace/lib/usbvirt/src/device.c
- Timestamp:
- 2011-06-08T19:01:55Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0eff68e
- Parents:
- 764d71e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbvirt/src/device.c
r764d71e r79ae36dd 65 65 bool processed = usbvirt_ipc_handle_call(DEV, callid, &call); 66 66 if (!processed) { 67 switch (IPC_GET_IMETHOD(call)) { 68 case IPC_M_PHONE_HUNGUP: 69 async_answer_0(callid, EOK); 70 return; 71 default: 72 async_answer_0(callid, EINVAL); 73 break; 74 } 67 if (!IPC_GET_IMETHOD(call)) { 68 async_answer_0(callid, EOK); 69 return; 70 } else 71 async_answer_0(callid, EINVAL); 75 72 } 76 73 } … … 85 82 int usbvirt_device_plug(usbvirt_device_t *dev, const char *vhc_path) 86 83 { 87 int rc; 84 if (DEV != NULL) 85 return ELIMIT; 86 88 87 devman_handle_t handle; 89 90 if (DEV != NULL) { 91 return ELIMIT; 92 } 93 94 rc = devman_device_get_handle(vhc_path, &handle, 0); 95 if (rc != EOK) { 88 int rc = devman_device_get_handle(vhc_path, &handle, 0); 89 if (rc != EOK) 96 90 return rc; 97 } 98 99 int hcd_phone = devman_device_connect(handle, 0); 100 101 if (hcd_phone < 0) { 102 return hcd_phone; 103 } 104 91 92 async_sess_t *hcd_sess = 93 devman_device_connect(EXCHANGE_SERIALIZE, handle, 0); 94 if (!hcd_sess) 95 return ENOMEM; 96 105 97 DEV = dev; 106 dev->vhc_phone = hcd_phone; 107 108 rc = async_connect_to_me(hcd_phone, 0, 0, 0, callback_connection); 109 if (rc != EOK) { 98 dev->vhc_sess = hcd_sess; 99 100 async_exch_t *exch = async_exchange_begin(hcd_sess); 101 rc = async_connect_to_me(exch, 0, 0, 0, callback_connection); 102 async_exchange_end(exch); 103 104 if (rc != EOK) 110 105 DEV = NULL; 111 } 112 106 113 107 return rc; 114 108 } … … 120 114 void usbvirt_device_unplug(usbvirt_device_t *dev) 121 115 { 122 async_hangup(dev->vhc_ phone);116 async_hangup(dev->vhc_sess); 123 117 } 124 118
Note:
See TracChangeset
for help on using the changeset viewer.