From 44ee97ac270d79c70093cbdc4ad6d9d55eb0c679 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Sat, 31 Oct 2009 16:12:02 +0100 Subject: Imported Upstream version 3.0.10-dfsg --- src/VBox/Main/linux/HostHardwareLinux.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/VBox/Main/linux/HostHardwareLinux.cpp') diff --git a/src/VBox/Main/linux/HostHardwareLinux.cpp b/src/VBox/Main/linux/HostHardwareLinux.cpp index c201120d9..d0dcdcd70 100644 --- a/src/VBox/Main/linux/HostHardwareLinux.cpp +++ b/src/VBox/Main/linux/HostHardwareLinux.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include /* for RTThreadSleep() */ #include @@ -212,10 +213,8 @@ int VBoxMainDriveInfo::updateFloppies () && (!success || testing())) rc = getDriveInfoFromHal(&mFloppyList, false /* isDVD */, &success); #endif /* VBOX_WITH_DBUS defined */ - if ( RT_SUCCESS(rc) - && RT_SUCCESS(VBoxLoadDBusLib()) - && (!success || testing())) - rc = getDriveInfoFromHal(&mFloppyList, false /* isDVD */, &success); + if ( RT_SUCCESS(rc) && (!success || testing())) + rc = getDriveInfoFromSysfs(&mFloppyList, false /* isDVD */, &success); /* As with the CDROMs, on Linux we have to take a multi-level approach * involving parsing the mount tables. As this is not bulletproof, we * give the user the chance to override the detection using an @@ -1086,6 +1085,7 @@ int halGetPropertyStringsVector (DBusConnection *pConnection, LogFlowFunc (("rc=%Rrc, halSuccess=%d\n", rc, halSuccess)); return rc; } +#endif /* RT_OS_LINUX && VBOX_WITH_DBUS */ /** * Send an SCSI INQUIRY command to a device and return selected information. @@ -1383,7 +1383,11 @@ int getDriveInfoFromSysfs(DriveInfoList *pList, bool isDVD, bool *pfSuccess) bool fSuccess; unsigned cFound = 0; + if (!RTPathExists("/sys")) + return VINF_SUCCESS; rc = RTDirOpen(&pDir, "/sys/block"); + /* This might mean that sysfs semantics have changed */ + AssertReturn(rc != VERR_FILE_NOT_FOUND, VINF_SUCCESS); if (RT_SUCCESS(rc)) while (true) { @@ -1422,6 +1426,8 @@ int getDriveInfoFromSysfs(DriveInfoList *pList, bool isDVD, bool *pfSuccess) return rc; } +#if defined(RT_OS_LINUX) && defined(VBOX_WITH_DBUS) + /** * Helper function to query the hal subsystem for information about drives * attached to the system. -- cgit v1.2.3