Changeset 28313 in vbox for trunk/src/VBox
- Timestamp:
- Apr 14, 2010 4:00:52 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/linux/HostHardwareLinux.cpp
r28312 r28313 853 853 } 854 854 855 /** 856 * Helper function to query the sysfs subsystem for information about USB 857 * devices attached to the system. 858 * @returns iprt status code 859 * @param pList where to add information about the drives detected 860 * @param pfSuccess Did we find anything? 861 * 862 * @returns IPRT status code 863 */ 864 static int getUSBDeviceInfoFromSysfs(USBDeviceInfoList *pList, 865 bool *pfSuccess) 866 { 867 AssertPtrReturn(pList, VERR_INVALID_POINTER); 868 AssertPtrNullReturn(pfSuccess, VERR_INVALID_POINTER); /* Valid or Null */ 869 LogFlowFunc (("pList=%p, pfSuccess=%p\n", 870 pList, pfSuccess)); 871 size_t cDevices = pList->size(); 872 matchUSBDevice devHandler(pList); 873 int rc = getDeviceInfoFromSysfs("/sys/bus/usb/devices", &devHandler); 874 do { 875 if (RT_FAILURE(rc)) 876 break; 877 for (USBDeviceInfoList::iterator pInfo = pList->begin(); 878 pInfo != pList->end(); ++pInfo) 879 { 880 matchUSBInterface ifaceHandler(&*pInfo); 881 rc = getDeviceInfoFromSysfs("/sys/bus/usb/devices", &ifaceHandler); 882 if (RT_FAILURE(rc)) 883 break; 884 } 885 } while(0); 886 if (RT_FAILURE(rc)) 887 /* Clean up again */ 888 while (pList->size() > cDevices) 889 pList->pop_back(); 890 if (pfSuccess) 891 *pfSuccess = RT_SUCCESS(rc); 892 LogFlow (("rc=%Rrc\n", rc)); 893 return rc; 894 } 855 895 856 896 /** Structure for holding information about a drive we have found */ … … 1980 2020 } 1981 2021 }; 1982 1983 /**1984 * Helper function to query the sysfs subsystem for information about USB1985 * devices attached to the system.1986 * @returns iprt status code1987 * @param pList where to add information about the drives detected1988 * @param pfSuccess Did we find anything?1989 *1990 * @returns IPRT status code1991 */1992 static int getUSBDeviceInfoFromSysfs(USBDeviceInfoList *pList,1993 bool *pfSuccess)1994 {1995 AssertPtrReturn(pList, VERR_INVALID_POINTER);1996 AssertPtrNullReturn(pfSuccess, VERR_INVALID_POINTER); /* Valid or Null */1997 LogFlowFunc (("pList=%p, pfSuccess=%p\n",1998 pList, pfSuccess));1999 size_t cDevices = pList->size();2000 matchUSBDevice devHandler(pList);2001 int rc = getDeviceInfoFromSysfs("/sys/bus/usb/devices", &devHandler);2002 do {2003 if (RT_FAILURE(rc))2004 break;2005 for (USBDeviceInfoList::iterator pInfo = pList->begin();2006 pInfo != pList->end(); ++pInfo)2007 {2008 matchUSBInterface ifaceHandler(&*pInfo);2009 rc = getDeviceInfoFromSysfs("/sys/bus/usb/devices", &ifaceHandler);2010 if (RT_FAILURE(rc))2011 break;2012 }2013 } while(0);2014 if (RT_FAILURE(rc))2015 /* Clean up again */2016 while (pList->size() > cDevices)2017 pList->pop_back();2018 if (pfSuccess)2019 *pfSuccess = RT_SUCCESS(rc);2020 LogFlow (("rc=%Rrc\n", rc));2021 return rc;2022 }2023 2024 2022 2025 2023 /**
Note:
See TracChangeset
for help on using the changeset viewer.