Changes in uspace/drv/bus/usb/vhc/hub/hub.c [b7fd2a0:ae3a941] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/vhc/hub/hub.c
rb7fd2a0 rae3a941 68 68 69 69 /** Convert hub port state to a char. */ 70 char hub_port_state_to_char(hub_port_state_t state) { 70 char hub_port_state_to_char(hub_port_state_t state) 71 { 71 72 switch (state) { 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 73 case HUB_PORT_STATE_NOT_CONFIGURED: 74 return '-'; 75 case HUB_PORT_STATE_POWERED_OFF: 76 return 'O'; 77 case HUB_PORT_STATE_DISCONNECTED: 78 return 'X'; 79 case HUB_PORT_STATE_DISABLED: 80 return 'D'; 81 case HUB_PORT_STATE_RESETTING: 82 return 'R'; 83 case HUB_PORT_STATE_ENABLED: 84 return 'E'; 85 case HUB_PORT_STATE_SUSPENDED: 86 return 'S'; 87 case HUB_PORT_STATE_RESUMING: 88 return 'F'; 89 default: 90 return '?'; 90 91 } 91 92 } … … 231 232 } 232 233 233 usb_log_debug("Setting port %zu to state %d. \n", port_index, state);234 usb_log_debug("Setting port %zu to state %d.", port_index, state); 234 235 235 236 switch (state) { 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 237 case HUB_PORT_STATE_POWERED_OFF: 238 clear_port_status_change(port, HUB_STATUS_C_PORT_CONNECTION); 239 clear_port_status_change(port, HUB_STATUS_C_PORT_ENABLE); 240 clear_port_status_change(port, HUB_STATUS_C_PORT_RESET); 241 break; 242 case HUB_PORT_STATE_RESUMING: 243 port->state = state; 244 set_port_state_delayed(hub, port_index, 245 10, state, HUB_PORT_STATE_ENABLED); 246 break; 247 case HUB_PORT_STATE_RESETTING: 248 port->state = state; 249 set_port_state_delayed(hub, port_index, 250 10, state, HUB_PORT_STATE_ENABLED); 251 break; 252 case HUB_PORT_STATE_ENABLED: 253 if (port->state == HUB_PORT_STATE_RESETTING) { 254 set_port_status_change(port, HUB_STATUS_C_PORT_RESET); 255 } 256 break; 257 default: 258 break; 258 259 } 259 260 … … 336 337 } 337 338 338 uint32_t status; 339 status = MAKE_BYTE( 339 uint32_t status = MAKE_BYTE( 340 340 /* Current connect status. */ 341 341 port->connected_device == NULL ? 0 : 1, … … 344 344 /* Suspend. */ 345 345 (port->state == HUB_PORT_STATE_SUSPENDED) 346 346 || (port->state == HUB_PORT_STATE_RESUMING) ? 1 : 0, 347 347 /* Over-current. */ 348 348 0, … … 350 350 port->state == HUB_PORT_STATE_RESETTING ? 1 : 0, 351 351 /* Reserved. */ 352 0, 0, 0) 353 354 | (MAKE_BYTE(352 0, 0, 0); 353 354 status |= MAKE_BYTE( 355 355 /* Port power. */ 356 356 port->state == HUB_PORT_STATE_POWERED_OFF ? 0 : 1, … … 359 359 /* Reserved. */ 360 360 0, 0, 0, 0, 0, 0 361 ) )<< 8;361 ) << 8; 362 362 363 363 status |= (port->status_change << 16); … … 423 423 uint16_t old_value = port->status_change; 424 424 port->status_change |= change; 425 usb_log_debug("Changing status change on %zu: %04x => %04x \n",425 usb_log_debug("Changing status change on %zu: %04x => %04x", 426 426 port->index, 427 427 (unsigned int) old_value, (unsigned int) port->status_change); … … 463 463 static errno_t set_port_state_delayed_fibril(void *arg) 464 464 { 465 struct delay_port_state_change *change 466 =(struct delay_port_state_change *) arg;465 struct delay_port_state_change *change = 466 (struct delay_port_state_change *) arg; 467 467 468 468 async_usleep(change->delay); … … 500 500 hub_port_state_t old_state, hub_port_state_t new_state) 501 501 { 502 struct delay_port_state_change *change 503 =malloc(sizeof(struct delay_port_state_change));502 struct delay_port_state_change *change = 503 malloc(sizeof(struct delay_port_state_change)); 504 504 505 505 change->hub = hub; … … 510 510 fid_t fibril = fibril_create(set_port_state_delayed_fibril, change); 511 511 if (fibril == 0) { 512 printf("Failed to create fibril\n");512 usb_log_error("Failed to create fibril."); 513 513 free(change); 514 514 return;
Note:
See TracChangeset
for help on using the changeset viewer.