VirtualBox

Changeset 15401 in vbox for trunk/src/VBox/Main/include


Ignore:
Timestamp:
Dec 12, 2008 10:05:34 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
40850
Message:

Main: added USB to HostHardwareLinux.cpp

Location:
trunk/src/VBox/Main/include
Files:
2 edited

Legend:

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

    r14991 r15401  
    77
    88/*
    9  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     9 * Copyright (C) 2008 Sun Microsystems, Inc.
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2121 * additional information or have any questions.
    2222 */
     23
     24#ifndef ____H_HOSTHARDWARELINUX
     25# define ____H_HOSTHARDWARELINUX
    2326
    2427#include <iprt/err.h>
     
    111114typedef VBoxMainDriveInfo::DriveInfo DriveInfo;
    112115
     116/**
     117 * Class for probing and returning information about host USB devices
     118 */
     119class VBoxMainUSBDeviceInfo
     120{
     121public:
     122    /** Structure describing a host USB device */
     123    struct USBDeviceInfo
     124    {
     125        /** The device node of the device. */
     126        std::string mDevice;
     127        /** The sysfs path of the device. */
     128        std::string mSysfsPath;
     129        /** Type for the list of interfaces. */
     130        typedef std::vector <std::string> InterfaceList;
     131        /** The sysfs paths of the device's interfaces. */
     132        InterfaceList mInterfaces;
     133
     134        /** Constructors */
     135        USBDeviceInfo (std::string aDevice, std::string aSysfsPath)
     136            : mDevice (aDevice), mSysfsPath (aSysfsPath) {}
     137        USBDeviceInfo () {}
     138    };
     139   
     140    /** List (resp vector) holding drive information */
     141    typedef std::vector <USBDeviceInfo> DeviceInfoList;
     142
     143    /**
     144     * Search for host USB devices and rebuild the list, which remains empty
     145     * until the first time it is called.
     146     * @returns iprt status code
     147     */
     148    int UpdateDevices ();
     149
     150    /** Get the first element in the list of USB devices. */
     151    DeviceInfoList::const_iterator DevicesBegin()
     152    {
     153        return mDeviceList.begin();
     154    }
     155
     156    /** Get the last element in the list of USB devices. */
     157    DeviceInfoList::const_iterator DevicesEnd()
     158    {
     159        return mDeviceList.end();
     160    }
     161
     162private:
     163    /** The list of currently available USB devices */
     164    DeviceInfoList mDeviceList;
     165};
     166
     167typedef VBoxMainUSBDeviceInfo::DeviceInfoList USBDeviceInfoList;
     168typedef VBoxMainUSBDeviceInfo::USBDeviceInfo USBDeviceInfo;
     169typedef VBoxMainUSBDeviceInfo::USBDeviceInfo::InterfaceList USBInterfaceList;
     170
     171class VBoxMainHotplugWaiter
     172{
     173    /** Opaque context struct. */
     174    struct Context;
     175
     176    /** Opaque waiter context. */
     177    Context *mContext;
     178public:
     179    /** Constructor */
     180    VBoxMainHotplugWaiter (void);
     181    /** Destructor. */
     182    ~VBoxMainHotplugWaiter (void);
     183    /**
     184     * Wait for a hotplug event.
     185     *
     186     * @returns  VINF_SUCCESS if an event occurred or if Interrupt() was called.
     187     * @returns  VERR_TRY_AGAIN if the wait failed but this might (!) be a
     188     *           temporary failure.
     189     * @returns  VERR_NOT_SUPPORTED if the wait failed and will definitely not
     190     *           succeed if retried.
     191     * @returns  Possibly other iprt status codes otherwise.
     192     */
     193    int Wait (void);
     194    /** Interrupts an active wait. */
     195    void Interrupt (void);
     196};
     197
     198#endif /* ____H_HOSTHARDWARELINUX */
     199
  • trunk/src/VBox/Main/include/vbox-dbus.h

    r15058 r15401  
    2929#define LIB_DBUS_1_3 "libdbus-1.so.3"
    3030
    31 /** Types from the dbus header files which we need.  These are taken more or less
    32    verbatim from the DBus public interface header files. */
     31/** Types and defines from the dbus header files which we need.  These are
     32 * taken more or less verbatim from the DBus public interface header files. */
    3333struct DBusError
    3434{
     
    6868typedef struct DBusMessageIter DBusMessageIter;
    6969
    70 /** Defines from the dbus header files which we need.  These are taken more or less
    71     verbatim from the DBus public interface header files. */
    7270#define DBUS_ERROR_NO_MEMORY                  "org.freedesktop.DBus.Error.NoMemory"
    7371#define DBUS_TYPE_STRING        ((int) 's')
    7472#define DBUS_TYPE_ARRAY         ((int) 'a')
    7573#define DBUS_TYPE_DICT_ENTRY    ((int) 'e')
     74
     75typedef enum
     76{
     77  DBUS_HANDLER_RESULT_HANDLED,         /**< Message has had its effect - no need
     78 to run more handlers. */
     79  DBUS_HANDLER_RESULT_NOT_YET_HANDLED, /**< Message has not had any effect - see
     80 if other handlers want it. */
     81  DBUS_HANDLER_RESULT_NEED_MEMORY      /**< Need more memory in order to return
     82#DBUS_HANDLER_RESULT_HANDLED or #DBUS_HANDLER_RESULT_NOT_YET_HANDLED. Please try
     83 again later with more memory. */
     84} DBusHandlerResult;
     85
     86typedef DBusHandlerResult (*DBusHandleMessageFunction) (DBusConnection *,
     87                                                        DBusMessage *, void *);
     88typedef void (*DBusFreeFunction) (void *);
    7689
    7790/** The following are the symbols which we need from libdbus-1. */
     
    100113extern void (*dbus_message_iter_get_basic) (DBusMessageIter *, void *);
    101114extern dbus_bool_t (*dbus_message_iter_next) (DBusMessageIter *);
     115extern dbus_bool_t (*dbus_connection_add_filter) (DBusConnection *, DBusHandleMessageFunction,
     116                                                  void *, DBusFreeFunction);
     117extern void (*dbus_connection_remove_filter) (DBusConnection *, DBusHandleMessageFunction,
     118                                              void *);
     119extern dbus_bool_t (*dbus_connection_read_write_dispatch) (DBusConnection *, int);
     120extern dbus_bool_t (*dbus_message_is_signal) (DBusMessage *, const char *, const char *);
    102121
    103122extern bool VBoxDBusCheckPresence(void);
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