Changeset ca07cd3 in mainline for uspace/srv/hw/bus/usb/hcd/virtual/conndev.c
- Timestamp:
- 2010-10-25T13:23:33Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 23cb44b
- Parents:
- 355f7c2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hw/bus/usb/hcd/virtual/conndev.c
r355f7c2 rca07cd3 42 42 #include "hub.h" 43 43 44 #define DEVICE_NAME_MAXLENGTH 32 45 46 static int get_device_name(int phone, char *buffer, size_t len) 47 { 48 ipc_call_t answer_data; 49 ipcarg_t answer_rc; 50 aid_t req; 51 int rc; 52 53 req = async_send_0(phone, 54 IPC_M_USBVIRT_GET_NAME, 55 &answer_data); 56 57 rc = async_data_read_start(phone, buffer, len); 58 if (rc != EOK) { 59 async_wait_for(req, NULL); 60 return EINVAL; 61 } 62 63 async_wait_for(req, &answer_rc); 64 rc = (int)answer_rc; 65 66 if (IPC_GET_ARG1(answer_data) < len) { 67 len = IPC_GET_ARG1(answer_data); 68 } else { 69 len--; 70 } 71 buffer[len] = 0; 72 73 return rc; 74 } 75 44 76 /** Connection handler for communcation with virtual device. 45 77 * … … 53 85 assert(dev != NULL); 54 86 55 dprintf(0, "virtual device connected through phone %#x", phone_hash); 87 char devname[DEVICE_NAME_MAXLENGTH + 1]; 88 int rc = get_device_name(dev->phone, devname, DEVICE_NAME_MAXLENGTH); 89 90 dprintf(0, "virtual device connected (phone: %#x, name: %s)", 91 phone_hash, rc == EOK ? devname : "<unknown>"); 92 56 93 57 94 while (true) {
Note:
See TracChangeset
for help on using the changeset viewer.