Changes in uspace/drv/vhc/conndev.c [00b6c73:8869f7b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/vhc/conndev.c
r00b6c73 r8869f7b 38 38 #include <ddf/driver.h> 39 39 #include <usbvirt/ipc.h> 40 #include <async.h> 40 41 #include "conn.h" 41 42 … … 48 49 * @warning Errors are silently ignored. 49 50 * 50 * @param phone Phone to the virtual device. 51 * @param sess Session to the virtual device. 52 * 51 53 */ 52 static void receive_device_name( int phone)54 static void receive_device_name(async_sess_t *sess) 53 55 { 54 aid_t opening_request = async_send_0(phone, IPC_M_USBVIRT_GET_NAME, NULL); 56 async_exch_t *exch = async_exchange_begin(sess); 57 58 aid_t opening_request = async_send_0(exch, IPC_M_USBVIRT_GET_NAME, NULL); 55 59 if (opening_request == 0) { 60 async_exchange_end(exch); 56 61 return; 57 62 } 58 59 63 60 64 ipc_call_t data_request_call; 61 aid_t data_request = async_data_read(phone, 62 plugged_device_name, PLUGGED_DEVICE_NAME_MAXLEN, 63 &data_request_call); 64 65 aid_t data_request = async_data_read(exch, plugged_device_name, 66 PLUGGED_DEVICE_NAME_MAXLEN, &data_request_call); 67 68 async_exchange_end(exch); 69 65 70 if (data_request == 0) { 66 71 async_wait_for(opening_request, NULL); 67 72 return; 68 73 } 69 74 70 75 sysarg_t data_request_rc; 71 76 sysarg_t opening_request_rc; 72 77 async_wait_for(data_request, &data_request_rc); 73 78 async_wait_for(opening_request, &opening_request_rc); 74 75 if ((data_request_rc != EOK) || (opening_request_rc != EOK)) {79 80 if ((data_request_rc != EOK) || (opening_request_rc != EOK)) 76 81 return; 77 } 78 82 79 83 size_t len = IPC_GET_ARG2(data_request_call); 80 84 plugged_device_name[len] = 0; … … 87 91 * @param icall Call data. 88 92 */ 89 void default_connection_handler(ddf_fun_t *fun, 90 ipc_call id_t icallid, ipc_call_t *icall)93 void default_connection_handler(ddf_fun_t *fun, ipc_callid_t icallid, 94 ipc_call_t *icall) 91 95 { 92 96 vhc_data_t *vhc = fun->dev->driver_data; 93 sysarg_t method = IPC_GET_IMETHOD(*icall);94 95 if (method == IPC_M_CONNECT_TO_ME) {96 int callback = IPC_GET_ARG5(*icall);97 int rc = vhc_virtdev_plug(vhc, callback,98 97 98 async_sess_t *callback = 99 async_callback_receive_start(EXCHANGE_SERIALIZE, icall); 100 101 if (callback) { 102 int rc = vhc_virtdev_plug(vhc, callback, &plugged_device_handle); 99 103 if (rc != EOK) { 100 104 async_answer_0(icallid, rc); … … 102 106 return; 103 107 } 104 108 105 109 async_answer_0(icallid, EOK); 106 110 107 111 receive_device_name(callback); 108 112 109 113 usb_log_info("New virtual device `%s' (id: %" PRIxn ").\n", 110 114 plugged_device_name, plugged_device_handle); 111 112 return; 113 } 114 115 async_answer_0(icallid, EINVAL); 115 } else 116 async_answer_0(icallid, EINVAL); 116 117 } 117 118
Note:
See TracChangeset
for help on using the changeset viewer.