Changeset 39db23f in mainline
- Timestamp:
- 2011-04-09T11:00:22Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 112d159, 8e8b84f
- Parents:
- 0c311d5 (diff), 61727bf (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/hub.c
r0c311d5 r39db23f 178 178 * error codes than those listed as return codes by this function itself). 179 179 * 180 * The @p connection representing connection with host controller does not 181 * need to be started. 182 * This function duplicates the connection to allow simultaneous calls of 183 * this function (i.e. from different fibrils). 184 * 180 185 * @param[in] parent Parent device (i.e. the hub device). 181 * @param[in] connection Opened connection to host controller.186 * @param[in] connection Connection to host controller. 182 187 * @param[in] dev_speed New device speed. 183 188 * @param[in] enable_port Function for enabling signaling through the port the … … 206 211 ddf_dev_ops_t *dev_ops, void *new_dev_data, ddf_fun_t **new_fun) 207 212 { 208 CHECK_CONNECTION(connection); 213 assert(connection != NULL); 214 // FIXME: this is awful, we are accessing directly the structure. 215 usb_hc_connection_t hc_conn = { 216 .hc_handle = connection->hc_handle, 217 .hc_phone = -1 218 }; 219 220 int rc; 221 222 rc = usb_hc_connection_open(&hc_conn); 223 if (rc != EOK) { 224 return rc; 225 } 226 209 227 210 228 /* 211 229 * Request new address. 212 230 */ 213 usb_address_t dev_addr = usb_hc_request_address( connection, dev_speed);231 usb_address_t dev_addr = usb_hc_request_address(&hc_conn, dev_speed); 214 232 if (dev_addr < 0) { 233 usb_hc_connection_close(&hc_conn); 215 234 return EADDRNOTAVAIL; 216 235 } 217 236 218 int rc;219 237 220 238 /* 221 239 * Reserve the default address. 222 240 */ 223 rc = usb_hc_reserve_default_address( connection, dev_speed);241 rc = usb_hc_reserve_default_address(&hc_conn, dev_speed); 224 242 if (rc != EOK) { 225 243 rc = EBUSY; … … 241 259 usb_device_connection_t dev_conn; 242 260 rc = usb_device_connection_initialize_on_default_address(&dev_conn, 243 connection);261 &hc_conn); 244 262 if (rc != EOK) { 245 263 rc = ENOTCONN; … … 258 276 * endpoint. 259 277 */ 260 rc = usb_pipe_register(&ctrl_pipe, 0, connection);278 rc = usb_pipe_register(&ctrl_pipe, 0, &hc_conn); 261 279 if (rc != EOK) { 262 280 rc = EREFUSED; … … 286 304 * Register the control endpoint for the new device. 287 305 */ 288 rc = usb_pipe_register(&ctrl_pipe, 0, connection);306 rc = usb_pipe_register(&ctrl_pipe, 0, &hc_conn); 289 307 if (rc != EOK) { 290 308 rc = EREFUSED; … … 295 313 * Release the original endpoint. 296 314 */ 297 unregister_control_endpoint_on_default_address( connection);315 unregister_control_endpoint_on_default_address(&hc_conn); 298 316 299 317 /* 300 318 * Once the address is changed, we can return the default address. 301 319 */ 302 usb_hc_release_default_address( connection);320 usb_hc_release_default_address(&hc_conn); 303 321 304 322 … … 325 343 .handle = child_handle 326 344 }; 327 rc = usb_hc_register_device( connection, &new_device);345 rc = usb_hc_register_device(&hc_conn, &new_device); 328 346 if (rc != EOK) { 329 347 rc = EDESTADDRREQ; … … 354 372 355 373 leave_unregister_endpoint: 356 usb_pipe_unregister(&ctrl_pipe, connection);374 usb_pipe_unregister(&ctrl_pipe, &hc_conn); 357 375 358 376 leave_release_default_address: 359 usb_hc_release_default_address( connection);377 usb_hc_release_default_address(&hc_conn); 360 378 361 379 leave_release_free_address: 362 usb_hc_unregister_device(connection, dev_addr); 380 usb_hc_unregister_device(&hc_conn, dev_addr); 381 382 usb_hc_connection_close(&hc_conn); 363 383 364 384 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.