Changeset 68a68705 in mainline


Ignore:
Timestamp:
2011-01-25T18:06:28Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bd8c753d, e0ba26b
Parents:
875e7227
Message:

Virtual hub knows how to disconnect a device

When a virtual device is disconnected from virtual host controller, the root
hub makes transition to DISABLED state on port where the change occured.

Location:
uspace/drv/vhc/hub
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/vhc/hub/hub.c

    r875e7227 r68a68705  
    155155}
    156156
     157/** Disconnects a device from a hub.
     158 *
     159 * @param hub Hub the device was connected to.
     160 * @param device Device to be disconnected.
     161 * @return Error code.
     162 */
     163int hub_disconnect_device(hub_t *hub, void *device)
     164{
     165        size_t index = hub_find_device(hub, device);
     166        if (index == (size_t) -1) {
     167                return ENOENT;
     168        }
     169
     170        hub_port_t *port = &hub->ports[index];
     171
     172        port->connected_device = NULL;
     173        port->state = HUB_PORT_STATE_DISCONNECTED;
     174        set_port_status_change(port, HUB_STATUS_C_PORT_CONNECTION);
     175
     176        return EOK;
     177}
     178
    157179/** Find port device is connected to.
    158180 *
  • uspace/drv/vhc/hub/hub.h

    r875e7227 r68a68705  
    9494void hub_init(hub_t *);
    9595size_t hub_connect_device(hub_t *, void *);
     96int hub_disconnect_device(hub_t *, void *);
    9697size_t hub_find_device(hub_t *, void *);
    9798void hub_acquire(hub_t *);
  • uspace/drv/vhc/hub/virthub.c

    r875e7227 r68a68705  
    203203
    204204        hub_acquire(hub);
    205         /* TODO: implement. */
     205        hub_disconnect_device(hub, conn);
    206206        hub_release(hub);
    207207
Note: See TracChangeset for help on using the changeset viewer.