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