Changeset 3d4aa055 in mainline for uspace/drv/usbhub/usbhub.c
- Timestamp:
- 2011-05-06T13:08:10Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 075c1eb, 3da17644
- Parents:
- a58dd620 (diff), 310c4df (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/drv/usbhub/usbhub.c
ra58dd620 r3d4aa055 73 73 74 74 75 /// \TODO malloc checking76 77 75 //********************************************* 78 76 // … … 248 246 hub_info->ports = malloc( 249 247 sizeof (usb_hub_port_t) * (hub_info->port_count + 1)); 248 if(!hub_info->ports){ 249 return ENOMEM; 250 } 250 251 size_t port; 251 252 for (port = 0; port < hub_info->port_count + 1; ++port) { … … 255 256 usb_log_debug("is_power_switched\n"); 256 257 257 for (port = 1; port <= hub_info->port_count; ++port) {258 usb_log_debug("powering port %d\n",port);259 opResult = usb_hub_set_port_feature(hub_info->control_pipe,260 port, USB_HUB_FEATURE_PORT_POWER);261 if (opResult != EOK) {262 usb_log_error("cannot power on port %zu: %s.\n",263 port, str_error(opResult));264 }265 }266 258 if(!has_individual_port_powering){ 267 259 usb_log_debug("!has_individual_port_powering\n"); … … 273 265 } 274 266 } 267 268 for (port = 1; port <= hub_info->port_count; ++port) { 269 usb_log_debug("Powering port %zu.\n",port); 270 opResult = usb_hub_set_port_feature(hub_info->control_pipe, 271 port, USB_HUB_FEATURE_PORT_POWER); 272 if (opResult != EOK) { 273 usb_log_error("cannot power on port %zu: %s.\n", 274 port, str_error(opResult)); 275 } 276 } 277 275 278 }else{ 276 usb_log_debug("!is_power_switched \n");279 usb_log_debug("!is_power_switched, not going to be powered\n"); 277 280 } 278 281 usb_log_debug2("freeing data\n"); … … 408 411 static int usb_process_hub_power_change(usb_hub_info_t * hub_info, 409 412 usb_hub_status_t status) { 410 int opResult ;413 int opResult = EOK; 411 414 if (!usb_hub_is_status(status,USB_HUB_FEATURE_HUB_LOCAL_POWER)) { 412 415 //restart power on hub … … 428 431 } 429 432 } 430 opResult = usb_hub_clear_feature(hub_info->control_pipe, 431 USB_HUB_FEATURE_C_HUB_LOCAL_POWER); 433 } 434 if(opResult!=EOK){ 435 return opResult;//no feature clearing 436 } 437 opResult = usb_hub_clear_feature(hub_info->control_pipe, 438 USB_HUB_FEATURE_C_HUB_LOCAL_POWER); 432 439 if (opResult != EOK) { 433 usb_log_error("cannnot clear hub power change flag: " 434 "%d\n", 435 opResult); 436 } 440 usb_log_error("cannnot clear hub power change flag: " 441 "%d\n", 442 opResult); 437 443 } 438 444 return opResult;
Note:
See TracChangeset
for help on using the changeset viewer.