Changeset 00b6c73 in mainline
- Timestamp:
- 2011-05-13T20:02:13Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e913cc9
- Parents:
- d29f32f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/vhc/conndev.c
rd29f32f r00b6c73 37 37 #include <errno.h> 38 38 #include <ddf/driver.h> 39 #include <usbvirt/ipc.h> 39 40 #include "conn.h" 40 41 41 42 static fibril_local uintptr_t plugged_device_handle = 0; 43 #define PLUGGED_DEVICE_NAME_MAXLEN 256 44 static fibril_local char plugged_device_name[PLUGGED_DEVICE_NAME_MAXLEN + 1] = "<unknown>"; 45 46 /** Receive device name. 47 * 48 * @warning Errors are silently ignored. 49 * 50 * @param phone Phone to the virtual device. 51 */ 52 static void receive_device_name(int phone) 53 { 54 aid_t opening_request = async_send_0(phone, IPC_M_USBVIRT_GET_NAME, NULL); 55 if (opening_request == 0) { 56 return; 57 } 58 59 60 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 if (data_request == 0) { 66 async_wait_for(opening_request, NULL); 67 return; 68 } 69 70 sysarg_t data_request_rc; 71 sysarg_t opening_request_rc; 72 async_wait_for(data_request, &data_request_rc); 73 async_wait_for(opening_request, &opening_request_rc); 74 75 if ((data_request_rc != EOK) || (opening_request_rc != EOK)) { 76 return; 77 } 78 79 size_t len = IPC_GET_ARG2(data_request_call); 80 plugged_device_name[len] = 0; 81 } 42 82 43 83 /** Default handler for IPC methods not handled by DDF. … … 65 105 async_answer_0(icallid, EOK); 66 106 67 usb_log_info("New virtual device `%s' (id = %" PRIxn ").\n", 68 rc == EOK ? "XXX" : "<unknown>", plugged_device_handle); 107 receive_device_name(callback); 108 109 usb_log_info("New virtual device `%s' (id: %" PRIxn ").\n", 110 plugged_device_name, plugged_device_handle); 69 111 70 112 return; … … 85 127 86 128 if (plugged_device_handle != 0) { 87 usb_log_info("Virtual device disconnected (id =%" PRIxn ").\n",88 plugged_device_ handle);129 usb_log_info("Virtual device `%s' disconnected (id: %" PRIxn ").\n", 130 plugged_device_name, plugged_device_handle); 89 131 vhc_virtdev_unplug(vhc, plugged_device_handle); 90 132 }
Note:
See TracChangeset
for help on using the changeset viewer.