HostHardwareLinux.h revision 18456bfb9f30d08e5347aa108a2fef0c49c0ab0b
/* $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 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 <string>
#include <vector>
/** This should only be enabled when testing. It causes all methods to be used
* when probing for drives instead of stopping as soon as one method is
* successful. This is a global instead of a define in order to keep the test
* code closer to the real code. */
extern bool g_testHostHardwareLinux;
/**
* Class for probing and returning information about host DVD and floppy drives
*/
{
/** Structure describing a host drive */
struct DriveInfo
{
/** The device node of the drive. */
/** The hal unique device identifier, if available. */
/** A textual description of the drive. */
/** Constructors */
const char *aDescription = NULL)
const char *aDescription = NULL)
};
/** List (resp vector) holding drive information */
/**
* Search for host floppy drives and rebuild the list, which remains empty
* until the first time it is called.
* @returns iprt status code
*/
int updateFloppies ();
/**
* Search for host DVD drives and rebuild the list, which remains empty
* until the first time it 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 */
};
/**
* Class for probing and returning information about host USB devices
*/
{
/** Structure describing a host USB device */
struct USBDeviceInfo
{
/** The device node of the device. */
/** The sysfs path of the device. */
/** Type for the list of interfaces. */
/** The sysfs paths of the device's interfaces. */
/** Constructors */
USBDeviceInfo () {}
};
/** List (resp vector) holding drive information */
/**
* Search for host USB devices and rebuild the list, which remains empty
* until the first time it 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 */
};
{
/** Opaque context struct. */
struct Context;
/** Opaque waiter context. */
/** Constructor */
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. */
void Interrupt (void);
};
#endif /* ____H_HOSTHARDWARELINUX */