Changes in uspace/lib/usbdev/src/hub.c [0edf7c7:160b75e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/hub.c
r0edf7c7 r160b75e 41 41 #include <assert.h> 42 42 #include <usb/debug.h> 43 #include <time.h>44 43 45 44 /** How much time to wait between attempts to register endpoint 0:0. … … 120 119 } 121 120 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 } 122 144 123 145 static void unregister_control_endpoint_on_default_address( … … 196 218 197 219 int rc; 198 struct timeval start_time;199 200 rc = gettimeofday(&start_time, NULL);201 if (rc != EOK) {202 return rc;203 }204 220 205 221 rc = usb_hc_connection_open(&hc_conn); … … 248 264 } 249 265 } 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 for258 * the insertion process to complete. According to 7.1.7.1 this is the259 * time between attach detected and port reset. However, the setup done260 * above might use much of this time so we should only wait to fill261 * 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 of276 * 10ms for reset recovery. Device response to any bus transactions277 * addressed to the default device address during the reset recovery278 * time is undefined.279 */280 async_usleep(10000);281 275 282 276 rc = usb_pipe_probe_default_control(&ctrl_pipe);
Note:
See TracChangeset
for help on using the changeset viewer.