VirtualBox

Changeset 15468 in vbox


Ignore:
Timestamp:
Dec 14, 2008 3:54:21 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
40922
Message:

Main/USB: code documentation

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

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

    r15465 r15468  
    3636
    3737/**
    38  * Class for probing and returning information about host DVD and floppy drives
     38 * Class for probing and returning information about host DVD and floppy
     39 * drives.  To use this class, create an instance, call one of the update
     40 * methods to do the actual probing and use the iterator methods to get the
     41 * result of the probe.
    3942 */
    4043class VBoxMainDriveInfo
     
    6972    /**
    7073     * Search for host floppy drives and rebuild the list, which remains empty
    71      * until the first time it is called.
     74     * until the first time this method is called.
    7275     * @returns iprt status code
    7376     */
     
    7679    /**
    7780     * Search for host DVD drives and rebuild the list, which remains empty
    78      * until the first time it is called.
     81     * until the first time this method is called.
    7982     * @returns iprt status code
    8083     */
     
    111114};
    112115
     116/** Convenience typedef. */
    113117typedef VBoxMainDriveInfo::DriveInfoList DriveInfoList;
     118/** Convenience typedef. */
    114119typedef VBoxMainDriveInfo::DriveInfo DriveInfo;
    115120
    116121/**
    117  * Class for probing and returning information about host USB devices
     122 * Class for probing and returning information about host USB devices.
     123 * To use this class, create an instance, call the update methods to do the
     124 * actual probing and use the iterator methods to get the result of the probe.
    118125 */
    119126class VBoxMainUSBDeviceInfo
     
    143150    /**
    144151     * Search for host USB devices and rebuild the list, which remains empty
    145      * until the first time it is called.
     152     * until the first time this method is called.
    146153     * @returns iprt status code
    147154     */
     
    165172};
    166173
     174/** Convenience typedef. */
    167175typedef VBoxMainUSBDeviceInfo::DeviceInfoList USBDeviceInfoList;
     176/** Convenience typedef. */
    168177typedef VBoxMainUSBDeviceInfo::USBDeviceInfo USBDeviceInfo;
     178/** Convenience typedef. */
    169179typedef VBoxMainUSBDeviceInfo::USBDeviceInfo::InterfaceList USBInterfaceList;
    170180
     181/**
     182 * Class for waiting for a hotplug event.  To use this class, create an
     183 * instance and call the @a Wait() method, which blocks until an event or a
     184 * user-triggered interruption occurs.  Call @a Interrupt() to interrupt the
     185 * wait before an event occurs.
     186 */
    171187class VBoxMainHotplugWaiter
    172188{
     
    193209     */
    194210    int Wait (unsigned cMillies);
    195     /** Interrupts an active wait. */
     211    /**
     212     * Interrupts an active wait.  In the current implementation, the wait
     213     * may not return until up to two seconds after calling this method.
     214     */
    196215    void Interrupt (void);
    197216};
  • trunk/src/VBox/Main/include/vbox-dbus.h

    r15465 r15468  
    3535    const char *name;
    3636    const char *message;
    37     unsigned int dummy1 : 1; /**< placeholder */
    38     unsigned int dummy2 : 1; /**< placeholder */
    39     unsigned int dummy3 : 1; /**< placeholder */
    40     unsigned int dummy4 : 1; /**< placeholder */
    41     unsigned int dummy5 : 1; /**< placeholder */
    42     void *padding1; /**< placeholder */
     37    unsigned int dummy1 : 1;
     38    unsigned int dummy2 : 1;
     39    unsigned int dummy3 : 1;
     40    unsigned int dummy4 : 1;
     41    unsigned int dummy5 : 1;
     42    void *padding1;
    4343};
    4444struct DBusConnection;
     
    5151struct DBusMessageIter
    5252{
    53     void *dummy1;         /**< Don't use this */
    54     void *dummy2;         /**< Don't use this */
    55     dbus_uint32_t dummy3; /**< Don't use this */
    56     int dummy4;           /**< Don't use this */
    57     int dummy5;           /**< Don't use this */
    58     int dummy6;           /**< Don't use this */
    59     int dummy7;           /**< Don't use this */
    60     int dummy8;           /**< Don't use this */
    61     int dummy9;           /**< Don't use this */
    62     int dummy10;          /**< Don't use this */
    63     int dummy11;          /**< Don't use this */
    64     int pad1;             /**< Don't use this */
    65     int pad2;             /**< Don't use this */
    66     void *pad3;           /**< Don't use this */
     53    void *dummy1;
     54    void *dummy2;
     55    dbus_uint32_t dummy3;
     56    int dummy4;
     57    int dummy5;
     58    int dummy6;
     59    int dummy7;
     60    int dummy8;
     61    int dummy9;
     62    int dummy10;
     63    int dummy11;
     64    int pad1;
     65    int pad2;
     66    void *pad3;
    6767};
    6868typedef struct DBusMessageIter DBusMessageIter;
     
    7575typedef enum
    7676{
    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. */
     77  DBUS_HANDLER_RESULT_HANDLED,
     78  DBUS_HANDLER_RESULT_NOT_YET_HANDLED,
     79  DBUS_HANDLER_RESULT_NEED_MEMORY
    8480} DBusHandlerResult;
    8581
     
    123119extern DBusMessage *(*dbus_connection_pop_message)(DBusConnection *);
    124120
     121/**
     122 * Checks whether libdbus is present and if so loads all symbols we need.  This
     123 * should be called before making any calls to libdbus if that library is being
     124 * loaded at runtime.
     125 * @returns true if libdbus was found, false otherwise.
     126 */
    125127extern bool VBoxDBusCheckPresence(void);
     128/** Wrapper around dbus_connection_unref.  We need this to use it as a free
     129 * function in auto pointers, as a function pointer won't wash here. */
    126130extern void VBoxDBusConnectionUnref(DBusConnection *pConnection);
     131/** Wrapper around dbus_message_unref.  We need this to use it as a free
     132 * function in auto pointers, as a function pointer won't wash here. */
    127133extern void VBoxDBusMessageUnref(DBusMessage *pMessage);
    128134
  • trunk/src/VBox/Main/linux/HostHardwareLinux.cpp

    r15465 r15468  
    6565*******************************************************************************/
    6666
     67/** When waiting for hotplug events, we currently restart the wait after at
     68 * most this many milliseconds. */
    6769enum { DBUS_POLL_TIMEOUT = 2000 /* ms */ };
    6870
     
    7375static int getDVDInfoFromMTab(char *mountTable, DriveInfoList *pList);
    7476#ifdef VBOX_WITH_DBUS
    75 /* These must be extern to be used in the RTMemAutoPtr template */
     77/* These must be extern to be usable in the RTMemAutoPtr template */
    7678extern void halShutdown (DBusConnection *pConnection);
    7779extern void halShutdownPrivate (DBusConnection *pConnection);
     
    9597#endif  /* VBOX_WITH_DBUS */
    9698
    97 /**
    98  * Updates the list of host DVD drives.
    99  *
    100  * @returns iprt status code
    101  */
    10299int VBoxMainDriveInfo::updateDVDs ()
    103100{
     
    145142}
    146143
    147 /**
    148  * Updates the list of host floppy drives.
    149  *
    150  * @returns iprt status code
    151  */
    152144int VBoxMainDriveInfo::updateFloppies ()
    153145{
     
    192184}
    193185
    194 /**
    195  * Updates the list of host USB devices.
    196  *
    197  * @returns iprt status code
    198  */
    199186int VBoxMainUSBDeviceInfo::UpdateDevices ()
    200187{
     
    233220};
    234221
    235 /** Constructor */
     222/* This constructor sets up a private connection to the DBus daemon, connects
     223 * to the hal service and installs a filter which sets the mTriggered flag in
     224 * the Context structure when a device (not necessarily USB) is added or
     225 * removed. */
    236226VBoxMainHotplugWaiter::VBoxMainHotplugWaiter ()
    237227{
     
    263253}
    264254
    265 /** Destructor */
     255/* Destructor */
    266256VBoxMainHotplugWaiter::~VBoxMainHotplugWaiter ()
    267257{
     
    274264}
    275265
     266/* Currently this is implemented using a timed out wait on our private DBus
     267 * connection.  Because the connection is private we don't have to worry about
     268 * blocking other users. */
    276269int VBoxMainHotplugWaiter::Wait(unsigned cMillies)
    277270{
     
    304297}
    305298
     299/* Set a flag to tell the Wait not to resume next time it times out. */
    306300void VBoxMainHotplugWaiter::Interrupt()
    307301{
     
    519513
    520514#if defined(RT_OS_LINUX) && defined(VBOX_WITH_DBUS)
    521 /* Linux, load libdbus statically */
    522 
    523515/** Wrapper class around DBusError for automatic cleanup */
    524516class autoDBusError
     
    551543
    552544/**
    553  * Helper function for setting up a connection to hal
     545 * Helper function for setting up a connection to the DBus daemon and
     546 * registering with the hal service.
     547 *
     548 * @note If libdbus is being loaded at runtime then be sure to call
     549 *       VBoxDBusCheckPresence before calling this.
    554550 * @returns iprt status code
    555551 * @param   ppConnection  where to store the connection handle
     
    594590
    595591/**
    596  * Helper function for setting up a private connection to hal
     592 * Helper function for setting up a private connection to the DBus daemon and
     593 * registering with the hal service.  Private connections are considered
     594 * unsociable and should not be used unnecessarily (as per the DBus API docs).
     595 *
     596 * @note If libdbus is being loaded at runtime then be sure to call
     597 *       VBoxDBusCheckPresence before calling this.
    597598 * @returns iprt status code
    598599 * @param   pConnection  where to store the connection handle
     
    637638
    638639/**
    639  * Helper function for shutting down a connection to hal
     640 * Helper function for shutting down a connection to DBus and hal.
    640641 * @param   pConnection  the connection handle
    641642 */
     
    659660
    660661/**
    661  * Helper function for shutting down a connection to hal
     662 * Helper function for shutting down a private connection to DBus and hal.
    662663 * @param   pConnection  the connection handle
    663664 */
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