Changes in / [c7d19d84:32aef25b] in mainline
- Location:
- uspace/drv
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/root_hub.c
rc7d19d84 r32aef25b 217 217 instance->registers->rh_desc_a |= RHDA_NPS_FLAG; 218 218 instance->unfinished_interrupt_transfer = NULL; 219 instance->interrupt_buffer = malloc((instance->port_count + 8)/8); 219 220 usb_log_info("OHCI root hub with %d ports.\n", instance->port_count); 220 221 return EOK; … … 471 472 size_t * buffer_size) { 472 473 int bit_count = instance->port_count + 1; 473 (*buffer_size) = (bit_count / 8) + ((bit_count % 8 == 0) ? 0 : 1);474 475 (*buffer) = malloc(*buffer_size);474 (*buffer_size) = (bit_count+7 / 8); 475 476 (*buffer) = instance->interrupt_buffer;//malloc(*buffer_size); 476 477 uint8_t * bitmap = (uint8_t*) (*buffer); 477 478 uint32_t mask = (1 << (USB_HUB_FEATURE_C_HUB_LOCAL_POWER + 16)) -
uspace/drv/ohci/root_hub.h
rc7d19d84 r32aef25b 56 56 /** interrupt transfer waiting for an actual interrupt to occur */ 57 57 usb_transfer_batch_t * unfinished_interrupt_transfer; 58 /** pre-allocated interrupt mask 59 * 60 * This is allocated when initializing instance, so that memory 61 * allocation is not needed when processing request. 62 */ 63 uint8_t * interrupt_buffer; 58 64 } rh_t; 59 65 -
uspace/drv/usbhub/usbhub.c
rc7d19d84 r32aef25b 105 105 } 106 106 107 //usb_pipe_start_session(hub_info->control_pipe);108 107 //set hub configuration 109 108 opResult = usb_hub_set_configuration(hub_info); … … 122 121 return opResult; 123 122 } 124 //usb_pipe_end_session(hub_info->control_pipe);125 126 123 127 124 usb_log_debug("Creating 'hub' function in DDF.\n"); … … 176 173 leave: 177 174 /* FIXME: proper interval. */ 178 async_usleep(1000 * 1000 * 10);175 async_usleep(1000 * 250); 179 176 180 177 return true; … … 218 215 // get hub descriptor 219 216 usb_log_debug("creating serialized descriptor\n"); 220 //void * serialized_descriptor = malloc(USB_HUB_MAX_DESCRIPTOR_SIZE);221 217 uint8_t serialized_descriptor[USB_HUB_MAX_DESCRIPTOR_SIZE]; 222 218 usb_hub_descriptor_t * descriptor; … … 253 249 sizeof (usb_hub_port_t) * (hub_info->port_count + 1)); 254 250 size_t port; 255 for (port = 0; port < hub_info->port_count + 1; port++) {251 for (port = 0; port < hub_info->port_count + 1; ++port) { 256 252 usb_hub_port_init(&hub_info->ports[port]); 257 253 } 258 254 if(is_power_switched){ 259 255 usb_log_debug("is_power_switched\n"); 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 } 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)); 269 264 } 270 }else{ 265 } 266 if(!has_individual_port_powering){ 271 267 usb_log_debug("!has_individual_port_powering\n"); 272 268 opResult = usb_hub_set_feature(hub_info->control_pipe, … … 281 277 } 282 278 usb_log_debug2("freeing data\n"); 283 //free(serialized_descriptor);284 //free(descriptor->devices_removable);285 279 free(descriptor); 286 280 return EOK; … … 415 409 usb_hub_status_t status) { 416 410 int opResult; 417 if ( usb_hub_is_status(status,USB_HUB_FEATURE_HUB_LOCAL_POWER)) {411 if (!usb_hub_is_status(status,USB_HUB_FEATURE_HUB_LOCAL_POWER)) { 418 412 //restart power on hub 419 413 opResult = usb_hub_set_feature(hub_info->control_pipe, … … 425 419 } else {//power reestablished on hub- restart ports 426 420 size_t port; 427 for (port = 0; port <hub_info->port_count; ++port) {421 for (port = 1; port <= hub_info->port_count; ++port) { 428 422 opResult = usb_hub_set_port_feature( 429 423 hub_info->control_pipe, … … 434 428 } 435 429 } 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 } 436 437 } 437 438 return opResult;
Note:
See TracChangeset
for help on using the changeset viewer.