Changeset 96572 in vbox for trunk/src/VBox/HostDrivers/VBoxUSB/win/testcase/USBTest.cpp
- Timestamp:
- Sep 1, 2022 8:36:22 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxUSB/win/testcase/USBTest.cpp
r96407 r96572 42 42 #include <iprt/win/setupapi.h> 43 43 #include <newdev.h> 44 44 45 #include <iprt/assert.h> 45 #include < iprt/err.h>46 #include <VBox/err.h> 46 47 #include <iprt/param.h> 47 48 #include <iprt/path.h> 49 #include <iprt/stream.h> 48 50 #include <iprt/string.h> 49 #include <VBox/err.h>50 #include <stdio.h>51 51 #include <VBox/usblib.h> 52 52 #include <VBox/VBoxDrvCfg-win.h> 53 53 54 55 /********************************************************************************************************************************* 56 * Global Variables * 57 *********************************************************************************************************************************/ 54 58 /** Handle to the open device. */ 55 59 static HANDLE g_hUSBMonitor = INVALID_HANDLE_VALUE; … … 57 61 static bool g_fStartedService = false; 58 62 63 59 64 /** 60 65 * Attempts to start the service, creating it if necessary. … … 83 88 int usbMonStopService(void) 84 89 { 85 printf("usbMonStopService\n"); 90 RTPrintf("usbMonStopService\n"); 91 86 92 /* 87 93 * Assume it didn't exist, so we'll create the service. … … 141 147 DWORD cbReturned = 0; 142 148 143 printf("usbLibReleaseDevice %x %x %x\n", usVendorId, usProductId, usRevision);149 RTPrintf("usbLibReleaseDevice %x %x %x\n", usVendorId, usProductId, usRevision); 144 150 145 151 release.usVendorId = usVendorId; … … 174 180 Assert(g_hUSBMonitor); 175 181 176 printf("usblibInsertFilter %04X %04X %04X\n", usVendorId, usProductId, usRevision);182 RTPrintf("usblibInsertFilter %04X %04X %04X\n", usVendorId, usProductId, usRevision); 177 183 178 184 USBFilterInit(&filter, USBFILTERTYPE_CAPTURE); … … 222 228 Assert(g_hUSBMonitor); 223 229 224 printf("usblibRemoveFilter %p\n", aID);230 RTPrintf("usblibRemoveFilter %p\n", aID); 225 231 226 232 uId = (uintptr_t)aID; … … 244 250 DWORD cbReturned; 245 251 246 printf("usbproxy: usbLibInit\n");252 RTPrintf("usbproxy: usbLibInit\n"); 247 253 248 254 g_hUSBMonitor = CreateFile (USBMON_DEVICE_NAME, … … 269 275 { 270 276 /* AssertFailed(); */ 271 printf("usbproxy: Unable to open filter driver!! (rc=%lu)\n", GetLastError());277 RTPrintf("usbproxy: Unable to open filter driver!! (rc=%lu)\n", GetLastError()); 272 278 rc = VERR_FILE_NOT_FOUND; 273 279 goto failure; … … 281 287 if (!DeviceIoControl(g_hUSBMonitor, SUPUSBFLT_IOCTL_GET_VERSION, NULL, 0,&version, sizeof(version), &cbReturned, NULL)) 282 288 { 283 printf("usbproxy: Unable to query filter version!! (rc=%lu)\n", GetLastError());289 RTPrintf("usbproxy: Unable to query filter version!! (rc=%lu)\n", GetLastError()); 284 290 rc = VERR_VERSION_MISMATCH; 285 291 goto failure; … … 292 298 ) 293 299 { 294 printf("usbproxy: Filter driver version mismatch!!\n");300 RTPrintf("usbproxy: Filter driver version mismatch!!\n"); 295 301 rc = VERR_VERSION_MISMATCH; 296 302 goto failure; … … 344 350 RT_NOREF2(argc, argv); 345 351 346 printf("USB test\n");352 RTPrintf("USB test\n"); 347 353 348 354 rc = usbMonitorInit(); … … 355 361 usbMonInsertFilter(0x80EE, 0x0030, 0x0110, &pId3); 356 362 357 printf("Waiting to capture devices... enter 'r' to run filters\n");358 c = getchar();363 RTPrintf("Waiting to capture devices... enter 'r' to run filters\n"); 364 c = RTStrmGetCh(g_pStdIn); 359 365 if (c == 'r') 360 366 { 361 367 usbMonRunFilters(); 362 printf("Waiting to capture devices...\n");363 getchar(); /* eat the '\n' */364 getchar(); /* wait for more input */365 } 366 367 printf("Releasing device\n");368 RTPrintf("Waiting to capture devices...\n"); 369 RTStrmGetCh(g_pStdIn); /* eat the '\n' */ 370 RTStrmGetCh(g_pStdIn); /* wait for more input */ 371 } 372 373 RTPrintf("Releasing device\n"); 368 374 usbMonReleaseDevice(0xA16, 0x2499, 0x100); 369 375 … … 376 382 return 0; 377 383 } 384
Note:
See TracChangeset
for help on using the changeset viewer.