Changeset 31644 in vbox for trunk/src/VBox/Main/testcase
- Timestamp:
- Aug 13, 2010 12:47:07 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/testcase/tstHostHardwareLinux.cpp
r31564 r31644 92 92 #ifdef VBOX_USB_WITH_SYSFS 93 93 VBoxMainUSBDeviceInfo deviceInfo; 94 rc = deviceInfo.UpdateDevices(); 94 AssertReturn(VBoxMainUSBDevInfoInit(&deviceInfo), 1); 95 rc = USBDevInfoUpdateDevices(&deviceInfo); 95 96 if (RT_FAILURE(rc)) 96 97 { … … 100 101 } 101 102 RTPrintf ("Listing USB devices detected:\n"); 102 for (USBDeviceInfoList::const_iterator it = deviceInfo.DevicesBegin(); 103 it != deviceInfo.DevicesEnd(); ++it) 103 USBDeviceInfoList_iterator it; 104 USBDeviceInfoList_iter_init(&it, USBDevInfoBegin(&deviceInfo)); 105 for (; !USBDeviceInfoList_iter_eq(&it, USBDevInfoEnd(&deviceInfo)); 106 USBDeviceInfoList_iter_incr(&it)) 104 107 { 105 108 char szProduct[1024]; 109 USBDeviceInfo *pInfo = USBDeviceInfoList_iter_target(&it); 106 110 if (RTLinuxSysFsReadStrFile(szProduct, sizeof(szProduct), 107 "%s/product", it->mSysfsPath.c_str()) == -1)111 "%s/product", pInfo->mSysfsPath) == -1) 108 112 { 109 113 if (errno != ENOENT) 110 114 { 111 115 RTPrintf ("Failed to get the product name for device %s: error %s\n", 112 it->mDevice.c_str(), strerror(errno));116 pInfo->mDevice, strerror(errno)); 113 117 return 1; 114 118 } … … 116 120 szProduct[0] = '\0'; 117 121 } 118 RTPrintf (" device: %s (%s), sysfs path: %s\n", szProduct, it->mDevice.c_str(),119 it->mSysfsPath.c_str());122 RTPrintf (" device: %s (%s), sysfs path: %s\n", szProduct, pInfo->mDevice, 123 pInfo->mSysfsPath); 120 124 RTPrintf (" interfaces:\n"); 121 for (USBInterfaceList::const_iterator it2 = it->mInterfaces.begin(); 122 it2 != it->mInterfaces.end(); ++it2) 125 USBInterfaceList_iterator it2; 126 USBInterfaceList_iter_init(&it2, USBInterfaceList_begin(&pInfo->mInterfaces)); 127 for (; !USBInterfaceList_iter_eq(&it2, USBInterfaceList_end(&pInfo->mInterfaces)); 128 USBInterfaceList_iter_incr(&it2)) 123 129 { 124 130 char szDriver[RTPATH_MAX]; 131 char *pszIf = *USBInterfaceList_iter_target(&it2); 125 132 strcpy(szDriver, "none"); 126 133 ssize_t size = RTLinuxSysFsGetLinkDest(szDriver, sizeof(szDriver), 127 "%s/driver", it2->c_str());134 "%s/driver", pszIf); 128 135 if (size == -1 && errno != ENOENT) 129 136 { 130 137 RTPrintf ("Failed to get the driver for interface %s of device %s: error %s\n", 131 it2->c_str(), it->mDevice.c_str(), strerror(errno));138 pszIf, pInfo->mDevice, strerror(errno)); 132 139 return 1; 133 140 } 134 if (RTLinuxSysFsExists("%s/driver", it2->c_str()) != (size != -1))141 if (RTLinuxSysFsExists("%s/driver", pszIf) != (size != -1)) 135 142 { 136 143 RTPrintf ("RTLinuxSysFsExists did not return the expected value for the driver link of interface %s of device %s.\n", 137 it2->c_str(), it->mDevice.c_str());144 pszIf, pInfo->mDevice); 138 145 return 1; 139 146 } 140 147 uint64_t u64InterfaceClass; 141 148 u64InterfaceClass = RTLinuxSysFsReadIntFile(16, "%s/bInterfaceClass", 142 it2->c_str());149 pszIf); 143 150 RTPrintf (" sysfs path: %s, driver: %s, interface class: 0x%x\n", 144 it2->c_str(), szDriver, u64InterfaceClass);151 pszIf, szDriver, u64InterfaceClass); 145 152 } 146 153 }
Note:
See TracChangeset
for help on using the changeset viewer.