VirtualBox

Changeset 21713 in vbox


Ignore:
Timestamp:
Jul 17, 2009 9:48:26 PM (16 years ago)
Author:
vboxsync
Message:

Main/HostHardwareLinux: always allow the environment variable to override autodetection and use other methods of probing if hal finds no devices

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/linux/HostHardwareLinux.cpp

    r21436 r21713  
    125125        mDVDList.clear ();
    126126#if defined(RT_OS_LINUX)
     127        /* Always allow the user to override our auto-detection using an
     128         * environment variable. */
     129        if (RT_SUCCESS (rc) && (!success || testing()))
     130            rc = getDriveInfoFromEnv ("VBOX_CDROM", &mDVDList, true /* isDVD */,
     131                                      &success);
    127132#ifdef VBOX_WITH_DBUS
    128133        if (RT_SUCCESS (rc) && RT_SUCCESS(VBoxLoadDBusLib()) && (!success || testing()))
    129134            rc = getDriveInfoFromHal(&mDVDList, true /* isDVD */, &success);
    130135#endif /* VBOX_WITH_DBUS defined */
    131         // On Linux without hal, the situation is much more complex. We will take a
    132         // heuristical approach and also allow the user to specify a list of host
    133         // CDROMs using an environment variable.
    134         // The general strategy is to try some known device names and see of they
    135         // exist. At last, we'll enumerate the /etc/fstab file (luckily there's an
    136         // API to parse it) for CDROM devices. Ok, let's start!
    137         if (RT_SUCCESS (rc) && (!success || testing()))
    138             rc = getDriveInfoFromEnv ("VBOX_CDROM", &mDVDList, true /* isDVD */,
    139                                       &success);
     136        /* On Linux without hal, the situation is much more complex. We will
     137         * take a heuristical approach.  The general strategy is to try some
     138         * known device names and see of they exist.  Failing that, we
     139         * enumerate the /etc/fstab file (luckily there's an API to parse it)
     140         * for CDROM devices. Ok, let's start! */
    140141        if (RT_SUCCESS (rc) && (!success || testing()))
    141142        {
     
    170171        mFloppyList.clear ();
    171172#if defined(RT_OS_LINUX)
     173        if (RT_SUCCESS (rc) && (!success || testing()))
     174            rc = getDriveInfoFromEnv ("VBOX_FLOPPY", &mFloppyList, false /* isDVD */,
     175                                      &success);
    172176#ifdef VBOX_WITH_DBUS
    173177        if (   RT_SUCCESS (rc)
     
    176180            rc = getDriveInfoFromHal(&mFloppyList, false /* isDVD */, &success);
    177181#endif /* VBOX_WITH_DBUS defined */
    178         // As with the CDROMs, on Linux we have to take a multi-level approach
    179         // involving parsing the mount tables. As this is not bulletproof, we'll
    180         // give the user the chance to override the detection by an environment
    181         // variable and skip the detection.
    182         if (RT_SUCCESS (rc) && (!success || testing()))
    183             rc = getDriveInfoFromEnv ("VBOX_FLOPPY", &mFloppyList, false /* isDVD */,
    184                                       &success);
     182        /* As with the CDROMs, on Linux we have to take a multi-level approach
     183         * involving parsing the mount tables. As this is not bulletproof, we
     184         * give the user the chance to override the detection using an
     185         * environment variable, skiping the detection. */
    185186
    186187        if (RT_SUCCESS (rc) && (!success || testing()))
     
    11201121        if (dbusError.HasName (DBUS_ERROR_NO_MEMORY))
    11211122            rc = VERR_NO_MEMORY;
     1123        /* If we found nothing something may have gone wrong with hal, so
     1124         * report failure to fall back to other methods. */
     1125        if (pList->size() == 0)
     1126            halSuccess = false;
    11221127        if (pfSuccess != NULL)
    11231128            *pfSuccess = halSuccess;
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