Changeset aa1922c in mainline
- Timestamp:
- 2011-10-12T17:22:43Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4501e207
- Parents:
- 8e5ce07
- Location:
- uspace/drv/bus/usb/uhcirh
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhcirh/port.c
r8e5ce07 raa1922c 37 37 #include <str_error.h> 38 38 #include <async.h> 39 #include <devman.h> 39 40 40 41 #include <usb/usb.h> /* usb_address_t */ 41 #include <usb/dev/hub.h> /* usb_hc_new_device_wrapper */42 42 #include <usb/debug.h> 43 43 … … 100 100 port->number = number; 101 101 port->wait_period_usec = usec; 102 port->attached_device = 0; 102 port->attached_device.handle = 0; 103 port->attached_device.address = -1; 103 104 port->rh = rh; 104 105 … … 168 169 169 170 /* Remove any old device */ 170 if (instance->attached_device ) {171 if (instance->attached_device.handle) { 171 172 usb_log_debug2("%s: Removing device.\n", 172 173 instance->id_string); … … 257 258 258 259 int ret, count = 0; 259 usb_address_t dev_addr;260 260 do { 261 261 ret = usb_hc_new_device_wrapper(port->rh, &port->hc_connection, 262 262 speed, uhci_port_reset_enable, port->number, port, 263 &dev_addr, &port->attached_device, NULL, NULL, NULL); 263 &port->attached_device.address, 264 &port->attached_device.handle, NULL, NULL, NULL); 264 265 } while (ret != EOK && ++count < 4); 265 266 … … 272 273 273 274 usb_log_info("New device at port %u, address %d (handle %" PRIun ").\n", 274 port->number, dev_addr, port->attached_device); 275 port->number, port->attached_device.address, 276 port->attached_device.handle); 275 277 return EOK; 276 278 } … … 278 280 /** Remove device. 279 281 * 280 * @param[in] port Memory structure to use. 281 * @return Error code. 282 * 283 * Does not work, DDF does not support device removal. 284 * Does not even free used USB address (it would be dangerous if tis driver 285 * is still running). 282 * @param[in] port Port instance to use. 283 * @return Error code. 286 284 */ 287 285 int uhci_port_remove_device(uhci_port_t *port) 288 286 { 289 usb_log_error("%s: Don't know how to remove device %" PRIun ".\n", 290 port->id_string, port->attached_device); 291 port->attached_device = 0; 292 return ENOTSUP; 287 usb_log_debug("Removing device on port %zu.\n", port->number); 288 289 /* Stop driver first */ 290 int ret = devman_remove_function(port->attached_device.handle); 291 if (ret != EOK) { 292 usb_log_error("Failed to remove child function on port" 293 " %zu: %s.\n", port->number, str_error(ret)); 294 return ret; 295 } 296 port->attached_device.handle = 0; 297 298 /* Driver stopped, free used address */ 299 ret = usb_hc_unregister_device(&port->hc_connection, 300 port->attached_device.address); 301 if (ret != EOK) { 302 usb_log_error("Failed to unregister address of removed device: " 303 "%s.\n", str_error(ret)); 304 return ret; 305 } 306 307 port->attached_device.address = -1; 308 usb_log_info("Removed device on port %zu.\n", port->number); 309 return EOK; 293 310 } 294 311 /*----------------------------------------------------------------------------*/ -
uspace/drv/bus/usb/uhcirh/port.h
r8e5ce07 raa1922c 39 39 #include <ddf/driver.h> 40 40 #include <usb/hc.h> /* usb_hc_connection_t */ 41 #include <usb/dev/hub.h> 41 42 42 43 typedef uint16_t port_status_t; … … 62 63 usb_hc_connection_t hc_connection; 63 64 ddf_dev_t *rh; 64 devman_handle_t attached_device;65 usb_hc_attached_device_t attached_device; 65 66 fid_t checker; 66 67 } uhci_port_t;
Note:
See TracChangeset
for help on using the changeset viewer.