Changeset 32258 in vbox for trunk/src/VBox/Main/testcase
- Timestamp:
- Sep 6, 2010 8:33:08 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/testcase/tstHostHardwareLinux.cpp
r32142 r32258 92 92 #ifdef VBOX_USB_WITH_SYSFS 93 93 VBoxMainUSBDeviceInfo deviceInfo; 94 AssertR eturn(VBoxMainUSBDevInfoInit(&deviceInfo), 1);94 AssertRCReturn(VBoxMainUSBDevInfoInit(&deviceInfo), 1); 95 95 rc = USBDevInfoUpdateDevices(&deviceInfo); 96 96 if (RT_FAILURE(rc)) … … 101 101 } 102 102 RTPrintf ("Listing USB devices detected:\n"); 103 USBDeviceInfoList_iterator it; 104 USBDeviceInfoList_iter_init(&it, USBDevInfoBegin(&deviceInfo)); 105 for (; !USBDeviceInfoList_iter_eq(&it, USBDevInfoEnd(&deviceInfo)); 106 USBDeviceInfoList_iter_incr(&it)) 103 USBDeviceInfo *pInfo; 104 VEC_FOR_EACH(&deviceInfo.mvecDevInfo, USBDeviceInfo, pInfo) 107 105 { 108 106 char szProduct[1024]; 109 USBDeviceInfo *pInfo = USBDeviceInfoList_iter_target(&it);110 107 if (RTLinuxSysFsReadStrFile(szProduct, sizeof(szProduct), 111 108 "%s/product", pInfo->mSysfsPath) == -1) … … 123 120 pInfo->mSysfsPath); 124 121 RTPrintf (" interfaces:\n"); 125 char *pszIf; 126 for (pszIf = USBDevInfoFirstInterface(pInfo->mInterfaces); pszIf; 127 pszIf = USBDevInfoNextInterface(pInfo->mInterfaces)) 122 char **ppszIf; 123 VEC_FOR_EACH(&pInfo->mvecpszInterfaces, char *, ppszIf) 128 124 { 129 125 char szDriver[RTPATH_MAX]; 130 126 strcpy(szDriver, "none"); 131 127 ssize_t size = RTLinuxSysFsGetLinkDest(szDriver, sizeof(szDriver), 132 "%s/driver", pszIf);128 "%s/driver", *ppszIf); 133 129 if (size == -1 && errno != ENOENT) 134 130 { 135 131 RTPrintf ("Failed to get the driver for interface %s of device %s: error %s\n", 136 pszIf, pInfo->mDevice, strerror(errno));132 *ppszIf, pInfo->mDevice, strerror(errno)); 137 133 return 1; 138 134 } 139 if (RTLinuxSysFsExists("%s/driver", pszIf) != (size != -1))135 if (RTLinuxSysFsExists("%s/driver", *ppszIf) != (size != -1)) 140 136 { 141 137 RTPrintf ("RTLinuxSysFsExists did not return the expected value for the driver link of interface %s of device %s.\n", 142 pszIf, pInfo->mDevice);138 *ppszIf, pInfo->mDevice); 143 139 return 1; 144 140 } 145 141 uint64_t u64InterfaceClass; 146 142 u64InterfaceClass = RTLinuxSysFsReadIntFile(16, "%s/bInterfaceClass", 147 pszIf);143 *ppszIf); 148 144 RTPrintf (" sysfs path: %s, driver: %s, interface class: 0x%x\n", 149 pszIf, szDriver, u64InterfaceClass);145 *ppszIf, szDriver, u64InterfaceClass); 150 146 } 151 147 }
Note:
See TracChangeset
for help on using the changeset viewer.