VirtualBox

Changeset 7954 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Apr 14, 2008 3:50:37 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
29597
Message:

HostUSBDeviceState and HostUSBDeviceSubState typedefs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/HostUSBDeviceImpl.h

    r5999 r7954  
    2929class SessionMachine;
    3030class USBProxyService;
     31
     32/**
     33 * The unified state machine of HostUSBDevice.
     34 *
     35 * This is a super set of USBDEVICESTATE / USBDeviceState_T that
     36 * includes additional states for tracking state transitions.
     37 *
     38 * @remarks
     39 *  The CapturingForVM and CapturingForProxy states has been merged
     40 *  into Capturing with a destination state (AttachingToVM or HeldByProxy).
     41 *
     42 *  The DetachingFromVM state is a merge of DetachingFromVMToProxy and
     43 *  DetachingFromVMToHost and uses the destination state (HeldByProxy
     44 *  or ReleasingToHost) like Capturing.
     45 *
     46 *  The *AwaitingDetach and *AwaitingReattach substates (optionally used
     47 *  in Capturing, AttachingToVM, DetachingFromVM and ReleasingToHost) are
     48 *  implemented via a substate kHostUSBDeviceSubState.
     49 */
     50typedef enum
     51{
     52    /** The device is unsupported (HUB).
     53     * Next Host: PhysDetached.
     54     * Next VBox: No change permitted.
     55     */
     56    kHostUSBDeviceState_Unsupported = USBDEVICESTATE_UNSUPPORTED,
     57    /** The device is used exclusivly by the host or is inaccessible for some other reason.
     58     * Next Host: Capturable, Unused, PhysDetached.
     59     *            Run filters.
     60     * Next VBox: No change permitted.
     61     */
     62    kHostUSBDeviceState_UsedByHost = USBDEVICESTATE_USED_BY_HOST,
     63    /** The device is used by the host but can be captured.
     64     * Next Host: Unsupported, UsedByHost, Unused, PhysDetached.
     65     *            Run filters if Unused (for wildcard filters).
     66     * Next VBox: CapturingForVM, CapturingForProxy.
     67     */
     68    kHostUSBDeviceState_Capturable = USBDEVICESTATE_USED_BY_HOST_CAPTURABLE,
     69    /** The device is not used by the host and can be captured.
     70     * Next Host: UsedByHost, Capturable, PhysDetached
     71     *            Don't run any filters (done on state entry).
     72     * Next VBox: CapturingForVM, CapturingForProxy.
     73     */
     74    kHostUSBDeviceState_Unused = USBDEVICESTATE_UNUSED,
     75    /** The device is held captive by the proxy.
     76     * Next Host: PhysDetached
     77     * Next VBox: ReleasingHeld, AttachingToVM
     78     */
     79    kHostUSBDeviceState_HeldByProxy = USBDEVICESTATE_HELD_BY_PROXY,
     80    /** The device is in use by a VM.
     81     * Next Host: PhysDetachingFromVM
     82     * Next VBox: DetachingFromVM
     83     */
     84    kHostUSBDeviceState_UsedByVM = USBDEVICESTATE_USED_BY_GUEST,
     85    /** The device has been detach from both the host and VMs.
     86     * This is the final state. */
     87    kHostUSBDeviceState_PhysDetached = 9,
     88
     89
     90    /** The start of the transitional states. */
     91    kHostUSBDeviceState_FirstTransitional,
     92
     93    /** The device is being seized from the host, either for HeldByProxy or for AttachToVM.
     94     *
     95     * On some hosts we will need to re-enumerate the in which case the sub-state
     96     * is employed to track this progress. On others, this is synchronous or faked, and
     97     * will will then leave the device in this state and poke the service thread to do
     98     * the completion state change.
     99     *
     100     * Next Host: PhysDetached.
     101     * Next VBox: HeldByProxy or AttachingToVM on success,
     102     *            previous state (Unused or Capturable) or UsedByHost on failure.
     103     */
     104    kHostUSBDeviceState_Capturing = kHostUSBDeviceState_FirstTransitional,
     105
     106    /** The device is being released back to the host, following VM or Proxy usage.
     107     * Most hosts needs to re-enumerate the device and will therefore employ the
     108     * sub-state as during capturing. On the others we'll just leave it to the usb
     109     * service thread to advance the device state.
     110     *
     111     * Next Host: Unused, UsedByHost, Capturable.
     112     *            No filters.
     113     * Next VBox: PhysDetached (timeout), HeldByProxy (failure).
     114     */
     115    kHostUSBDeviceState_ReleasingToHost,
     116
     117    /** The device is being attached to a VM.
     118     *
     119     * This requires IPC to the VM and we will not advance the state until
     120     * that completes.
     121     *
     122     * Next Host: PhysDetachingFromVM.
     123     * Next VBox: UsedByGuest, HeldByProxy (failure).
     124     */
     125    kHostUSBDeviceState_AttachingToVM,
     126
     127    /** The device is being detached from a VM and will be returned to the proxy or host.
     128     *
     129     * This involves IPC and may or may not also require re-enumeration of the
     130     * device. Which means that it might transition directly into the ReleasingToHost state
     131     * because the client (VM) will do the actual re-enumeration.
     132     *
     133     * Next Host: PhysDetachingFromVM (?) or just PhysDetached.
     134     * Next VBox: ReleasingToHost, HeldByProxy.
     135     */
     136    kHostUSBDeviceState_DetachingFromVM,
     137
     138    /** The device has been physically removed while a VM used it.
     139     *
     140     * This is the device state while VBoxSVC is doing IPC to the client (VM) telling it
     141     * to detach it.
     142     *
     143     * Next Host: None.
     144     * Next VBox: PhysDetached
     145     */
     146    kHostUSBDeviceState_PhysDetachingFromVM
     147
     148} HostUSBDeviceState;
     149
     150
     151/**
     152 * Sub-state for dealing with device re-enumeration.
     153 */
     154typedef enum
     155{
     156    /** Not in any sub-state. */
     157    kHostUSBDeviceSubState_Default = 0,
     158    /** Awaiting a logical device detach following a device re-enumeration. */
     159    kHostUSBDeviceSubState_AwaitingDetach,
     160    /** Awaiting a logical device re-attach following a device re-enumeration. */
     161    kHostUSBDeviceSubState_AwaitingReAttach
     162} HostUSBDeviceSubState;
     163
    31164
    32165/**
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette