Changeset 8869f7b in mainline
- Timestamp:
- 2011-06-08T19:44:33Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4a4c8bcf
- Parents:
- 0eff68e
- Location:
- uspace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/vhc/conndev.c
r0eff68e r8869f7b 45 45 static fibril_local char plugged_device_name[PLUGGED_DEVICE_NAME_MAXLEN + 1] = "<unknown>"; 46 46 47 #if 048 47 /** Receive device name. 49 48 * … … 85 84 plugged_device_name[len] = 0; 86 85 } 87 #endif88 86 89 87 /** Default handler for IPC methods not handled by DDF. … … 93 91 * @param icall Call data. 94 92 */ 95 void default_connection_handler(ddf_fun_t *fun, 96 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) 97 95 { 98 // FIXME:99 // This code needs to be refactored since the async100 // framework does not support automatic callback connections101 // yet.102 103 #if 0104 96 vhc_data_t *vhc = fun->dev->driver_data; 105 sysarg_t method = IPC_GET_IMETHOD(*icall);106 107 if (method == IPC_M_CONNECT_TO_ME) {108 int callback = IPC_GET_ARG5(*icall);109 int rc = vhc_virtdev_plug(vhc, callback,110 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); 111 103 if (rc != EOK) { 112 104 async_answer_0(icallid, rc); … … 114 106 return; 115 107 } 116 108 117 109 async_answer_0(icallid, EOK); 118 110 119 111 receive_device_name(callback); 120 112 121 113 usb_log_info("New virtual device `%s' (id: %" PRIxn ").\n", 122 114 plugged_device_name, plugged_device_handle); 123 124 return; 125 } 126 #endif 127 128 async_answer_0(icallid, EINVAL); 115 } else 116 async_answer_0(icallid, EINVAL); 129 117 } 130 118 -
uspace/lib/c/generic/async.c
r0eff68e r8869f7b 2339 2339 * @param mgmt Exchange management style. 2340 2340 * 2341 * @return New async session or NULL on failure. 2341 * @return New async session. 2342 * @return NULL on failure. 2342 2343 * 2343 2344 */ … … 2377 2378 } 2378 2379 2380 /** Wrapper for receiving the IPC_M_CONNECT_TO_ME calls. 2381 * 2382 * If the call is IPC_M_CONNECT_TO_ME then a new 2383 * async session is created. However, the phone is 2384 * not accepted automatically. 2385 * 2386 * @param mgmt Exchange management style. 2387 * @param call Call data. 2388 * 2389 * @return New async session. 2390 * @return NULL on failure. 2391 * @return NULL if the call is not IPC_M_CONNECT_TO_ME. 2392 * 2393 */ 2394 async_sess_t *async_callback_receive_start(exch_mgmt_t mgmt, ipc_call_t *call) 2395 { 2396 int phone = (int) IPC_GET_ARG5(*call); 2397 2398 if ((IPC_GET_IMETHOD(*call) != IPC_M_CONNECT_TO_ME) || 2399 (phone < 0)) 2400 return NULL; 2401 2402 async_sess_t *sess = (async_sess_t *) malloc(sizeof(async_sess_t)); 2403 if (sess == NULL) 2404 return NULL; 2405 2406 sess->mgmt = mgmt; 2407 sess->phone = phone; 2408 sess->arg1 = 0; 2409 sess->arg2 = 0; 2410 sess->arg3 = 0; 2411 2412 list_initialize(&sess->exch_list); 2413 fibril_mutex_initialize(&sess->mutex); 2414 atomic_set(&sess->refcnt, 0); 2415 2416 return sess; 2417 } 2418 2379 2419 /** @} 2380 2420 */ -
uspace/lib/c/include/async.h
r0eff68e r8869f7b 464 464 extern async_sess_t *async_clone_receive(exch_mgmt_t); 465 465 extern async_sess_t *async_callback_receive(exch_mgmt_t); 466 extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *); 466 467 467 468 #endif
Note:
See TracChangeset
for help on using the changeset viewer.