Changeset 19a1800 in mainline for uspace/drv/vhc/hub/hub.c


Ignore:
Timestamp:
2011-03-01T22:20:56Z (14 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e24e7b1
Parents:
976f546 (diff), ac8285d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge with the current development

File:
1 edited

Legend:

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

    r976f546 r19a1800  
    2727 */
    2828
    29 /** @addtogroup usb
     29/** @addtogroup drvusbvhc
    3030 * @{
    3131 */
     
    3838#include <errno.h>
    3939#include <str_error.h>
     40#include <assert.h>
    4041#include <stdlib.h>
    41 #include <driver.h>
    42 #include <usb/usbdrv.h>
     42#include <ddf/driver.h>
    4343
    4444#include "hub.h"
     
    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 *
     
    173195        }
    174196
    175         return 0;
     197        return -1;
    176198}
    177199
Note: See TracChangeset for help on using the changeset viewer.