Changeset a83e138 in mainline for uspace/drv/usbhub/usbhub.c
- Timestamp:
- 2011-03-18T14:43:09Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a7528a16
- Parents:
- b495a93
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhub/usbhub.c
rb495a93 ra83e138 233 233 result->port_count = -1; 234 234 result->device = device; 235 result->is_default_address_used = false; 235 236 236 237 //result->usb_device = usb_new(usb_hcd_attached_device_info_t); … … 377 378 378 379 /** 380 * release default address used by given hub 381 * 382 * Also unsets hub->is_default_address_used. Convenience wrapper function. 383 * @note hub->connection MUST be open for communication 384 * @param hub hub representation 385 * @return error code 386 */ 387 static int usb_hub_release_default_address(usb_hub_info_t * hub){ 388 int opResult = usb_hc_release_default_address(&hub->connection); 389 if(opResult!=EOK){ 390 usb_log_error("could not release default address, errno %d",opResult); 391 return opResult; 392 } 393 hub->is_default_address_used = false; 394 return EOK; 395 } 396 397 /** 379 398 * Reset the port with new device and reserve the default address. 380 399 * @param hc … … 384 403 static void usb_hub_init_add_device(usb_hub_info_t * hub, uint16_t port, 385 404 bool isLowSpeed) { 405 //if this hub already uses default address, it cannot request it once more 406 if(hub->is_default_address_used) return; 407 386 408 usb_device_request_setup_packet_t request; 387 409 int opResult; … … 397 419 return; 398 420 } 421 hub->is_default_address_used = true; 399 422 //reset port 400 423 usb_hub_set_reset_port_request(&request, port); … … 407 430 usb_log_error("something went wrong when reseting a port %d",opResult); 408 431 //usb_hub_release_default_address(hc); 409 usb_h c_release_default_address(&hub->connection);432 usb_hub_release_default_address(hub); 410 433 } 411 434 } … … 427 450 if (opResult != EOK) { 428 451 usb_log_error("failed to clear port reset feature"); 429 usb_h c_release_default_address(&hub->connection);452 usb_hub_release_default_address(hub); 430 453 return; 431 454 } … … 453 476 usb_log_error("failed to get free USB address"); 454 477 opResult = new_device_address; 455 usb_h c_release_default_address(&hub->connection);478 usb_hub_release_default_address(hub); 456 479 return; 457 480 } … … 464 487 if (opResult != EOK) { 465 488 usb_log_error("could not set address for new device %d",opResult); 466 usb_h c_release_default_address(&hub->connection);489 usb_hub_release_default_address(hub); 467 490 return; 468 491 } … … 470 493 471 494 //opResult = usb_hub_release_default_address(hc); 472 opResult = usb_h c_release_default_address(&hub->connection);495 opResult = usb_hub_release_default_address(hub); 473 496 if(opResult!=EOK){ 474 497 return; … … 529 552 usb_log_warning("this is strange, disconnected device had no address"); 530 553 //device was disconnected before it`s port was reset - return default address 531 //usb_drv_release_default_address(hc); 532 usb_hc_release_default_address(&hub->connection); 554 usb_hub_release_default_address(hub); 533 555 } 534 556 }
Note:
See TracChangeset
for help on using the changeset viewer.