Changeset d650494 in mainline
- Timestamp:
- 2011-09-27T11:21:12Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a1cb170
- Parents:
- 400f363
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhub/port.c
r400f363 rd650494 36 36 37 37 #include <bool.h> 38 #include <devman.h> 38 39 #include <errno.h> 39 40 #include <str_error.h> … … 42 43 43 44 #include <usb/debug.h> 45 #include <usb/dev/hub.h> 44 46 45 47 #include "port.h" … … 54 56 }; 55 57 56 static void usb_hub_port_removed_device(usb_hub_port_t *port); 58 static void usb_hub_port_removed_device(usb_hub_port_t *port, 59 usb_hub_info_t *hub); 57 60 static void usb_hub_port_reset_completed(usb_hub_port_t *port, 58 61 usb_port_status_t status); … … 148 151 usb_log_debug("Connection change on port %zu: device %s.\n", 149 152 port->port_number, connected ? "attached" : "removed"); 153 150 154 /* ACK the change */ 151 155 const int opResult = usb_hub_port_clear_feature(port, … … 165 169 } 166 170 } else { 167 usb_hub_port_removed_device(port); 171 /* If enabled change was reported leave the removal 172 * to that handler, it shall ACK the change too. */ 173 if (!(status & USB_HUB_PORT_C_STATUS_ENABLED)) { 174 usb_hub_port_removed_device(port, hub); 175 } 168 176 } 169 177 } … … 171 179 /* Enable change, ports are automatically disabled on errors. */ 172 180 if (status & USB_HUB_PORT_C_STATUS_ENABLED) { 173 usb_hub_port_removed_device(port); 181 usb_log_info("Port %zu, disabled because of errors.\n", 182 port->port_number); 183 usb_hub_port_removed_device(port, hub); 174 184 const int rc = usb_hub_port_clear_feature(port, 175 185 USB_HUB_FEATURE_C_PORT_ENABLE); … … 239 249 * @param port port number, starting from 1 240 250 */ 241 static void usb_hub_port_removed_device(usb_hub_port_t *port) 242 { 243 assert(port); 244 // TODO remove device from device manager 245 246 251 static void usb_hub_port_removed_device(usb_hub_port_t *port, 252 usb_hub_info_t *hub) 253 { 254 assert(port); 255 assert(hub); 247 256 if (port->attached_device.address >= 0) { 248 #if 0249 usb_log_warning("Device unplug on `%s' (port %zu): " \250 "not implemented.\n", hub->usb_device->ddf_dev->name,251 (size_t) port);252 #endif253 257 fibril_mutex_lock(&port->mutex); 254 258 port->attached_device.address = -1; 255 259 port->attached_device.handle = 0; 256 260 fibril_mutex_unlock(&port->mutex); 261 usb_log_info("Removed device on port %zu.\n", 262 port->port_number); 257 263 } else { 258 usb_log_warning("Device removed before being registered.\n"); 264 usb_log_warning( 265 "Device on port %zu removed before being registered.\n", 266 port->port_number); 259 267 260 268 /* … … 270 278 * Process port reset change 271 279 * 272 * After this change port should be enabled, unless some problem occur ed.280 * After this change port should be enabled, unless some problem occurred. 273 281 * This functions triggers second phase of enabling new device. 274 282 * @param hub
Note:
See TracChangeset
for help on using the changeset viewer.