Changes in uspace/drv/usbhub/usbhub.c [9014dcd:4125b7d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhub/usbhub.c
r9014dcd r4125b7d 105 105 } 106 106 107 //usb_pipe_start_session(hub_info->control_pipe); 107 108 //set hub configuration 108 109 opResult = usb_hub_set_configuration(hub_info); … … 121 122 return opResult; 122 123 } 124 //usb_pipe_end_session(hub_info->control_pipe); 125 123 126 124 127 usb_log_debug("Creating 'hub' function in DDF.\n"); … … 173 176 leave: 174 177 /* FIXME: proper interval. */ 175 async_usleep(1000 * 250);178 async_usleep(1000 * 1000 * 10); 176 179 177 180 return true; … … 215 218 // get hub descriptor 216 219 usb_log_debug("creating serialized descriptor\n"); 220 //void * serialized_descriptor = malloc(USB_HUB_MAX_DESCRIPTOR_SIZE); 217 221 uint8_t serialized_descriptor[USB_HUB_MAX_DESCRIPTOR_SIZE]; 218 222 usb_hub_descriptor_t * descriptor; … … 249 253 sizeof (usb_hub_port_t) * (hub_info->port_count + 1)); 250 254 size_t port; 251 for (port = 0; port < hub_info->port_count + 1; ++port) {255 for (port = 0; port < hub_info->port_count + 1; port++) { 252 256 usb_hub_port_init(&hub_info->ports[port]); 253 257 } 254 258 if(is_power_switched){ 255 259 usb_log_debug("is_power_switched\n"); 256 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)); 260 if(has_individual_port_powering){ 261 usb_log_debug("has_individual_port_powering\n"); 262 for (port = 0; port < hub_info->port_count; port++) { 263 opResult = usb_hub_set_port_feature(hub_info->control_pipe, 264 port+1, USB_HUB_FEATURE_PORT_POWER); 265 if (opResult != EOK) { 266 usb_log_error("cannot power on port %zu: %s.\n", 267 port+1, str_error(opResult)); 268 } 264 269 } 265 } 266 if(!has_individual_port_powering){ 270 }else{ 267 271 usb_log_debug("!has_individual_port_powering\n"); 268 272 opResult = usb_hub_set_feature(hub_info->control_pipe, … … 277 281 } 278 282 usb_log_debug2("freeing data\n"); 283 //free(serialized_descriptor); 284 //free(descriptor->devices_removable); 279 285 free(descriptor); 280 286 return EOK; … … 409 415 usb_hub_status_t status) { 410 416 int opResult; 411 if ( !usb_hub_is_status(status,USB_HUB_FEATURE_HUB_LOCAL_POWER)) {417 if (usb_hub_is_status(status,USB_HUB_FEATURE_HUB_LOCAL_POWER)) { 412 418 //restart power on hub 413 419 opResult = usb_hub_set_feature(hub_info->control_pipe, … … 419 425 } else {//power reestablished on hub- restart ports 420 426 size_t port; 421 for (port = 1; port <=hub_info->port_count; ++port) {427 for (port = 0; port < hub_info->port_count; ++port) { 422 428 opResult = usb_hub_set_port_feature( 423 429 hub_info->control_pipe, … … 428 434 } 429 435 } 430 opResult = usb_hub_clear_feature(hub_info->control_pipe,431 USB_HUB_FEATURE_C_HUB_LOCAL_POWER);432 if (opResult != EOK) {433 usb_log_error("cannnot clear hub power change flag: "434 "%d\n",435 opResult);436 }437 436 } 438 437 return opResult;
Note:
See TracChangeset
for help on using the changeset viewer.