HostHardwareLinux.h revision c0704390ccf86cde88ad1e69dedf77d3e57aa15a
/* $Id$ */
/** @file
* Classes for handling hardware detection under Linux.
*
* Please feel free to expand these to work for other systems (Solaris!) or to
* add new ones for other systems.
*/
/*
* Copyright (C) 2008-2009 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#ifndef ____H_HOSTHARDWARELINUX
# define ____H_HOSTHARDWARELINUX
#include <vector>
/**
* Class for probing and returning information about host DVD and floppy
* drives. To use this class, create an instance, call one of the update
* methods to do the actual probing and use the iterator methods to get the
* result of the probe.
*/
{
/** Structure describing a host drive */
struct DriveInfo
{
/** The device node of the drive. */
/** A unique identifier for the device, if available. This should be
* kept consistant accross different probing methods of a given
* platform if at all possible. */
/** A textual description of the drive. */
/** Constructors */
{ }
};
/** List (resp vector) holding drive information */
/**
* Search for host floppy drives and rebuild the list, which remains empty
* until the first time this method is called.
* @returns iprt status code
*/
int updateFloppies();
/**
* Search for host DVD drives and rebuild the list, which remains empty
* until the first time this method is called.
* @returns iprt status code
*/
int updateDVDs();
/** Get the first element in the list of floppy drives. */
{
return mFloppyList.begin();
}
/** Get the last element in the list of floppy drives. */
{
return mFloppyList.end();
}
/** Get the first element in the list of DVD drives. */
{
}
/** Get the last element in the list of DVD drives. */
{
}
/** The list of currently available floppy drives */
/** The list of currently available DVD drives */
};
/** Convenience typedef. */
/** Convenience typedef. */
/**
* Class for probing and returning information about host USB devices.
* To use this class, create an instance, call the update methods to do the
* actual probing and use the iterator methods to get the result of the probe.
*/
{
/** Structure describing a host USB device */
struct USBDeviceInfo
{
/** The device node of the device. */
/** The system identifier of the device. Specific to the probing
* method. */
/** Type for the list of interfaces. */
/** The system IDs of the device's interfaces. */
/** Constructors */
{ }
};
/** List (resp vector) holding drive information */
/**
* Search for host USB devices and rebuild the list, which remains empty
* until the first time this method is called.
* @returns iprt status code
*/
int UpdateDevices ();
/** Get the first element in the list of USB devices. */
{
return mDeviceList.begin();
}
/** Get the last element in the list of USB devices. */
{
return mDeviceList.end();
}
/** The list of currently available USB devices */
};
/** Convenience typedef. */
/** Convenience typedef. */
/** Convenience typedef. */
/** Implementation of the hotplug waiter class below */
{
VBoxMainHotplugWaiterImpl (void) {}
virtual ~VBoxMainHotplugWaiterImpl (void) {}
/** @copydoc VBoxMainHotplugWaiter::Wait */
/** @copydoc VBoxMainHotplugWaiter::Interrupt */
};
/**
* Class for waiting for a hotplug event. To use this class, create an
* instance and call the @a Wait() method, which blocks until an event or a
* user-triggered interruption occurs. Call @a Interrupt() to interrupt the
* wait before an event occurs.
*/
{
/** Class implementation. */
/** Constructor. Responsible for selecting the implementation. */
VBoxMainHotplugWaiter (void);
/** Destructor. */
~VBoxMainHotplugWaiter (void)
{
}
/**
* Wait for a hotplug event.
*
* @returns VINF_SUCCESS if an event occurred or if Interrupt() was called.
* @returns VERR_TRY_AGAIN if the wait failed but this might (!) be a
* temporary failure.
* @returns VERR_NOT_SUPPORTED if the wait failed and will definitely not
* succeed if retried.
* @returns Possibly other iprt status codes otherwise.
* @param cMillies How long to wait for at most.
*/
{
}
/**
* Interrupts an active wait. In the current implementation, the wait
* may not return until up to two seconds after calling this method.
*/
void Interrupt (void)
{
}
};
#endif /* ____H_HOSTHARDWARELINUX */
/* vi: set tabstop=4 shiftwidth=4 expandtab: */