tstHostHardwareLinux.cpp revision 531c00db9f8998c8b606845f72098698c48e6290
b0dfb334954c0552bb583967a3077ec88fd00471vboxsync * Test executable for quickly excercising/debugging the Linux host hardware
b0dfb334954c0552bb583967a3077ec88fd00471vboxsync * Copyright (C) 2008 Oracle Corporation
b0dfb334954c0552bb583967a3077ec88fd00471vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
b0dfb334954c0552bb583967a3077ec88fd00471vboxsync * available from http://www.virtualbox.org. This file is free software;
b0dfb334954c0552bb583967a3077ec88fd00471vboxsync * you can redistribute it and/or modify it under the terms of the GNU
b0dfb334954c0552bb583967a3077ec88fd00471vboxsync * General Public License (GPL) as published by the Free Software
b0dfb334954c0552bb583967a3077ec88fd00471vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
b0dfb334954c0552bb583967a3077ec88fd00471vboxsyncint doHotplugEvent(VBoxMainHotplugWaiter *waiter, RTMSINTERVAL cMillies)
b0dfb334954c0552bb583967a3077ec88fd00471vboxsync while (true)
b0dfb334954c0552bb583967a3077ec88fd00471vboxsync RTPrintf("Failed to update the host drive information, error %Rrc\n",
b0dfb334954c0552bb583967a3077ec88fd00471vboxsync for (DriveInfoList::const_iterator it = driveInfo.FloppyBegin();
b0dfb334954c0552bb583967a3077ec88fd00471vboxsync RTPrintf (", description: %s", it->mDescription.c_str());
54828795a553ed0731f308ebda81675ad2c39d58vboxsync for (DriveInfoList::const_iterator it = driveInfo.DVDBegin();
50f0e2e83362e100d306a411980d555d46aa00a8vboxsync RTPrintf (", description: %s", it->mDescription.c_str());
b0dfb334954c0552bb583967a3077ec88fd00471vboxsync AssertReturn(VBoxMainUSBDevInfoInit(&deviceInfo), 1);
b0dfb334954c0552bb583967a3077ec88fd00471vboxsync RTPrintf ("Failed to update the host USB device information, error %Rrc\n",
80523be8dba75b5eb32569fd72ddf54f3b009025vboxsync USBDeviceInfoList_iter_init(&it, USBDevInfoBegin(&deviceInfo));
80523be8dba75b5eb32569fd72ddf54f3b009025vboxsync for (; !USBDeviceInfoList_iter_eq(&it, USBDevInfoEnd(&deviceInfo));
80523be8dba75b5eb32569fd72ddf54f3b009025vboxsync USBDeviceInfo *pInfo = USBDeviceInfoList_iter_target(&it);
80523be8dba75b5eb32569fd72ddf54f3b009025vboxsync if (RTLinuxSysFsReadStrFile(szProduct, sizeof(szProduct),
80523be8dba75b5eb32569fd72ddf54f3b009025vboxsync RTPrintf ("Failed to get the product name for device %s: error %s\n",
8d29e9dc0d280b7b26834132b9ce14a3a845a7fdvboxsync RTPrintf (" device: %s (%s), sysfs path: %s\n", szProduct, pInfo->mDevice,
8d29e9dc0d280b7b26834132b9ce14a3a845a7fdvboxsync USBInterfaceList_iter_init(&it2, USBInterfaceList_begin(&pInfo->mInterfaces));
5d05aa26ae1949e6f0bbc149d8b8e39495710ac7vboxsync for (; !USBInterfaceList_iter_eq(&it2, USBInterfaceList_end(&pInfo->mInterfaces));
5d05aa26ae1949e6f0bbc149d8b8e39495710ac7vboxsync ssize_t size = RTLinuxSysFsGetLinkDest(szDriver, sizeof(szDriver),
5d05aa26ae1949e6f0bbc149d8b8e39495710ac7vboxsync RTPrintf ("Failed to get the driver for interface %s of device %s: error %s\n",
8d29e9dc0d280b7b26834132b9ce14a3a845a7fdvboxsync if (RTLinuxSysFsExists("%s/driver", pszIf) != (size != -1))
b60e4b0625949fd68ed97f1353e2174c5b3192e5vboxsync RTPrintf ("RTLinuxSysFsExists did not return the expected value for the driver link of interface %s of device %s.\n",
8d29e9dc0d280b7b26834132b9ce14a3a845a7fdvboxsync u64InterfaceClass = RTLinuxSysFsReadIntFile(16, "%s/bInterfaceClass",
8d29e9dc0d280b7b26834132b9ce14a3a845a7fdvboxsync RTPrintf (" sysfs path: %s, driver: %s, interface class: 0x%x\n",
64e0c74b525c440a571ce06f3eb6234d75913d76vboxsync RTPrintf ("Waiting for a hotplug event for five seconds...\n");
64e0c74b525c440a571ce06f3eb6234d75913d76vboxsync RTPrintf ("Waiting for a hotplug event, Ctrl-C to abort...\n");
052deaa01d8fcd5cec4dff857833538940b751c3vboxsync RTPrintf ("Testing interrupting a hotplug event...\n");
052deaa01d8fcd5cec4dff857833538940b751c3vboxsync RTPrintf ("%s\n", rc == VERR_INTERRUPTED ? "Success!" : "Failed!");
052deaa01d8fcd5cec4dff857833538940b751c3vboxsync#endif /* VBOX_USB_WITH_SYSFS */