VirtualBox

Changeset 14991 in vbox for trunk


Ignore:
Timestamp:
Dec 4, 2008 3:17:33 PM (16 years ago)
Author:
vboxsync
Message:

Main: rework the Linux host drive code to use libdbus-1 directly instead of libhal

Location:
trunk/src/VBox/Main
Files:
2 added
5 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/HostImpl.cpp

    r14990 r14991  
    2424
    2525#ifdef RT_OS_LINUX
    26 # include <sys/types.h>
    27 # include <sys/stat.h>
    28 # include <unistd.h>
     26// # include <sys/types.h>
     27// # include <sys/stat.h>
     28// # include <unistd.h>
    2929# include <sys/ioctl.h>
    30 # include <fcntl.h>
    31 # include <mntent.h>
     30// # include <fcntl.h>
     31// # include <mntent.h>
    3232/* bird: This is a hack to work around conflicts between these linux kernel headers
    3333 *       and the GLIBC tcpip headers. They have different declarations of the 4
    3434 *       standard byte order functions. */
    35 # define _LINUX_BYTEORDER_GENERIC_H
    36 # include <linux/cdrom.h>
    37 # ifdef VBOX_WITH_LIBHAL
    38 #  include <libhal.h>
    39 /* These are defined by libhal.h and by VBox header files. */
    40 #  undef TRUE
    41 #  undef FALSE
    42 # endif
     35// # define _LINUX_BYTEORDER_GENERIC_H
     36// # include <linux/cdrom.h>
    4337# include <errno.h>
    4438# include <net/if.h>
     
    117111#include <iprt/param.h>
    118112#include <iprt/env.h>
     113#include <iprt/mem.h>
    119114#ifdef RT_OS_SOLARIS
    120115# include <iprt/path.h>
     
    298293    CHECK_READY();
    299294    std::list <ComObjPtr <HostDVDDrive> > list;
     295    HRESULT rc = S_OK;
    300296
    301297#if defined(RT_OS_WINDOWS)
     
    362358
    363359#elif defined(RT_OS_LINUX)
    364 #ifdef VBOX_WITH_LIBHAL
    365     if (!getDVDInfoFromHal(list)) /* Playing with #defines in this way is nasty, I know. */
    366 #endif /* VBOX_WITH_LIBHAL defined */
    367     // On Linux without hal, the situation is much more complex. We will take a
    368     // heuristical approach and also allow the user to specify a list of host
    369     // CDROMs using an environment variable.
    370     // The general strategy is to try some known device names and see of they
    371     // exist. At last, we'll enumerate the /etc/fstab file (luckily there's an
    372     // API to parse it) for CDROM devices. Ok, let's start!
    373 
    374     {
    375         if (RTEnvGet("VBOX_CDROM"))
    376         {
    377             char *cdromEnv = strdupa(RTEnvGet("VBOX_CDROM"));
    378             char *cdromDrive;
    379             cdromDrive = strtok(cdromEnv, ":"); /** @todo use strtok_r */
    380             while (cdromDrive)
    381             {
    382                 if (validateDevice(cdromDrive, true))
    383                 {
    384                     ComObjPtr <HostDVDDrive> hostDVDDriveObj;
    385                     hostDVDDriveObj.createObject();
    386                     hostDVDDriveObj->init (Bstr (cdromDrive));
    387                     list.push_back (hostDVDDriveObj);
    388                 }
    389                 cdromDrive = strtok(NULL, ":");
    390             }
    391         }
    392         else
    393         {
    394             // this is a good guess usually
    395             if (validateDevice("/dev/cdrom", true))
    396             {
    397                     ComObjPtr <HostDVDDrive> hostDVDDriveObj;
    398                     hostDVDDriveObj.createObject();
    399                     hostDVDDriveObj->init (Bstr ("/dev/cdrom"));
    400                     list.push_back (hostDVDDriveObj);
    401             }
    402 
    403             // check the mounted drives
    404             parseMountTable((char*)"/etc/mtab", list);
    405 
    406             // check the drives that can be mounted
    407             parseMountTable((char*)"/etc/fstab", list);
    408         }
    409     }
     360    if (RT_SUCCESS (mHostDrives.updateDVDs()))
     361        for (DriveInfoList::const_iterator it = mHostDrives.DVDBegin();
     362             SUCCEEDED (rc) && it != mHostDrives.DVDEnd(); ++it)       
     363        {
     364            ComObjPtr<HostDVDDrive> hostDVDDriveObj;
     365            Bstr device (it->mDevice.c_str());
     366            Bstr udi (it->mUdi.empty() ? NULL : it->mUdi.c_str());
     367            Bstr description (it->mDescription.empty() ? NULL : it->mDescription.c_str());
     368            if (device.isNull() || (!it->mUdi.empty() && udi.isNull()) ||
     369                (!it->mDescription.empty() && description.isNull()))
     370                rc = E_OUTOFMEMORY;
     371            if (SUCCEEDED (rc))
     372                rc = hostDVDDriveObj.createObject();
     373            if (SUCCEEDED (rc))
     374                rc = hostDVDDriveObj->init (device, udi, description);
     375            if (SUCCEEDED (rc))
     376                list.push_back(hostDVDDriveObj);
     377        }
    410378#elif defined(RT_OS_DARWIN)
    411379    PDARWINDVD cur = DarwinGetDVDDrives();
     
    431399    collection->init (list);
    432400    collection.queryInterfaceTo(drives);
    433     return S_OK;
     401    return rc;
    434402}
    435403
     
    448416
    449417    std::list <ComObjPtr <HostFloppyDrive> > list;
     418    HRESULT rc = S_OK;
    450419
    451420#ifdef RT_OS_WINDOWS
     
    470439    delete[] hostDrives;
    471440#elif defined(RT_OS_LINUX)
    472 #ifdef VBOX_WITH_LIBHAL
    473     if (!getFloppyInfoFromHal(list)) /* Playing with #defines in this way is nasty, I know. */
    474 #endif /* VBOX_WITH_LIBHAL defined */
    475     // As with the CDROMs, on Linux we have to take a multi-level approach
    476     // involving parsing the mount tables. As this is not bulletproof, we'll
    477     // give the user the chance to override the detection by an environment
    478     // variable and skip the detection.
    479 
    480     {
    481         if (RTEnvGet("VBOX_FLOPPY"))
    482         {
    483             char *floppyEnv = strdupa(RTEnvGet("VBOX_FLOPPY"));
    484             char *floppyDrive;
    485             floppyDrive = strtok(floppyEnv, ":");
    486             while (floppyDrive)
    487             {
    488                 // check if this is an acceptable device
    489                 if (validateDevice(floppyDrive, false))
    490                 {
    491                     ComObjPtr <HostFloppyDrive> hostFloppyDriveObj;
    492                     hostFloppyDriveObj.createObject();
    493                     hostFloppyDriveObj->init (Bstr (floppyDrive));
    494                     list.push_back (hostFloppyDriveObj);
    495                 }
    496                 floppyDrive = strtok(NULL, ":");
    497             }
    498         }
    499         else
    500         {
    501             // we assume that a floppy is always /dev/fd[x] with x from 0 to 7
    502             char devName[10];
    503             for (int i = 0; i <= 7; i++)
    504             {
    505                 sprintf(devName, "/dev/fd%d", i);
    506                 if (validateDevice(devName, false))
    507                 {
    508                     ComObjPtr <HostFloppyDrive> hostFloppyDriveObj;
    509                     hostFloppyDriveObj.createObject();
    510                     hostFloppyDriveObj->init (Bstr (devName));
    511                     list.push_back (hostFloppyDriveObj);
    512                 }
    513             }
    514         }
    515     }
     441    if (RT_SUCCESS (mHostDrives.updateFloppies()))
     442        for (DriveInfoList::const_iterator it = mHostDrives.FloppyBegin();
     443             SUCCEEDED (rc) && it != mHostDrives.FloppyEnd(); ++it)       
     444        {
     445            ComObjPtr<HostFloppyDrive> hostFloppyDriveObj;
     446            Bstr device (it->mDevice.c_str());
     447            Bstr udi (it->mUdi.empty() ? NULL : it->mUdi.c_str());
     448            Bstr description (it->mDescription.empty() ? NULL : it->mDescription.c_str());
     449            if (device.isNull() || (!it->mUdi.empty() && udi.isNull()) ||
     450                (!it->mDescription.empty() && description.isNull()))
     451                rc = E_OUTOFMEMORY;
     452            if (SUCCEEDED (rc))
     453                rc = hostFloppyDriveObj.createObject();
     454            if (SUCCEEDED (rc))
     455                rc = hostFloppyDriveObj->init (device, udi, description);
     456            if (SUCCEEDED (rc))
     457                list.push_back(hostFloppyDriveObj);
     458        }
    516459#else
    517460    /* PORTME */
     
    522465    collection->init (list);
    523466    collection.queryInterfaceTo(drives);
    524     return S_OK;
     467    return rc;
    525468}
    526469
     
    18761819////////////////////////////////////////////////////////////////////////////////
    18771820
    1878 #if defined(RT_OS_LINUX) && defined(VBOX_WITH_LIBHAL)
    1879 /* Linux, load libhal statically */
    1880 
    1881 /** Helper function for setting up a libhal context */
    1882 bool hostInitLibHal(DBusConnection **pDBusConnection,
    1883                     LibHalContext **pLibHalContext)
    1884 {
    1885     bool halSuccess = true;
    1886     DBusError dbusError;
    1887 
    1888     dbus_error_init (&dbusError);
    1889     DBusConnection *dbusConnection;
    1890     LibHalContext *libhalContext;
    1891     dbusConnection = dbus_bus_get (DBUS_BUS_SYSTEM, &dbusError);
    1892     if (dbusConnection == NULL)
    1893         halSuccess = false;
    1894     if (dbusConnection == NULL && !dbus_error_is_set (&dbusError))
    1895         LogRelFunc (("Unresolved error getting DBus connection.\n"));
    1896     if (halSuccess)
    1897     {
    1898         libhalContext = libhal_ctx_new();
    1899         if (libhalContext == NULL)
    1900             halSuccess = false;
    1901     }
    1902     if (   halSuccess
    1903         && !libhal_ctx_set_dbus_connection (libhalContext, dbusConnection))
    1904         halSuccess = false;
    1905     if (   halSuccess
    1906         && !libhal_ctx_init (libhalContext, &dbusError))
    1907     {
    1908         halSuccess = false;
    1909         if (!dbus_error_is_set (&dbusError))
    1910             LogRelFunc (("Unresolved error initialising the libhal context.\n"));
    1911     }
    1912     if (halSuccess)
    1913     {
    1914         *pDBusConnection = dbusConnection;
    1915         *pLibHalContext = libhalContext;
    1916     }
    1917     return halSuccess;
    1918 }
    1919 
    1920 /**
    1921  * Helper function to query the hal subsystem for information about DVD drives attached to the
    1922  * system.
    1923  *
    1924  * @returns true if information was successfully obtained, false otherwise
    1925  * @retval  list drives found will be attached to this list
    1926  */
    1927 bool Host::getDVDInfoFromHal(std::list <ComObjPtr <HostDVDDrive> > &list)
    1928 {
    1929     DBusConnection *dbusConnection;
    1930     LibHalContext *libhalContext;
    1931     int numDevices = 0;
    1932     char **halDevices = NULL;
    1933     bool halSuccess = hostInitLibHal (&dbusConnection, &libhalContext);
    1934     if (halSuccess)
    1935         halDevices = libhal_manager_find_device_string_match(libhalContext,
    1936                                                 "storage.drive_type", "cdrom",
    1937                                                 &numDevices, NULL);
    1938     /* Hal is installed and working, so if no devices are reported, assume
    1939        that there are none. */
    1940     for (int i = 0; halSuccess && i < numDevices; ++i)
    1941     {
    1942         char *devNode = libhal_device_get_property_string(libhalContext,
    1943                                 halDevices[i], "block.device", NULL);
    1944         Utf8Str description;
    1945         char *vendor = NULL, *product = NULL;
    1946         if (devNode != NULL)
    1947         {
    1948             vendor = libhal_device_get_property_string(libhalContext,
    1949                             halDevices[i], "info.vendor", NULL);
    1950             product =  libhal_device_get_property_string(libhalContext,
    1951                             halDevices[i], "info.product", NULL);
    1952             if ((product != 0 && product[0] != 0))
    1953             {
    1954                 if ((vendor != 0) && (vendor[0] != 0))
    1955                     description = Utf8StrFmt ("%s %s",
    1956                                               vendor, product);
    1957                 else
    1958                     description = product;
    1959             }
    1960             ComObjPtr <HostDVDDrive> hostDVDDriveObj;
    1961             hostDVDDriveObj.createObject();
    1962             if (!description.isNull ())
    1963                 hostDVDDriveObj->init (Bstr (devNode),
    1964                                        Bstr (halDevices[i]),
    1965                                        Bstr (description));
    1966             else
    1967                 hostDVDDriveObj->init (Bstr (devNode),
    1968                                        Bstr (halDevices[i]));
    1969             list.push_back (hostDVDDriveObj);
    1970             if (vendor != NULL)
    1971                 libhal_free_string(vendor);
    1972             if (product != NULL)
    1973                 libhal_free_string(product);
    1974             libhal_free_string(devNode);
    1975         }
    1976     }
    1977     if (halDevices != NULL)
    1978         libhal_free_string_array(halDevices);
    1979     if (halSuccess)
    1980         libhal_ctx_shutdown (libhalContext, NULL);
    1981     if (libhalContext != NULL)
    1982         libhal_ctx_free (libhalContext);
    1983     if (dbusConnection != NULL)
    1984         dbus_connection_unref (dbusConnection);
    1985     return halSuccess;
    1986 }
    1987 
    1988 /**
    1989  * Helper function to query the hal subsystem for information about floppy drives attached to the
    1990  * system.
    1991  *
    1992  * @returns true if information was successfully obtained, false otherwise
    1993  * @retval  list drives found will be attached to this list
    1994  */
    1995 bool Host::getFloppyInfoFromHal(std::list <ComObjPtr <HostFloppyDrive> > &list)
    1996 {
    1997     DBusConnection *dbusConnection;
    1998     LibHalContext *libhalContext;
    1999     int numDevices = 0;
    2000     char **halDevices = NULL;
    2001     bool halSuccess = hostInitLibHal (&dbusConnection, &libhalContext);
    2002     if (halSuccess)
    2003         halDevices = libhal_manager_find_device_string_match(libhalContext,
    2004                                                 "storage.drive_type", "floppy",
    2005                                                 &numDevices, NULL);
    2006     /* Hal is installed and working, so if no devices are reported, assume
    2007        that there are none. */
    2008     for (int i = 0; halSuccess && i < numDevices; ++i)
    2009     {
    2010         char *devNode = libhal_device_get_property_string(libhalContext,
    2011                                 halDevices[i], "block.device", NULL);
    2012         Utf8Str description;
    2013         char *vendor = NULL, *product = NULL;
    2014         if (devNode != NULL)
    2015         {
    2016             vendor = libhal_device_get_property_string(libhalContext,
    2017                             halDevices[i], "info.vendor", NULL);
    2018             product =  libhal_device_get_property_string(libhalContext,
    2019                             halDevices[i], "info.product", NULL);
    2020             if ((product != 0 && product[0] != 0))
    2021             {
    2022                 if ((vendor != 0) && (vendor[0] != 0))
    2023                     description = Utf8StrFmt ("%s %s",
    2024                                               vendor, product);
    2025                 else
    2026                     description = product;
    2027             }
    2028             ComObjPtr <HostFloppyDrive> hostFloppyDriveObj;
    2029             hostFloppyDriveObj.createObject();
    2030             if (!description.isNull ())
    2031                 hostFloppyDriveObj->init (Bstr (devNode),
    2032                                           Bstr (halDevices[i]),
    2033                                           Bstr (description));
    2034             else
    2035                 hostFloppyDriveObj->init (Bstr (devNode),
    2036                                           Bstr (halDevices[i]));
    2037             list.push_back (hostFloppyDriveObj);
    2038             if (vendor != NULL)
    2039                 libhal_free_string(vendor);
    2040             if (product != NULL)
    2041                 libhal_free_string(product);
    2042             libhal_free_string(devNode);
    2043         }
    2044     }
    2045     if (halDevices != NULL)
    2046         libhal_free_string_array(halDevices);
    2047     if (halSuccess)
    2048         libhal_ctx_shutdown (libhalContext, NULL);
    2049     if (libhalContext != NULL)
    2050         libhal_ctx_free (libhalContext);
    2051     if (dbusConnection != NULL)
    2052         dbus_connection_unref (dbusConnection);
    2053     return halSuccess;
    2054 }
    2055 
    2056 # elif defined(RT_OS_SOLARIS) && defined(VBOX_USE_LIBHAL)
     1821#if defined(RT_OS_SOLARIS) && defined(VBOX_USE_LIBHAL)
    20571822/* Solaris hosts, loading libhal at runtime */
    20581823
     
    23682133    return halSuccess;
    23692134}
    2370 #endif  /* VBOX_WITH_HAL and VBOX_USE_HAL */
    2371 
    2372 #if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS)
     2135#endif  /* RT_OS_SOLARIS and VBOX_USE_HAL */
     2136
     2137#if defined(RT_OS_SOLARIS)
    23732138
    23742139/**
     
    25342299    return retValue;
    25352300}
    2536 #endif // RT_OS_LINUX || RT_OS_SOLARIS
     2301#endif // RT_OS_SOLARIS
    25372302
    25382303#ifdef VBOX_WITH_USB
  • trunk/src/VBox/Main/Makefile.kmk

    r14909 r14991  
    197197        $(if $(VBOX_WITH_RESOURCE_USAGE_API),VBOX_WITH_RESOURCE_USAGE_API,) \
    198198        $(if $(VBOX_WITH_PDM_ASYNC_COMPLETION),VBOX_WITH_PDM_ASYNC_COMPLETION,) \
    199         $(if $(VBOX_WITH_LIBHAL),VBOX_WITH_LIBHAL,) \
     199        $(if $(VBOX_WITH_DBUS),VBOX_WITH_DBUS,) \
    200200        $(if $(VBOX_USB_WITH_SYSFS),VBOX_USB_WITH_SYSFS,)
    201201
     
    301301        win/VBoxSVC.rc
    302302
     303VBoxSVC_SOURCES.linux += \
     304        linux/HostHardwareLinux.cpp
     305
    303306VBoxSVC_SOURCES.solaris = \
    304307        linux/vbox-libhal.cpp \
     
    342345endif
    343346
    344 # libhal stuff for USB
    345 VBoxSVC_CFLAGS   += $(if $(VBOX_WITH_LIBHAL),$(VBOX_LIBHAL_CFLAGS),)
    346 VBoxSVC_CXXFLAGS += $(if $(VBOX_WITH_LIBHAL),$(VBOX_LIBHAL_CXXFLAGS),)
    347 VBoxSVC_LDFLAGS  += $(if $(VBOX_WITH_LIBHAL),$(VBOX_LIBHAL_LDFLAGS),)
     347# dbus stuff
     348VBoxSVC_CFLAGS   += $(if $(VBOX_WITH_DBUS),$(VBOX_DBUS_CFLAGS),)
     349VBoxSVC_CXXFLAGS += $(if $(VBOX_WITH_DBUS),$(VBOX_DBUS_CXXFLAGS),)
     350VBoxSVC_LDFLAGS  += $(if $(VBOX_WITH_DBUS),$(VBOX_DBUS_LDFLAGS),)
    348351
    349352win/VBoxSVC.rc_INCS  = $(PATH_VBoxSVC)
  • trunk/src/VBox/Main/include/HostImpl.h

    r14949 r14991  
    3636#ifdef RT_OS_WINDOWS
    3737# include "win/svchlp.h"
     38#endif
     39
     40#ifdef RT_OS_LINUX
     41# include <HostHardwareLinux.h>
    3842#endif
    3943
     
    132136private:
    133137
    134 #if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS)
    135 # if defined(VBOX_WITH_LIBHAL) || defined(VBOX_USE_LIBHAL)
     138#if defined(RT_OS_SOLARIS)
     139# if defined(VBOX_USE_LIBHAL)
    136140    bool getDVDInfoFromHal(std::list <ComObjPtr <HostDVDDrive> > &list);
    137141    bool getFloppyInfoFromHal(std::list <ComObjPtr <HostFloppyDrive> > &list);
     
    178182#endif /* VBOX_WITH_USB */
    179183
     184#ifdef RT_OS_LINUX
     185    /** Object with information about host drives */
     186    VBoxMainDriveInfo mHostDrives;
     187#endif
    180188    /* Features that can be queried with GetProcessorFeature */
    181189    BOOL fVTxAMDVSupported, fLongModeSupported, fPAESupported;
  • trunk/src/VBox/Main/testcase/Makefile.kmk

    r14730 r14991  
    3333        $(if $(VBOX_WITH_RESOURCE_USAGE_API),tstCollector,)
    3434  PROGRAMS.linux += \
    35         $(if $(VBOX_OSE),,$(if $(VBOX_USB_WITH_SYSFS),tstUSBLinux,))
     35        $(if $(VBOX_OSE),,tstHostHardwareLinux)
    3636 endif # !VBOX_WITH_TESTCASES
    3737endif # !VBOX_ONLY_SDK
     
    120120
    121121#
    122 # tstUSBLinux
     122# tstHostHardwareLinux
    123123#
    124 tstUSBLinux_TEMPLATE  = VBOXR3TSTEXE
    125 tstUSBLinux_SOURCES   = \
    126         tstUSBLinux.cpp \
    127         ../linux/USBProxyServiceLinux.cpp
    128 tstUSBLinux_INCS      = . ../include
    129 tstUSBLinux_DEFS      = \
     124tstHostHardwareLinux_TEMPLATE  = VBOXR3TSTEXE
     125tstHostHardwareLinux_SOURCES   = \
     126        tstHostHardwareLinux.cpp \
     127        ../linux/USBProxyServiceLinux.cpp \
     128        ../linux/HostHardwareLinux.cpp
     129tstHostHardwareLinux_INCS      = . ../include
     130tstHostHardwareLinux_DEFS      = \
    130131        VBOX_TEST_USB_LINUX \
    131132        $(if $(VBOX_WITHOUT_LINUX_COMPILER_H),VBOX_WITHOUT_LINUX_COMPILER_H,) \
     133        $(if $(VBOX_WITH_DBUS),VBOX_WITH_DBUS,) \
    132134        $(if $(VBOX_USB_WITH_SYSFS),VBOX_USB_WITH_SYSFS,)
    133 tstUSBLinux_LIBS     += $(PATH_OUT)/lib/USBLib.a
    134 tstUSBLinux_CFLAGS   += $(if $(VBOX_WITH_LIBHAL),$(VBOX_LIBHAL_CFLAGS),)
    135 tstUSBLinux_CXXFLAGS += $(if $(VBOX_WITH_LIBHAL),$(VBOX_LIBHAL_CXXFLAGS),)
    136 tstUSBLinux_LDFLAGS  += $(if $(VBOX_WITH_LIBHAL),$(VBOX_LIBHAL_LDFLAGS),)
     135tstHostHardwareLinux_LIBS     += $(PATH_OUT)/lib/USBLib.a
     136tstHostHardwareLinux_CFLAGS   += $(if $(VBOX_WITH_DBUS),$(VBOX_DBUS_CFLAGS),)
     137tstHostHardwareLinux_CXXFLAGS += $(if $(VBOX_WITH_DBUS),$(VBOX_DBUS_CXXFLAGS),)
     138tstHostHardwareLinux_LDFLAGS  += $(if $(VBOX_WITH_DBUS),$(VBOX_DBUS_LDFLAGS),)
    137139
    138140
  • trunk/src/VBox/Main/testcase/tstHostHardwareLinux.cpp

    r14933 r14991  
    1414 */
    1515
    16 #include "tstUSBLinux.h"
     16#ifdef VBOX_USB_WITH_SYSFS
     17# include "tstUSBLinux.h"
     18#endif
     19
     20#include <HostHardwareLinux.h>
    1721
    1822#include <VBox/err.h>
     
    2731{
    2832    RTR3Init();
     33#ifdef VBOX_USB_WITH_SYSFS
    2934    USBProxyServiceLinux service;
    3035    service.initSysfs();
     
    7479        }
    7580    }
     81#endif  /* VBOX_USB_WITH_SYSFS */
     82    VBoxMainDriveInfo driveInfo;
     83    g_testHostHardwareLinux = true;
     84    int rc = driveInfo.updateFloppies();
     85    if (RT_SUCCESS (rc))
     86        rc = driveInfo.updateDVDs();
     87    if (RT_FAILURE (rc))
     88    {
     89        RTPrintf("Failed to update the host drive information, error %Rrc\n",
     90                 rc);
     91        return 1;
     92    }
     93    RTPrintf ("Listing floppy drives detected:\n");
     94    for (VBoxMainDriveInfo::DriveInfoList::const_iterator it = driveInfo.FloppyBegin();
     95         it != driveInfo.FloppyEnd(); ++it)
     96    {
     97        RTPrintf ("  device: %s", it->mDevice.c_str());
     98        if (!it->mUdi.empty())
     99            RTPrintf (", udi: %s", it->mUdi.c_str());
     100        if (!it->mDescription.empty())
     101            RTPrintf (", description: %s", it->mDescription.c_str());
     102        RTPrintf ("\n");
     103    }
     104    RTPrintf ("Listing DVD drives detected:\n");
     105    for (VBoxMainDriveInfo::DriveInfoList::const_iterator it = driveInfo.DVDBegin();
     106         it != driveInfo.DVDEnd(); ++it)
     107    {
     108        RTPrintf ("  device: %s", it->mDevice.c_str());
     109        if (!it->mUdi.empty())
     110            RTPrintf (", udi: %s", it->mUdi.c_str());
     111        if (!it->mDescription.empty())
     112            RTPrintf (", description: %s", it->mDescription.c_str());
     113        RTPrintf ("\n");
     114    }
    76115    return 0;
    77116}
  • trunk/src/VBox/Main/testcase/tstUSBLinux.h

    r14711 r14991  
    2424
    2525#ifdef VBOX_USB_WITH_SYSFS
    26 # include "libhal.h"
     26# include <libhal.h>
    2727#endif
    2828
Note: See TracChangeset for help on using the changeset viewer.

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