Ignore:
File:
1 edited

Legend:

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

    r70e5ad5 r0f21c0c  
    2727 */
    2828
    29 /** @addtogroup usb
     29/** @addtogroup drvusbvhc
    3030 * @{
    3131 */
     
    4040#include <stdlib.h>
    4141#include <driver.h>
    42 #include <usb/usbdrv.h>
    4342
    4443#include "hub.h"
     
    155154}
    156155
     156/** Disconnects a device from a hub.
     157 *
     158 * @param hub Hub the device was connected to.
     159 * @param device Device to be disconnected.
     160 * @return Error code.
     161 */
     162int hub_disconnect_device(hub_t *hub, void *device)
     163{
     164        size_t index = hub_find_device(hub, device);
     165        if (index == (size_t) -1) {
     166                return ENOENT;
     167        }
     168
     169        hub_port_t *port = &hub->ports[index];
     170
     171        port->connected_device = NULL;
     172        port->state = HUB_PORT_STATE_DISCONNECTED;
     173        set_port_status_change(port, HUB_STATUS_C_PORT_CONNECTION);
     174
     175        return EOK;
     176}
     177
    157178/** Find port device is connected to.
    158179 *
     
    173194        }
    174195
    175         return 0;
     196        return -1;
    176197}
    177198
Note: See TracChangeset for help on using the changeset viewer.