Changeset cae002c in mainline
- Timestamp:
- 2011-10-30T21:12:24Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- eea3e39
- Parents:
- 8be7819
- Location:
- uspace/drv/bus/usb/usbhub
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhub/port.c
r8be7819 rcae002c 401 401 { 402 402 usb_hub_port_t *port = arg; 403 assert(port); 403 404 const int rc = 404 405 usb_hub_port_set_feature(port, USB_HUB_FEATURE_PORT_RESET); … … 440 441 data->port, &new_address, NULL, NULL, &child_fun); 441 442 442 if (rc != EOK) { 443 if (rc == EOK) { 444 fibril_mutex_lock(&data->port->mutex); 445 data->port->attached_device.fun = child_fun; 446 data->port->attached_device.address = new_address; 447 fibril_mutex_unlock(&data->port->mutex); 448 449 usb_log_info("Detected new device on `%s' (port %zu), " 450 "address %d (handle %" PRIun ").\n", 451 data->hub->usb_device->ddf_dev->name, 452 data->port->port_number, new_address, child_fun->handle); 453 } else { 443 454 usb_log_error("Failed registering device on port %zu: %s.\n", 444 455 data->port->port_number, str_error(rc)); 445 goto leave; 446 } 447 448 fibril_mutex_lock(&data->port->mutex); 449 data->port->attached_device.fun = child_fun; 450 data->port->attached_device.address = new_address; 451 fibril_mutex_unlock(&data->port->mutex); 452 453 usb_log_info("Detected new device on `%s' (port %zu), " 454 "address %d (handle %" PRIun ").\n", 455 data->hub->usb_device->ddf_dev->name, data->port->port_number, 456 new_address, child_fun->handle); 457 458 leave: 456 } 457 458 459 459 fibril_mutex_lock(&data->hub->pending_ops_mutex); 460 460 assert(data->hub->pending_ops_count > 0); -
uspace/drv/bus/usb/usbhub/port.h
r8be7819 rcae002c 44 44 /** Information about single port on a hub. */ 45 45 typedef struct { 46 /* Port number as reporte ed in descriptors. */46 /* Port number as reported in descriptors. */ 47 47 size_t port_number; 48 48 /** Device communication pipe. */ -
uspace/drv/bus/usb/usbhub/usbhub.c
r8be7819 rcae002c 170 170 int usb_hub_device_remove(usb_device_t *usb_dev) 171 171 { 172 assert(usb_dev);173 usb_hub_dev_t *hub_dev = usb_dev->driver_data;174 assert(hub_dev);175 //TODO: Cascade the call here.176 //TODO: Enable after cascading is implemented.177 172 return ENOTSUP; 178 if (!hub_dev->power_switched) {179 /* That is all we can do. */180 return EOK;181 }182 int ret = EOK;183 usb_log_info("Hub is about to be removed, powering down all ports.\n");184 for (size_t port = 0; port < hub_dev->port_count; ++port) {185 usb_log_debug("Powering down port %zu.\n", port);186 int pret = usb_hub_port_clear_feature(187 &hub_dev->ports[port], USB_HUB_FEATURE_PORT_POWER);188 if (pret != EOK) {189 usb_log_error("Cannot power down port %zu: %s.\n",190 hub_dev->ports[port].port_number, str_error(pret));191 ret = pret;192 } else {193 if (!hub_dev->per_port_power) {194 usb_log_debug("Ganged power switching mode, "195 "one port is enough.\n");196 break;197 }198 }199 }200 return ret;201 173 } 202 174 /*----------------------------------------------------------------------------*/
Note:
See TracChangeset
for help on using the changeset viewer.