Changeset 9ca8539 in mainline
- Timestamp:
- 2011-05-27T08:40:18Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 74341ed
- Parents:
- 1889786 (diff), ffca03c (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. - Location:
- uspace/drv
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/root_hub.c
r1889786 r9ca8539 420 420 * create answer to port status_request 421 421 * 422 * Copy content of corresponding port status register to answer buffer. 422 * Copy content of corresponding port status register to answer buffer. The 423 * format of the port status register and port status data is the same ( 424 * see OHCI root hub and USB hub documentation). 423 425 * 424 426 * @param instance root hub instance … … 450 452 * create answer to port status_request 451 453 * 452 * Copy content of hub status register to answer buffer. 454 * This copies flags in hub status register into the buffer. The format of the 455 * status register and status message is the same, according to USB hub 456 * specification and OHCI root hub specification. 453 457 * 454 458 * @param instance root hub instance -
uspace/drv/usbhub/usbhub.c
r1889786 r9ca8539 67 67 usb_hub_status_t status); 68 68 69 static int usb_process_hub_ power_change(usb_hub_info_t * hub_info,69 static int usb_process_hub_local_power_change(usb_hub_info_t * hub_info, 70 70 usb_hub_status_t status); 71 71 … … 386 386 int opResult; 387 387 if (usb_hub_is_status(status,USB_HUB_FEATURE_HUB_OVER_CURRENT)){ 388 opResult = usb_hub_clear_feature(hub_info->control_pipe, 389 USB_HUB_FEATURE_HUB_LOCAL_POWER); 390 if (opResult != EOK) { 391 usb_log_error("cannot power off hub: %d\n", 392 opResult); 388 //poweroff all ports 389 unsigned int port; 390 for(port = 1;port <= hub_info->port_count;++port){ 391 opResult = usb_hub_clear_port_feature( 392 hub_info->control_pipe,port, 393 USB_HUB_FEATURE_PORT_POWER); 394 if (opResult != EOK) { 395 usb_log_warning( 396 "cannot power off port %d; %d\n", 397 port, opResult); 398 } 393 399 } 394 400 } else { 395 opResult = usb_hub_set_feature(hub_info->control_pipe, 396 USB_HUB_FEATURE_HUB_LOCAL_POWER); 397 if (opResult != EOK) { 398 usb_log_error("cannot power on hub: %d\n", 399 opResult); 401 //power all ports 402 unsigned int port; 403 for(port = 1;port <= hub_info->port_count;++port){ 404 opResult = usb_hub_set_port_feature( 405 hub_info->control_pipe,port, 406 USB_HUB_FEATURE_PORT_POWER); 407 if (opResult != EOK) { 408 usb_log_warning( 409 "cannot power off port %d; %d\n", 410 port, opResult); 411 } 400 412 } 401 413 } … … 404 416 405 417 /** 406 * process hub power change 407 * 408 * If the power has been lost, reestablish it. 409 * If it was reestablished, re-power all ports. 418 * process hub local power change 419 * 420 * This change is ignored. 410 421 * @param hub_info hub instance 411 422 * @param status hub status bitmask 412 423 * @return error code 413 424 */ 414 static int usb_process_hub_ power_change(usb_hub_info_t * hub_info,425 static int usb_process_hub_local_power_change(usb_hub_info_t * hub_info, 415 426 usb_hub_status_t status) { 416 427 int opResult = EOK; 417 if (!usb_hub_is_status(status,USB_HUB_FEATURE_HUB_LOCAL_POWER)) {418 //restart power on hub419 opResult = usb_hub_set_feature(hub_info->control_pipe,420 USB_HUB_FEATURE_HUB_LOCAL_POWER);421 if (opResult != EOK) {422 usb_log_error("cannot power on hub: %d\n",423 opResult);424 }425 } else {//power reestablished on hub- restart ports426 size_t port;427 for (port = 1; port <= hub_info->port_count; ++port) {428 opResult = usb_hub_set_port_feature(429 hub_info->control_pipe,430 port, USB_HUB_FEATURE_PORT_POWER);431 if (opResult != EOK) {432 usb_log_error("Cannot power on port %zu: %s.\n",433 port, str_error(opResult));434 }435 }436 }437 if(opResult!=EOK){438 return opResult;//no feature clearing439 }440 428 opResult = usb_hub_clear_feature(hub_info->control_pipe, 441 429 USB_HUB_FEATURE_C_HUB_LOCAL_POWER); … … 487 475 if ( 488 476 usb_hub_is_status(status,16+USB_HUB_FEATURE_C_HUB_LOCAL_POWER)) { 489 usb_process_hub_ power_change(hub_info, status);477 usb_process_hub_local_power_change(hub_info, status); 490 478 } 491 479 }
Note:
See TracChangeset
for help on using the changeset viewer.