Changeset 16137 in vbox for trunk/src/VBox/Main/linux/HostHardwareLinux.cpp
- Timestamp:
- Jan 21, 2009 1:55:57 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 41863
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/linux/HostHardwareLinux.cpp
r16093 r16137 85 85 const char *pszKey, const char *pszValue, 86 86 RTMemAutoPtr <DBusMessage, VBoxDBusMessageUnref> *pMessage); 87 static bool dbusMessageIsNonEmptyArray(DBusMessage *pMessage);88 87 static int halGetPropertyStrings (DBusConnection *pConnection, 89 88 const char *pszUdi, size_t cKeys, … … 194 193 try 195 194 { 195 bool halSuccess = false; 196 196 mDeviceList.clear(); 197 197 #if defined(RT_OS_LINUX) 198 198 #ifdef VBOX_WITH_DBUS 199 199 if (RT_SUCCESS (rc) && VBoxDBusCheckPresence() && (!success || testing())) 200 rc = getUSBDeviceInfoFromHal(&mDeviceList, &success); 201 if (RT_SUCCESS (rc) && VBoxDBusCheckPresence() && (!success || testing())) 202 rc = getOldUSBDeviceInfoFromHal(&mDeviceList, &success); 200 rc = getUSBDeviceInfoFromHal(&mDeviceList, &halSuccess); 201 /* Try the old API if the new one *succeeded* as only one of them will 202 * pick up devices anyway. */ 203 if (RT_SUCCESS (rc) && halSuccess && (!success || testing())) 204 rc = getOldUSBDeviceInfoFromHal(&mDeviceList, &halSuccess); 205 if (!success) 206 success = halSuccess; 203 207 #endif /* VBOX_WITH_DBUS defined */ 204 208 #endif /* RT_OS_LINUX */ … … 740 744 741 745 /** 742 * Checks whether a message is a non-empty array or something else.743 * @returns true if it is, false otherwise.744 */745 /* static */746 bool dbusMessageIsNonEmptyArray(DBusMessage *pMessage)747 {748 bool fSuccess = true;749 DBusMessageIter iterArray, iterItems;750 dbus_message_iter_init (pMessage, &iterArray);751 if (dbus_message_iter_get_arg_type (&iterArray) != DBUS_TYPE_ARRAY)752 fSuccess = false;753 if (fSuccess)754 dbus_message_iter_recurse (&iterArray, &iterItems);755 if (fSuccess && dbus_message_iter_get_arg_type (&iterItems) == DBUS_TYPE_INVALID)756 fSuccess = false;757 return fSuccess;758 }759 760 /**761 746 * Read a set of string properties for a device. If some of the properties are 762 747 * not of type DBUS_TYPE_STRING then a NULL pointer will be returned for them. … … 988 973 rc = halGetPropertyStrings (dbusConnection.get(), pszUdi, RT_ELEMENTS (papszKeys), 989 974 papszKeys, papszValues, &replyGet); 990 std::string description;991 975 const char *pszDevice = papszValues[0], *pszSysfsPath = papszValues[1]; 992 976 /* Get the interfaces. */ … … 1063 1047 const char *pszUdi; 1064 1048 dbus_message_iter_get_basic (&iterUdis, &pszUdi); 1065 static const char *papszKeys[] = { "linux.device_file", "linux.sysfs_path", 1066 "info.parent" }; 1049 static const char *papszKeys[] = { "linux.device_file", "info.parent" }; 1067 1050 char *papszValues[RT_ELEMENTS (papszKeys)]; 1068 1051 rc = halGetPropertyStrings (dbusConnection.get(), pszUdi, RT_ELEMENTS (papszKeys), 1069 1052 papszKeys, papszValues, &replyGet); 1070 std::string description; 1071 const char *pszDevice = papszValues[0], *pszSysfsPath = papszValues[1], 1072 *pszParent = papszValues[2]; 1053 const char *pszDevice = papszValues[0], *pszSysfsPath = papszValues[1]; 1073 1054 /* Get the interfaces. */ 1074 1055 if (!!replyGet && pszDevice && pszSysfsPath) 1075 1056 { 1076 1057 USBDeviceInfo info (pszDevice, pszSysfsPath); 1077 bool ifaceSuccess = true; /* If we can't get the interfaces, just 1078 * skip this one device. */ 1079 rc = getUSBInterfacesFromHal (&info.mInterfaces, pszParent, &ifaceSuccess); 1058 bool ifaceSuccess = false; /* If we can't get the interfaces, just 1059 * skip this one device. */ 1060 rc = getUSBInterfacesFromHal (&info.mInterfaces, pszSysfsPath, 1061 &ifaceSuccess); 1080 1062 if (RT_SUCCESS(rc) && halSuccess && ifaceSuccess) 1081 1063 pList->push_back (info); … … 1152 1134 rc = halGetPropertyStrings (dbusConnection.get(), pszUdi, RT_ELEMENTS (papszKeys), 1153 1135 papszKeys, papszValues, &replyGet); 1154 std::string description;1155 1136 const char *pszSysfsPath = papszValues[0], *pszInfoSubsystem = papszValues[1], 1156 1137 *pszLinuxSubsystem = papszValues[2];
Note:
See TracChangeset
for help on using the changeset viewer.