vusb.h revision 7b067f3f07310bff46d1d6a4ac94d8b9bb7ccccd
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * VUSB - VirtualBox USB. (DEV,VMM)
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * available from http://www.virtualbox.org. This file is free software;
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * you can redistribute it and/or modify it under the terms of the GNU
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * General Public License (GPL) as published by the Free Software
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * The contents of this file may alternatively be used under the terms
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * of the Common Development and Distribution License Version 1.0
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * VirtualBox OSE distribution, in which case the provisions of the
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * CDDL are applicable instead of those of the GPL.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * You may elect to license modified versions of this file under the
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * terms and conditions of either the GPL or the CDDL or both.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * additional information or have any questions.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** @defgroup grp_vusb VBox USB API
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** @defgroup grp_vusb_std Standard Stuff
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Frequency of USB bus (from spec). */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** @name USB Descriptor types (from spec)
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** @name USB Descriptor minimum sizes (from spec)
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync#pragma pack(1) /* ensure byte packing of the descriptors. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * USB language id descriptor (from specs).
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a USB language id descriptor. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a const USB language id descriptor. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * USB string descriptor (from specs).
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a USB string descriptor. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a const USB string descriptor. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * USB device descriptor (from spec)
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a USB device descriptor. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a const USB device descriptor. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * USB configuration descriptor (from spec).
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync uint16_t wTotalLength; /**< recalculated by VUSB when involved in URB. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a USB configuration descriptor. */
b6415accd33648174afbfd16edc4dc0f894a6bf2vboxsync/** Pointer to a readonly USB configuration descriptor. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * USB interface descriptor (from spec)
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to an USB interface descriptor. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a const USB interface descriptor. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsynctypedef const VUSBDESCINTERFACE *PCVUSBDESCINTERFACE;
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * USB endpoint descriptor (from spec)
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to an USB endpoint descriptor. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a const USB endpoint descriptor. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * USB configuration descriptor, the parsed variant used by VUSB.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync /** The USB descriptor data.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @remark The wTotalLength member is recalculated before the data is passed to the guest. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync /** Pointer to additional descriptor bytes following what's covered by VUSBDESCCONFIG. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync /** Pointer to an array of the interfaces referenced in the configuration.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Core.bNumInterfaces in size. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a parsed USB configuration descriptor. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a const parsed USB configuration descriptor. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * For tracking the alternate interface settings of a configuration.
9cba9a10f12ba5184ad5d2a3ce05b0caba8d09favboxsync /** Pointer to an array of interfaces. */
9cba9a10f12ba5184ad5d2a3ce05b0caba8d09favboxsync /** The number of entries in the array. */
9cba9a10f12ba5184ad5d2a3ce05b0caba8d09favboxsync unsigned int num_settings;
9cba9a10f12ba5184ad5d2a3ce05b0caba8d09favboxsync/** Pointer to a VUSBINTERFACE. */
9cba9a10f12ba5184ad5d2a3ce05b0caba8d09favboxsync/** Pointer to a const VUSBINTERFACE. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * USB interface descriptor, the parsed variant used by VUSB.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync /** The USB descriptor data. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync /** Pointer to additional descriptor bytes following what's covered by VUSBDESCINTERFACE. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync /** Pointer to an array of the endpoints referenced by the interface.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Core.bNumEndpoints in size. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to an prased USB interface descriptor. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a const parsed USB interface descriptor. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsynctypedef const VUSBDESCINTERFACEEX *PCVUSBDESCINTERFACEEX;
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * USB endpoint descriptor, the parsed variant used by VUSB.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync /** The USB descriptor data.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @remark The wMaxPacketSize member is converted to native endian. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync /** Pointer to additional descriptor bytes following what's covered by VUSBDESCENDPOINT. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a parsed USB endpoint descriptor. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a const parsed USB endpoint descriptor. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsynctypedef const VUSBDESCENDPOINTEX *PCVUSBDESCENDPOINTEX;
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** @name USB Control message recipient codes (from spec)
938e0729a8e58abec28ef5e9cdb7bf1fabac6b58vboxsync/** @name USB control pipe setup packet structure (from spec)
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * USB Setup request (from spec)
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsynctypedef struct vusb_setup
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a setup request. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a const setup request. */
938e0729a8e58abec28ef5e9cdb7bf1fabac6b58vboxsync/** @name USB Standard device requests (from spec)
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** @name USB Standard version flags.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Indicates USB 1.1 support. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Indicates USB 2.0 support. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a VBox USB device interface. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a VUSB RootHub port interface. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to an USB request descriptor. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * VBox USB port bitmap.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Bit 0 == Port 0, ... , Bit 127 == Port 127.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync /** 128 bits */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a VBox USB port bitmap. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * The VUSB RootHub port interface provided by the HCI.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Get the number of avilable ports in the hub.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @returns The number of ports available.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pInterface Pointer to this structure.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pAvailable Bitmap indicating the available ports. Set bit == available port.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync DECLR3CALLBACKMEMBER(unsigned, pfnGetAvailablePorts,(PVUSBIROOTHUBPORT pInterface, PVUSBPORTBITMAP pAvailable));
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Gets the supported USB versions.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @returns The mask of supported USB versions.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pInterface Pointer to this structure.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync DECLR3CALLBACKMEMBER(uint32_t, pfnGetUSBVersions,(PVUSBIROOTHUBPORT pInterface));
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * A device is being attached to a port in the roothub.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pInterface Pointer to this structure.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pDev Pointer to the device being attached.
7f581f9444a4d569475da724d7fde45b9a225899vboxsync * @param uPort The port number assigned to the device.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync DECLR3CALLBACKMEMBER(int, pfnAttach,(PVUSBIROOTHUBPORT pInterface, PVUSBIDEVICE pDev, unsigned uPort));
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * A device is being detached from a port in the roothub.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pInterface Pointer to this structure.
7f581f9444a4d569475da724d7fde45b9a225899vboxsync * @param pDev Pointer to the device being detached.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param uPort The port number assigned to the device.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync DECLR3CALLBACKMEMBER(void, pfnDetach,(PVUSBIROOTHUBPORT pInterface, PVUSBIDEVICE pDev, unsigned uPort));
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Reset the root hub.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @returns VBox status code.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pInterface Pointer to this structure.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pResetOnLinux Whether or not to do real reset on linux.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync DECLR3CALLBACKMEMBER(int, pfnReset,(PVUSBIROOTHUBPORT pInterface, bool fResetOnLinux));
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Transfer completion callback routine.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * VUSB will call this when a transfer have been completed
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * in a one or another way.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pInterface Pointer to this structure.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pUrb Pointer to the URB in question.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync DECLR3CALLBACKMEMBER(void, pfnXferCompletion,(PVUSBIROOTHUBPORT pInterface, PVUSBURB urb));
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Handle transfer errors.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * VUSB calls this when a transfer attempt failed. This function will respond
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * indicating wheter to retry or complete the URB with failure.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @returns Retry indicator.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pInterface Pointer to this structure.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pUrb Pointer to the URB in question.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync DECLR3CALLBACKMEMBER(bool, pfnXferError,(PVUSBIROOTHUBPORT pInterface, PVUSBURB pUrb));
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync /** Alignment dummy. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a VUSB RootHub connector interface. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsynctypedef struct VUSBIROOTHUBCONNECTOR *PVUSBIROOTHUBCONNECTOR;
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * The VUSB RootHub connector interface provided by the VBox USB RootHub driver.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Allocates a new URB for a transfer.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Either submit using pfnSubmitUrb or free using VUSBUrbFree().
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @returns Pointer to a new URB.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @returns NULL on failure - try again later.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * This will not fail if the device wasn't found. We'll fail it
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * at submit time, since that makes the usage of this api simpler.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pInterface Pointer to this struct.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param DstAddress The destination address of the URB.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param cbData The amount of data space required.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param cTds The amount of TD space.
b65d53aa41a5d4f584a5ae6833c741dad0a4da43vboxsync DECLR3CALLBACKMEMBER(PVUSBURB, pfnNewUrb,(PVUSBIROOTHUBCONNECTOR pInterface, uint8_t DstAddress, uint32_t cbData, uint32_t cTds));
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Submits a URB for transfer.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * The transfer will do asynchronously if possible.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @returns VBox status code.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pInterface Pointer to this struct.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pUrb Pointer to the URB returned by pfnNewUrb.
7f581f9444a4d569475da724d7fde45b9a225899vboxsync * The URB will be freed in case of failure.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pLed Pointer to USB Status LED
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync DECLR3CALLBACKMEMBER(int, pfnSubmitUrb,(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBURB pUrb, struct PDMLED *pLed));
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Call to service asynchronous URB completions in a polling fashion.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Reaped URBs will be finished by calling the completion callback,
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * thus there is no return code or input or anything from this function
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * except for potential state changes elsewhere.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @returns VINF_SUCCESS if no URBs are pending upon return.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @returns VERR_TIMEOUT if one or more URBs are still in flight upon returning.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @returns Other VBox status code.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pInterface Pointer to this struct.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param cMillies Number of milliseconds to poll for completion.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync DECLR3CALLBACKMEMBER(void, pfnReapAsyncUrbs,(PVUSBIROOTHUBCONNECTOR pInterface, RTMSINTERVAL cMillies));
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Cancels and completes - with CRC failure - all in-flight async URBs.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * This is typically done before saving a state.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pInterface Pointer to this struct.
b6415accd33648174afbfd16edc4dc0f894a6bf2vboxsync DECLR3CALLBACKMEMBER(void, pfnCancelAllUrbs,(PVUSBIROOTHUBCONNECTOR pInterface));
7f581f9444a4d569475da724d7fde45b9a225899vboxsync * Attach the device to the root hub.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * The device must not be attached to any hub for this call to succeed.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @returns VBox status code.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pInterface Pointer to this struct.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pDevice Pointer to the device (interface) attach.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync DECLR3CALLBACKMEMBER(int, pfnAttachDevice,(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBIDEVICE pDevice));
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Detach the device from the root hub.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * The device must already be attached for this call to succeed.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @returns VBox status code.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pInterface Pointer to this struct.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pDevice Pointer to the device (interface) to detach.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync DECLR3CALLBACKMEMBER(int, pfnDetachDevice,(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBIDEVICE pDevice));
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** @copydoc VUSBIROOTHUBCONNECTOR::pfnNewUrb */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsyncDECLINLINE(PVUSBURB) VUSBIRhNewUrb(PVUSBIROOTHUBCONNECTOR pInterface, uint32_t DstAddress, uint32_t cbData, uint32_t cTds)
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync return pInterface->pfnNewUrb(pInterface, DstAddress, cbData, cTds);
b6415accd33648174afbfd16edc4dc0f894a6bf2vboxsync/** @copydoc VUSBIROOTHUBCONNECTOR::pfnSubmitUrb */
b6415accd33648174afbfd16edc4dc0f894a6bf2vboxsyncDECLINLINE(int) VUSBIRhSubmitUrb(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBURB pUrb, struct PDMLED *pLed)
b6415accd33648174afbfd16edc4dc0f894a6bf2vboxsync return pInterface->pfnSubmitUrb(pInterface, pUrb, pLed);
b6415accd33648174afbfd16edc4dc0f894a6bf2vboxsync/** @copydoc VUSBIROOTHUBCONNECTOR::pfnReapAsyncUrbs */
b6415accd33648174afbfd16edc4dc0f894a6bf2vboxsyncDECLINLINE(void) VUSBIRhReapAsyncUrbs(PVUSBIROOTHUBCONNECTOR pInterface, RTMSINTERVAL cMillies)
b6415accd33648174afbfd16edc4dc0f894a6bf2vboxsync pInterface->pfnReapAsyncUrbs(pInterface, cMillies);
b6415accd33648174afbfd16edc4dc0f894a6bf2vboxsync/** @copydoc VUSBIROOTHUBCONNECTOR::pfnCancelAllUrbs */
b6415accd33648174afbfd16edc4dc0f894a6bf2vboxsyncDECLINLINE(void) VUSBIRhCancelAllUrbs(PVUSBIROOTHUBCONNECTOR pInterface)
b6415accd33648174afbfd16edc4dc0f894a6bf2vboxsync/** @copydoc VUSBIROOTHUBCONNECTOR::pfnAttachDevice */
b6415accd33648174afbfd16edc4dc0f894a6bf2vboxsyncDECLINLINE(int) VUSBIRhAttachDevice(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBIDEVICE pDevice)
b6415accd33648174afbfd16edc4dc0f894a6bf2vboxsync return pInterface->pfnAttachDevice(pInterface, pDevice);
b6415accd33648174afbfd16edc4dc0f894a6bf2vboxsync/** @copydoc VUSBIROOTHUBCONNECTOR::pfnDetachDevice */
b6415accd33648174afbfd16edc4dc0f894a6bf2vboxsyncDECLINLINE(int) VUSBIRhDetachDevice(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBIDEVICE pDevice)
b6415accd33648174afbfd16edc4dc0f894a6bf2vboxsync return pInterface->pfnDetachDevice(pInterface, pDevice);
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync#endif /* IN_RING3 */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a Root Hub Configuration Interface. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Root Hub Configuration Interface (intended for MAIN).
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Creates a USB proxy device and attaches it to the root hub.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @returns VBox status code.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pInterface Pointer to the root hub configuration interface structure.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pUuid Pointer to the UUID for the new device.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param fRemote Whether the device must use the VRDP backend.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pszAddress OS specific device address.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pvBackend An opaque pointer for the backend. Only used by
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * the VRDP backend so far.
d6e0f6a5d8642c681e6d12d43fc0069da7a5dff6vboxsync DECLR3CALLBACKMEMBER(int, pfnCreateProxyDevice,(PVUSBIRHCONFIG pInterface, PCRTUUID pUuid, bool fRemote, const char *pszAddress, void *pvBackend));
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Removes a USB proxy device from the root hub and destroys it.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @returns VBox status code.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pInterface Pointer to the root hub configuration interface structure.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pUuid Pointer to the UUID for the device.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync DECLR3CALLBACKMEMBER(int, pfnDestroyProxyDevice,(PVUSBIRHCONFIG pInterface, PCRTUUID pUuid));
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** @copydoc VUSBIRHCONFIG::pfnCreateProxyDevice */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsyncDECLINLINE(int) VUSBIRhCreateProxyDevice(PVUSBIRHCONFIG pInterface, PCRTUUID pUuid, bool fRemote, const char *pszAddress, void *pvBackend)
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync return pInterface->pfnCreateProxyDevice(pInterface, pUuid, fRemote, pszAddress, pvBackend);
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** @copydoc VUSBIRHCONFIG::pfnDestroyProxyDevice */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsyncDECLINLINE(int) VUSBIRhDestroyProxyDevice(PVUSBIRHCONFIG pInterface, PCRTUUID pUuid)
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync return pInterface->pfnDestroyProxyDevice(pInterface, pUuid);
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync#endif /* IN_RING3 */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * VUSB device reset completion callback function.
938e0729a8e58abec28ef5e9cdb7bf1fabac6b58vboxsync * This is called by the reset thread when the reset has been completed.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pDev Pointer to the virtual USB device core.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param rc The VBox status code of the reset operation.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pvUser User specific argument.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @thread The reset thread or EMT.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsynctypedef DECLCALLBACK(void) FNVUSBRESETDONE(PVUSBIDEVICE pDevice, int rc, void *pvUser);
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync/** Pointer to a device reset completion callback function (FNUSBRESETDONE). */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * The state of a VUSB Device.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @remark The order of these states is vital.
938e0729a8e58abec28ef5e9cdb7bf1fabac6b58vboxsync /** The device is being reset. Don't mess with it.
938e0729a8e58abec28ef5e9cdb7bf1fabac6b58vboxsync * Next states: VUSB_DEVICE_STATE_DEFAULT, VUSB_DEVICE_STATE_DESTROYED
938e0729a8e58abec28ef5e9cdb7bf1fabac6b58vboxsync /** The device has been destroy. */
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync /** The usual 32-bit hack. */
133ac536a3d32062cf6b4c076da39da9e80f91a5vboxsync * USB Device Interface.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsynctypedef struct VUSBIDEVICE
133ac536a3d32062cf6b4c076da39da9e80f91a5vboxsync * Resets the device.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Since a device reset shall take at least 10ms from the guest point of view,
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * it must be performed asynchronously. We create a thread which performs this
133ac536a3d32062cf6b4c076da39da9e80f91a5vboxsync * operation and ensures it will take at least 10ms.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * At times - like init - a synchronous reset is required, this can be done
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * by passing NULL for pfnDone.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * -- internal stuff, move it --
133ac536a3d32062cf6b4c076da39da9e80f91a5vboxsync * While the device is being reset it is in the VUSB_DEVICE_STATE_RESET state.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * On completion it will be in the VUSB_DEVICE_STATE_DEFAULT state if successful,
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * or in the VUSB_DEVICE_STATE_DETACHED state if the rest failed.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * -- internal stuff, move it --
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @returns VBox status code.
133ac536a3d32062cf6b4c076da39da9e80f91a5vboxsync * @param pInterface Pointer to this structure.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param fResetOnLinux Set if we can permit a real reset and a potential logical
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * device reconnect on linux hosts.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pfnDone Pointer to the completion routine. If NULL a synchronous
133ac536a3d32062cf6b4c076da39da9e80f91a5vboxsync * reset is preformed not respecting the 10ms.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pvUser User argument to the completion routine.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pVM Pointer to the VM handle if callback in EMT is required. (optional)
133ac536a3d32062cf6b4c076da39da9e80f91a5vboxsync DECLR3CALLBACKMEMBER(int, pfnReset,(PVUSBIDEVICE pInterface, bool fResetOnLinux,
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Powers on the device.
133ac536a3d32062cf6b4c076da39da9e80f91a5vboxsync * @returns VBox status code.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @param pInterface Pointer to the device interface structure.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync DECLR3CALLBACKMEMBER(int, pfnPowerOn,(PVUSBIDEVICE pInterface));
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Powers off the device.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @returns VBox status code.
230bd8589bba39933ac5ec21482d6186d675e604vboxsync * @param pInterface Pointer to the device interface structure.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync DECLR3CALLBACKMEMBER(int, pfnPowerOff,(PVUSBIDEVICE pInterface));
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Get the state of the device.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * @returns Device state.
b65d53aa41a5d4f584a5ae6833c741dad0a4da43vboxsync * @param pInterface Pointer to the device interface structure.
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync DECLR3CALLBACKMEMBER(VUSBDEVICESTATE, pfnGetState,(PVUSBIDEVICE pInterface));
dab2041a9c063e43814b7b69538c2856cd78bd18vboxsync * Resets the device.
DECLINLINE(int) VUSBIDevReset(PVUSBIDEVICE pInterface, bool fResetOnLinux, PFNVUSBRESETDONE pfnDone, void *pvUser, PVM pVM)
typedef enum VUSBSTATUS
VUSBSTATUS_OK = 0,
} VUSBSTATUS;
typedef enum VUSBXFERTYPE
VUSBXFERTYPE_CTRL = 0,
} VUSBXFERTYPE;
typedef enum VUSBDIRECTION
VUSBDIRECTION_SETUP = 0,
typedef enum VUSBURBSTATE
VUSBURBSTATE_INVALID = 0,
} VUSBURBSTATE;
typedef struct VUSBURBISOCPKT
typedef struct VUSBURB
char *pszDesc;
struct VUSBURBVUSB
void *pvFreeCtx;
} VUsb;
struct VUSBURBHCI
struct VUSBURBHCITD
} *paTds;
bool fUnlinked;
} Hci;
struct VUSBURBDEV
void *pvProxyUrb;
} Dev;
bool fShortNotOk;
} VUSBURB;