Changeset c0587d90 in mainline for uspace/drv/bus/usb/usbhub/port.c
- Timestamp:
- 2011-09-23T13:44:12Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 442fa6b
- Parents:
- a590a23
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhub/port.c
ra590a23 rc0587d90 73 73 * @return Operation result 74 74 */ 75 int usb_hub_clear_port_feature(usb_pipe_t *pipe, 76 int port_index, usb_hub_class_feature_t feature) 77 { 75 int usb_hub_clear_port_feature( 76 usb_hub_port_t *port, usb_hub_class_feature_t feature) 77 { 78 assert(port); 78 79 usb_device_request_setup_packet_t clear_request = { 79 80 .request_type = USB_HUB_REQ_TYPE_CLEAR_PORT_FEATURE, 80 81 .request = USB_DEVREQ_CLEAR_FEATURE, 81 82 .value = feature, 82 .index = port _index,83 .index = port->port_number, 83 84 .length = 0, 84 85 }; 85 return usb_pipe_control_write(p ipe, &clear_request,86 return usb_pipe_control_write(port->control_pipe, &clear_request, 86 87 sizeof(clear_request), NULL, 0); 87 88 } … … 96 97 * @return Operation result 97 98 */ 98 int usb_hub_set_port_feature( usb_pipe_t *pipe,99 int port_index, usb_hub_class_feature_t feature)100 { 101 99 int usb_hub_set_port_feature( 100 usb_hub_port_t *port, usb_hub_class_feature_t feature) 101 { 102 assert(port); 102 103 usb_device_request_setup_packet_t clear_request = { 103 104 .request_type = USB_HUB_REQ_TYPE_SET_PORT_FEATURE, 104 105 .request = USB_DEVREQ_SET_FEATURE, 105 .index = port _index,106 .index = port->port_number, 106 107 .value = feature, 107 108 .length = 0, 108 109 }; 109 return usb_pipe_control_write(p ipe, &clear_request,110 return usb_pipe_control_write(port->control_pipe, &clear_request, 110 111 sizeof(clear_request), NULL, 0); 111 112 } … … 139 140 /* ACK the change */ 140 141 const int opResult = 141 usb_hub_clear_port_feature( hub->control_pipe,142 port,USB_HUB_FEATURE_C_PORT_CONNECTION);142 usb_hub_clear_port_feature(&hub->ports[port], 143 USB_HUB_FEATURE_C_PORT_CONNECTION); 143 144 if (opResult != EOK) { 144 145 usb_log_warning("Failed to clear " … … 266 267 267 268 /* Clear the port reset change. */ 268 int rc = usb_hub_clear_port_feature( hub->control_pipe,269 port,USB_HUB_FEATURE_C_PORT_RESET);269 int rc = usb_hub_clear_port_feature(&hub->ports[port], 270 USB_HUB_FEATURE_C_PORT_RESET); 270 271 if (rc != EOK) { 271 272 usb_log_error("Failed to clear port %d reset feature: %s.\n", … … 326 327 static int enable_port_callback(int port_no, void *arg) 327 328 { 328 usb_hub_info_t *hub = arg; 329 assert(hub); 330 usb_hub_port_t *my_port = hub->ports + port_no; 331 const int rc = usb_hub_set_port_feature(hub->control_pipe, 332 port_no, USB_HUB_FEATURE_PORT_RESET); 329 usb_hub_port_t *port = arg; 330 const int rc = 331 usb_hub_set_port_feature(port, USB_HUB_FEATURE_PORT_RESET); 333 332 if (rc != EOK) { 334 333 usb_log_warning("Port reset failed: %s.\n", str_error(rc)); … … 339 338 * Wait until reset completes. 340 339 */ 341 fibril_mutex_lock(& my_port->reset_mutex);342 while (! my_port->reset_completed) {343 fibril_condvar_wait(& my_port->reset_cv, &my_port->reset_mutex);344 } 345 fibril_mutex_unlock(& my_port->reset_mutex);346 347 if ( my_port->reset_okay) {340 fibril_mutex_lock(&port->reset_mutex); 341 while (!port->reset_completed) { 342 fibril_condvar_wait(&port->reset_cv, &port->reset_mutex); 343 } 344 fibril_mutex_unlock(&port->reset_mutex); 345 346 if (port->reset_okay) { 348 347 return EOK; 349 348 } else { … … 370 369 const int rc = usb_hc_new_device_wrapper(data->hub->usb_device->ddf_dev, 371 370 &data->hub->connection, data->speed, 372 enable_port_callback, (int) data->port, data->hub, 371 enable_port_callback, (int) data->port, 372 &data->hub->ports[data->port], 373 373 &new_address, &child_handle, 374 374 NULL, NULL, NULL);
Note:
See TracChangeset
for help on using the changeset viewer.