Changes in uspace/lib/usbdev/src/pipes.c [e8f826b:79ae36dd] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/pipes.c
re8f826b r79ae36dd 48 48 /** Tell USB address assigned to given device. 49 49 * 50 * @param phone Phoneto parent device.50 * @param sess Session to parent device. 51 51 * @param dev Device in question. 52 52 * @return USB address or error code. 53 53 */ 54 static usb_address_t get_my_address( int phone, ddf_dev_t *dev)55 { 56 sysarg_t address;57 54 static usb_address_t get_my_address(async_sess_t *sess, ddf_dev_t *dev) 55 { 56 async_exch_t *exch = async_exchange_begin(sess); 57 58 58 /* 59 59 * We are sending special value as a handle - zero - to get … … 61 61 * when registering our device @p dev. 62 62 */ 63 int rc = async_req_2_1(phone, DEV_IFACE_ID(USB_DEV_IFACE), 64 IPC_M_USB_GET_ADDRESS, 65 0, &address); 66 67 if (rc != EOK) { 63 sysarg_t address; 64 int rc = async_req_2_1(exch, DEV_IFACE_ID(USB_DEV_IFACE), 65 IPC_M_USB_GET_ADDRESS, 0, &address); 66 67 async_exchange_end(exch); 68 69 if (rc != EOK) 68 70 return rc; 69 } 70 71 71 72 return (usb_address_t) address; 72 73 } … … 79 80 int usb_device_get_assigned_interface(ddf_dev_t *device) 80 81 { 81 int parent_phone = devman_parent_device_connect(device->handle, 82 async_sess_t *parent_sess = 83 devman_parent_device_connect(EXCHANGE_SERIALIZE, device->handle, 82 84 IPC_FLAG_BLOCKING); 83 if ( parent_phone < 0) {85 if (!parent_sess) 84 86 return -1; 85 } 86 87 88 async_exch_t *exch = async_exchange_begin(parent_sess); 89 87 90 sysarg_t iface_no; 88 int rc = async_req_2_1( parent_phone, DEV_IFACE_ID(USB_DEV_IFACE),89 IPC_M_USB_GET_INTERFACE, 90 device->handle, &iface_no);91 92 async_hangup(parent_ phone);93 94 if (rc != EOK) {91 int rc = async_req_2_1(exch, DEV_IFACE_ID(USB_DEV_IFACE), 92 IPC_M_USB_GET_INTERFACE, device->handle, &iface_no); 93 94 async_exchange_end(exch); 95 async_hangup(parent_sess); 96 97 if (rc != EOK) 95 98 return -1; 96 } 97 99 98 100 return (int) iface_no; 99 101 } … … 110 112 assert(connection); 111 113 assert(dev); 112 114 113 115 int rc; 114 116 devman_handle_t hc_handle; 115 117 usb_address_t my_address; 116 118 117 119 rc = usb_hc_find(dev->handle, &hc_handle); 118 if (rc != EOK) {120 if (rc != EOK) 119 121 return rc; 120 }121 122 int parent_phone = devman_parent_device_connect(dev->handle,122 123 async_sess_t *parent_sess = 124 devman_parent_device_connect(EXCHANGE_SERIALIZE, dev->handle, 123 125 IPC_FLAG_BLOCKING); 124 if (parent_phone < 0) { 125 return parent_phone; 126 } 127 126 if (!parent_sess) 127 return ENOMEM; 128 128 129 /* 129 130 * Asking for "my" address may require several attempts. … … 137 138 * So, we need to wait for the HC to learn the binding. 138 139 */ 140 139 141 do { 140 my_address = get_my_address(parent_ phone, dev);141 142 my_address = get_my_address(parent_sess, dev); 143 142 144 if (my_address == ENOENT) { 143 145 /* Be nice, let other fibrils run and try again. */ … … 148 150 goto leave; 149 151 } 150 152 151 153 } while (my_address < 0); 152 154 153 155 rc = usb_device_connection_initialize(connection, 154 156 hc_handle, my_address); 155 157 156 158 leave: 157 async_hangup(parent_ phone);159 async_hangup(parent_sess); 158 160 return rc; 159 161 }
Note:
See TracChangeset
for help on using the changeset viewer.