Changes in uspace/lib/usbdev/src/hub.c [160b75e:0edf7c7] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/hub.c
r160b75e r0edf7c7 41 41 #include <assert.h> 42 42 #include <usb/debug.h> 43 #include <time.h> 43 44 44 45 /** How much time to wait between attempts to register endpoint 0:0. … … 119 120 } 120 121 121 /** Get handle of USB device with given address.122 *123 * @param[in] connection Opened connection to host controller.124 * @param[in] address Address of device in question.125 * @param[out] handle Where to write the device handle.126 * @return Error code.127 */128 int usb_hc_get_handle_by_address(usb_hc_connection_t *connection,129 usb_address_t address, devman_handle_t *handle)130 {131 CHECK_CONNECTION(connection);132 133 sysarg_t tmp;134 int rc = async_req_2_1(connection->hc_phone,135 DEV_IFACE_ID(USBHC_DEV_IFACE),136 IPC_M_USBHC_GET_HANDLE_BY_ADDRESS,137 address, &tmp);138 if ((rc == EOK) && (handle != NULL)) {139 *handle = tmp;140 }141 142 return rc;143 }144 122 145 123 static void unregister_control_endpoint_on_default_address( … … 218 196 219 197 int rc; 198 struct timeval start_time; 199 200 rc = gettimeofday(&start_time, NULL); 201 if (rc != EOK) { 202 return rc; 203 } 220 204 221 205 rc = usb_hc_connection_open(&hc_conn); … … 264 248 } 265 249 } while (rc != EOK); 250 struct timeval end_time; 251 252 rc = gettimeofday(&end_time, NULL); 253 if (rc != EOK) { 254 goto leave_release_default_address; 255 } 256 257 /* According to the USB spec part 9.1.2 host allows 100ms time for 258 * the insertion process to complete. According to 7.1.7.1 this is the 259 * time between attach detected and port reset. However, the setup done 260 * above might use much of this time so we should only wait to fill 261 * up the 100ms quota*/ 262 suseconds_t elapsed = tv_sub(&end_time, &start_time); 263 if (elapsed < 100000) { 264 async_usleep(100000 - elapsed); 265 } 266 266 267 267 /* … … 273 273 goto leave_release_default_address; 274 274 } 275 /* USB spec 7.1.7.1: The USB System Software guarantees a minimum of 276 * 10ms for reset recovery. Device response to any bus transactions 277 * addressed to the default device address during the reset recovery 278 * time is undefined. 279 */ 280 async_usleep(10000); 275 281 276 282 rc = usb_pipe_probe_default_control(&ctrl_pipe);
Note:
See TracChangeset
for help on using the changeset viewer.