Changes in uspace/drv/usbhub/usbhub.c [361fcec:4125b7d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhub/usbhub.c
r361fcec r4125b7d 73 73 74 74 75 /// \TODO malloc checking 76 75 77 //********************************************* 76 78 // … … 103 105 } 104 106 107 //usb_pipe_start_session(hub_info->control_pipe); 105 108 //set hub configuration 106 109 opResult = usb_hub_set_configuration(hub_info); … … 119 122 return opResult; 120 123 } 124 //usb_pipe_end_session(hub_info->control_pipe); 125 121 126 122 127 usb_log_debug("Creating 'hub' function in DDF.\n"); … … 171 176 leave: 172 177 /* FIXME: proper interval. */ 173 async_usleep(1000 * 250);178 async_usleep(1000 * 1000 * 10); 174 179 175 180 return true; … … 213 218 // get hub descriptor 214 219 usb_log_debug("creating serialized descriptor\n"); 220 //void * serialized_descriptor = malloc(USB_HUB_MAX_DESCRIPTOR_SIZE); 215 221 uint8_t serialized_descriptor[USB_HUB_MAX_DESCRIPTOR_SIZE]; 216 222 usb_hub_descriptor_t * descriptor; … … 246 252 hub_info->ports = malloc( 247 253 sizeof (usb_hub_port_t) * (hub_info->port_count + 1)); 248 if(!hub_info->ports){249 return ENOMEM;250 }251 254 size_t port; 252 for (port = 0; port < hub_info->port_count + 1; ++port) {255 for (port = 0; port < hub_info->port_count + 1; port++) { 253 256 usb_hub_port_init(&hub_info->ports[port]); 254 257 } 255 258 if(is_power_switched){ 256 259 usb_log_debug("is_power_switched\n"); 257 258 if(!has_individual_port_powering){ 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 } 269 } 270 }else{ 259 271 usb_log_debug("!has_individual_port_powering\n"); 260 272 opResult = usb_hub_set_feature(hub_info->control_pipe, … … 265 277 } 266 278 } 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 278 279 }else{ 279 usb_log_debug("!is_power_switched , not going to be powered\n");280 usb_log_debug("!is_power_switched\n"); 280 281 } 281 282 usb_log_debug2("freeing data\n"); 283 //free(serialized_descriptor); 284 //free(descriptor->devices_removable); 282 285 free(descriptor); 283 286 return EOK; … … 412 415 usb_hub_status_t status) { 413 416 int opResult; 414 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)) { 415 418 //restart power on hub 416 419 opResult = usb_hub_set_feature(hub_info->control_pipe, … … 422 425 } else {//power reestablished on hub- restart ports 423 426 size_t port; 424 for (port = 1; port <=hub_info->port_count; ++port) {427 for (port = 0; port < hub_info->port_count; ++port) { 425 428 opResult = usb_hub_set_port_feature( 426 429 hub_info->control_pipe, … … 431 434 } 432 435 } 433 opResult = usb_hub_clear_feature(hub_info->control_pipe,434 USB_HUB_FEATURE_C_HUB_LOCAL_POWER);435 if (opResult != EOK) {436 usb_log_error("cannnot clear hub power change flag: "437 "%d\n",438 opResult);439 }440 436 } 441 437 return opResult;
Note:
See TracChangeset
for help on using the changeset viewer.