Changeset 957ea3a in mainline
- Timestamp:
- 2018-01-15T20:13:40Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 309d9865
- Parents:
- 9ff99e8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhub/port.c
r9ff99e8 r957ea3a 389 389 assert(params); 390 390 391 bool release_default_address = false; 392 391 393 int ret = EOK; 392 394 usb_hub_dev_t *hub = params->hub; … … 410 412 } 411 413 if (ret != EOK) { 412 usb_log_error("(%p-%u): Failed to reserve default address: %s", 413 hub, port->port_number, str_error(ret)); 414 usb_log_error("(%p-%u): Failed to reserve default address: %s", hub, port->port_number, str_error(ret)); 414 415 goto out; 415 416 } 416 417 usb_log_debug("(%p-%u): Got default address reseting port.", hub, 418 port->port_number); 417 release_default_address = true; 418 419 usb_log_debug("(%p-%u): Got default address. Reseting port.", hub, port->port_number); 420 419 421 /* Reset port */ 420 ret = port_enable(port, hub, true); 421 if (ret != EOK) { 422 usb_log_error("(%p-%u): Failed to reset port.", hub, 423 port->port_number); 424 if (usbhc_release_default_address(exch) != EOK) 425 usb_log_warning("(%p-%u): Failed to release default " 426 "address.", hub, port->port_number); 422 if ((ret = port_enable(port, hub, true))) { 423 usb_log_error("(%p-%u): Failed to reset port.", hub, port->port_number); 427 424 ret = EIO; 428 goto out; 429 } 430 usb_log_debug("(%p-%u): Port reset, enumerating device", hub, 431 port->port_number); 432 433 ret = usbhc_device_enumerate(exch, port->port_number); 434 if (ret != EOK) { 435 usb_log_error("(%p-%u): Failed to enumerate device: %s", hub, 436 port->port_number, str_error(ret)); 437 const int ret = port_enable(port, hub, false); 438 if (ret != EOK) { 439 usb_log_warning("(%p-%u)Failed to disable port (%s), " 440 "NOT releasing default address.", hub, 441 port->port_number, str_error(ret)); 442 } else { 443 const int ret = usbhc_release_default_address(exch); 444 if (ret != EOK) 445 usb_log_warning("(%p-%u): Failed to release " 446 "default address: %s", hub, 447 port->port_number, str_error(ret)); 448 } 449 } else { 450 usb_log_debug("(%p-%u): Device enumerated", hub, 451 port->port_number); 452 port->device_attached = true; 453 if (usbhc_release_default_address(exch) != EOK) 454 usb_log_warning("(%p-%u): Failed to release default " 455 "address", hub, port->port_number); 456 } 425 goto out_address; 426 } 427 428 usb_log_debug("(%p-%u): Port reset, enumerating device", hub, port->port_number); 429 430 if ((ret = usbhc_device_enumerate(exch, port->port_number))) { 431 usb_log_error("(%p-%u): Failed to enumerate device: %s", hub, port->port_number, str_error(ret)); 432 goto out_port; 433 } 434 435 usb_log_debug("(%p-%u): Device enumerated", hub, port->port_number); 436 port->device_attached = true; 437 438 out_port: 439 if (!port->device_attached && (ret = port_enable(port, hub, false))) { 440 usb_log_warning("(%p-%u)Failed to disable port (%s), NOT releasing default address.", hub, port->port_number, str_error(ret)); 441 release_default_address = false; 442 } 443 444 out_address: 445 if (release_default_address && (ret = usbhc_release_default_address(exch))) 446 usb_log_warning("(%p-%u): Failed to release default address: %s", hub, port->port_number, str_error(ret)); 447 457 448 out: 458 449 usb_device_bus_exchange_end(exch);
Note:
See TracChangeset
for help on using the changeset viewer.