Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

813 lines
24 KiB

  1. /*++
  2. Copyright (c) 1997-1998 Microsoft Corporation
  3. Module Name:
  4. TestGUSB.C
  5. Abstract:
  6. Console test app for Generic USB Lib
  7. This is a hastily writen file for testing purposes only.
  8. Environment:
  9. user mode only
  10. Notes:
  11. THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  12. KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  13. IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  14. PURPOSE.
  15. Copyright (c) 1997-1998 Microsoft Corporation. All Rights Reserved.
  16. Revision History:
  17. Sept 01 Created by KenRay
  18. --*/
  19. // #include <windows.h>
  20. #include <conio.h>
  21. #include <stdio.h>
  22. #include <stdlib.h>
  23. #include <assert.h>
  24. #include <time.h>
  25. #include <basetyps.h>
  26. #include "gusb.h"
  27. BOOL
  28. FilterOnlyOne (
  29. IN HKEY Key,
  30. IN OUT PULONG Context
  31. )
  32. {
  33. if (0 == * Context)
  34. {
  35. * Context = 1;
  36. return TRUE;
  37. }
  38. return FALSE;
  39. }
  40. HANDLE
  41. OpenOneDevice ()
  42. {
  43. ULONG context = 0;
  44. PGENUSB_DEVICE devices;
  45. ULONG numberDevices;
  46. HANDLE hOut;
  47. if (!GenUSB_FindKnownDevices (
  48. FilterOnlyOne,
  49. &context,
  50. &devices,
  51. &numberDevices))
  52. {
  53. printf("problem");
  54. return INVALID_HANDLE_VALUE;
  55. }
  56. assert (numberDevices = 1);
  57. hOut = CreateFile (
  58. devices[0].DetailData->DevicePath,
  59. GENERIC_READ | GENERIC_WRITE,
  60. FILE_SHARE_READ | FILE_SHARE_WRITE,
  61. NULL, // no SECURITY_ATTRIBUTES structure
  62. OPEN_EXISTING, // No special create flags
  63. 0, // No special attributes
  64. NULL); // No template file
  65. if (INVALID_HANDLE_VALUE == hOut) {
  66. printf( "FAILED to open %ws\n", devices[0].DetailData->DevicePath);
  67. }
  68. return hOut;
  69. }
  70. void
  71. usage()
  72. /*++
  73. Routine Description:
  74. Called by main() to dump usage info to the console when
  75. the app is called with no parms or with an invalid parm
  76. Arguments:
  77. None
  78. Return Value:
  79. None
  80. --*/
  81. {
  82. printf("Usage for Read/Write test:\n");
  83. printf("-l <Length of buffer>\n");
  84. printf("-c <Iterration count>\n");
  85. printf("-r <Read Interface No> <Read Pipe No>\n");
  86. printf("-w <Write Interface No> <Write Pipe No>\n");
  87. printf("-e // try to retrieve the extended configuration desc\n");
  88. printf("-i <Number of interfaces to configure>\n");
  89. printf("-t <Timeout Value to use for all transfers>\n");
  90. printf("-m // Use IRP_MJ_READ / WRITE \n");
  91. printf("-n // turn off auto truncate \n");
  92. }
  93. BOOL
  94. Parse(
  95. int argc,
  96. char * argv[],
  97. PULONG Length,
  98. PULONG IterationCount,
  99. PCHAR ReadInterface,
  100. PCHAR ReadPipe,
  101. PCHAR WriteInterface,
  102. PCHAR WritePipe,
  103. PBOOL GetExtConfigDesc,
  104. PUCHAR NumberInterfaces,
  105. PUSHORT Timeout,
  106. PBOOL UseMajorReadsWrites,
  107. PBOOL NoTruncate
  108. )
  109. /*++
  110. Routine Description:
  111. Called by main() to parse command line parms
  112. Arguments:
  113. argc and argv that was passed to main()
  114. Return Value:
  115. Sets global flags as per user function request
  116. --*/
  117. {
  118. BOOL result = TRUE;
  119. int i;
  120. *GetExtConfigDesc = FALSE;
  121. *NumberInterfaces = 1;
  122. *Length = 0;
  123. *IterationCount = 0;
  124. *ReadInterface = -1;
  125. *ReadPipe = -1;
  126. *WriteInterface = -1;
  127. *WritePipe = -1;
  128. *Timeout = 20;
  129. *UseMajorReadsWrites = FALSE;
  130. *NoTruncate = FALSE;
  131. if ( argc < 2 ) // give usage if invoked with no parms
  132. {
  133. usage();
  134. result = FALSE;
  135. }
  136. for (i=0; i<argc; i++) {
  137. if (argv[i][0] == '-' ||
  138. argv[i][0] == '/') {
  139. switch(argv[i][1]) {
  140. case 'l':
  141. case 'L':
  142. *Length = atoi(&argv[i+1][0]);
  143. i++;
  144. break;
  145. case 'c':
  146. case 'C':
  147. *IterationCount = (UCHAR) atoi(&argv[i+1][0]);
  148. i++;
  149. break;
  150. case 'r':
  151. case 'R':
  152. *ReadInterface = (UCHAR) atoi(&argv[i+1][0]);
  153. *ReadPipe = (UCHAR) atoi(&argv[i+2][0]);
  154. i++;
  155. i++;
  156. break;
  157. case 'w':
  158. case 'W':
  159. *WriteInterface = (UCHAR) atoi(&argv[i+1][0]);
  160. *WritePipe = (UCHAR) atoi(&argv[i+2][0]);
  161. i++;
  162. i++;
  163. break;
  164. case 'e':
  165. case 'E':
  166. *GetExtConfigDesc = TRUE;
  167. break;
  168. case 'i':
  169. case 'I':
  170. *NumberInterfaces = (UCHAR) atoi(&argv[i+1][0]);
  171. i++;
  172. break;
  173. case 't':
  174. case 'T':
  175. *Timeout = (USHORT) atoi(&argv[i+1][0]);
  176. i++;
  177. break;
  178. case 'm':
  179. case 'M':
  180. *UseMajorReadsWrites = TRUE;
  181. break;
  182. case 'n':
  183. case 'N':
  184. *NoTruncate = TRUE;
  185. break;
  186. default:
  187. usage();
  188. result = FALSE;
  189. }
  190. }
  191. }
  192. return result;
  193. }
  194. #define MAX_ENDS 5
  195. #define MAX_INTS 5
  196. void
  197. ReadWriteData (
  198. HANDLE Handle,
  199. ULONG Length,
  200. ULONG IterationCount,
  201. CHAR ReadInterface,
  202. CHAR ReadPipeNo,
  203. CHAR WriteInterface,
  204. CHAR WritePipeNo,
  205. USHORT Timeout,
  206. BOOL UseMajorReadsWrites,
  207. BOOL NoTruncate,
  208. PUSBD_PIPE_INFORMATION Pipes
  209. )
  210. {
  211. ULONG i,j;
  212. PCHAR outBuffer;
  213. PCHAR inBuffer;
  214. ULONG returnedLength;
  215. USBD_STATUS status;
  216. GENUSB_PIPE_PROPERTIES readProps;
  217. GENUSB_PIPE_PROPERTIES writeProps;
  218. USBD_PIPE_HANDLE readPipe;
  219. USBD_PIPE_HANDLE writePipe;
  220. BOOL result;
  221. CHAR pattern[] = "happy happy joy joy 1234567890";
  222. readPipe = writePipe = NULL;
  223. printf("len %x C %x Read %x %x Write %x %x Time %x\n",
  224. Length, IterationCount,
  225. ReadInterface, ReadPipeNo,
  226. WriteInterface, WritePipeNo,
  227. Timeout);
  228. if ((Length == 0) || (IterationCount == 0))
  229. {
  230. printf("Not reading\n");
  231. return;
  232. }
  233. printf("Reading %x times, to %x %x from %x %x len %x %s\n",
  234. IterationCount,
  235. WriteInterface,
  236. WritePipeNo,
  237. ReadInterface,
  238. ReadPipeNo,
  239. Length,
  240. (UseMajorReadsWrites ?
  241. "Using IRP_MJ_READ/WRITE" :
  242. "Using IOCTL read/write"));
  243. ZeroMemory (&readProps, sizeof (readProps));
  244. ZeroMemory (&writeProps, sizeof (writeProps));
  245. outBuffer = malloc (Length);
  246. inBuffer = malloc (Length);
  247. printf("Setting Pipe Properties\n");
  248. if (-1 != WritePipeNo)
  249. {
  250. writePipe = (Pipes + (WriteInterface * MAX_ENDS) + WritePipeNo)->PipeHandle;
  251. if (!GenUSB_GetPipeProperties(Handle, writePipe, &writeProps))
  252. {
  253. printf("failed to get write properties\n");
  254. return;
  255. }
  256. writeProps.Timeout = Timeout;
  257. writeProps.NoTruncateToMaxPacket = (NoTruncate ? TRUE: FALSE);
  258. if (!GenUSB_SetPipeProperties(Handle, writePipe, &writeProps))
  259. {
  260. printf("failed to set write Properties\n");
  261. return;
  262. }
  263. //
  264. // verify that it got set (not needed just for testing only)
  265. //
  266. RtlZeroMemory (&writeProps, sizeof (GENUSB_PIPE_PROPERTIES));
  267. if (!GenUSB_GetPipeProperties(Handle, writePipe, &writeProps))
  268. {
  269. printf("failed to get write properties\n");
  270. return;
  271. }
  272. printf("Write Timeout %x NoTruncate %x DirectionIn %x Handle %x \n",
  273. writeProps.Timeout,
  274. writeProps.NoTruncateToMaxPacket,
  275. writeProps.DirectionIn,
  276. writeProps.PipePropertyHandle);
  277. }
  278. if (-1 != ReadPipeNo)
  279. {
  280. readPipe = (Pipes + (ReadInterface * MAX_ENDS) + ReadPipeNo)->PipeHandle;
  281. if (!GenUSB_GetPipeProperties(Handle, readPipe, &readProps))
  282. {
  283. printf("failed to get read properties\n");
  284. return;
  285. }
  286. readProps.Timeout = Timeout;
  287. readProps.NoTruncateToMaxPacket = (NoTruncate ? TRUE: FALSE);
  288. if (!GenUSB_SetPipeProperties(Handle, readPipe, &readProps))
  289. {
  290. printf("failed to set read Properties\n");
  291. return;
  292. }
  293. //
  294. // verify that it got set (not needed just for testing only)
  295. //
  296. RtlZeroMemory (&readProps, sizeof (GENUSB_PIPE_PROPERTIES));
  297. if (!GenUSB_GetPipeProperties(Handle, readPipe, &readProps))
  298. {
  299. printf("failed to get read properties\n");
  300. return;
  301. }
  302. printf("Read Timeout %x NoTruncate %x In %x Handle %x\n",
  303. readProps.Timeout,
  304. readProps.NoTruncateToMaxPacket,
  305. readProps.DirectionIn,
  306. readProps.PipePropertyHandle);
  307. }
  308. if ((NULL == outBuffer) || (NULL == inBuffer))
  309. {
  310. return;
  311. }
  312. for (i=0; i<Length; i+= sizeof (pattern))
  313. {
  314. CopyMemory( &outBuffer[i],
  315. pattern,
  316. (((Length - i) < sizeof (pattern)) ?
  317. (Length - i) :
  318. sizeof (pattern)));
  319. }
  320. if (UseMajorReadsWrites)
  321. {
  322. if (!GenUSB_SetReadWritePipes (Handle, readPipe, writePipe))
  323. {
  324. printf("Failed to set Read/Write pipes %x\n",
  325. GetLastError ());
  326. return;
  327. }
  328. }
  329. for (i=0; i<IterationCount; i++)
  330. {
  331. returnedLength = 0;
  332. status = 0;
  333. if (-1 != WritePipeNo)
  334. {
  335. if (!UseMajorReadsWrites)
  336. {
  337. result = GenUSB_WritePipe (Handle,
  338. writePipe,
  339. TRUE, // short OK
  340. outBuffer,
  341. Length,
  342. &returnedLength,
  343. &status);
  344. }
  345. else
  346. {
  347. result = WriteFile (Handle,
  348. outBuffer,
  349. Length,
  350. &returnedLength,
  351. NULL);
  352. status = -1; // unknown
  353. }
  354. if (!result)
  355. {
  356. printf("Error: err:%x, urbstatus:%x, len:%x\n",
  357. GetLastError(), status, returnedLength);
  358. }
  359. else
  360. {
  361. printf("did write %x %x\n", returnedLength, status);
  362. for (j=0; j<returnedLength; j++)
  363. {
  364. printf(" %c(%x)", outBuffer[j], outBuffer[j]);
  365. }
  366. printf("\n");
  367. }
  368. }
  369. if (-1 != ReadPipeNo)
  370. {
  371. FillMemory (inBuffer, Length, -1);
  372. if (!UseMajorReadsWrites)
  373. {
  374. result = GenUSB_ReadPipe (Handle,
  375. readPipe,
  376. TRUE, // short OK
  377. inBuffer,
  378. Length,
  379. &returnedLength,
  380. &status);
  381. }
  382. else
  383. {
  384. result = ReadFile (Handle,
  385. inBuffer,
  386. Length,
  387. &returnedLength,
  388. NULL);
  389. status = -1; // unknonw
  390. }
  391. if (!result)
  392. {
  393. printf("Error: err:%x, urbstatus:%x, len:%x\n",
  394. GetLastError(), status, returnedLength);
  395. }
  396. else
  397. {
  398. printf("did read %x %x\n", returnedLength, status);
  399. }
  400. for (j=0; j<returnedLength; j++)
  401. {
  402. printf(" %c(%x)", inBuffer[j], inBuffer[j]);
  403. }
  404. printf("\n");
  405. if ((USBD_STATUS_BUFFER_OVERRUN == status) ||
  406. (UseMajorReadsWrites && !result))
  407. {
  408. printf("Data overrun................. \nResetting Pipe \n");
  409. GenUSB_ResetPipe (Handle,
  410. readPipe,
  411. TRUE, // Reset the pipe
  412. TRUE, // No clear stall
  413. FALSE); // No flush data
  414. }
  415. }
  416. }
  417. }
  418. int _cdecl main(
  419. int argc,
  420. char *argv[])
  421. /*++
  422. Routine Description:
  423. Entry point to rwbulk.exe
  424. Parses cmdline, performs user-requested tests
  425. Arguments:
  426. argc, argv standard console 'c' app arguments
  427. Return Value:
  428. Zero
  429. --*/
  430. {
  431. char *pinBuf = NULL, *poutBuf = NULL;
  432. ULONG i, j;
  433. int ok;
  434. UINT success;
  435. ULONG totalBytes = 0L;
  436. HANDLE handle;
  437. double seconds;
  438. ULONG fail = 0L;
  439. ULONG Length;
  440. ULONG IterationCount;
  441. CHAR ReadInterface;
  442. CHAR ReadPipe;
  443. CHAR WriteInterface;
  444. CHAR WritePipe;
  445. UCHAR NumberInterfaces;
  446. USHORT Timeout;
  447. BOOL GetExtConfigDesc;
  448. BOOL UseMajorReadsWrites;
  449. BOOL NoTruncate;
  450. UCHAR OutPipe;
  451. GENUSB_CAPABILITIES caps;
  452. USB_DEVICE_DESCRIPTOR devDesc;
  453. PUSB_CONFIGURATION_DESCRIPTOR configDesc;
  454. UCHAR stringDesc[18];
  455. ULONG result;
  456. UCHAR code;
  457. PGENUSB_REQUEST_RESULTS extConfig;
  458. USHORT size;
  459. if (!Parse(argc, argv, &Length, &IterationCount,
  460. &ReadInterface, &ReadPipe,
  461. &WriteInterface, &WritePipe,
  462. &GetExtConfigDesc, &NumberInterfaces,
  463. &Timeout, &UseMajorReadsWrites,
  464. &NoTruncate))
  465. {
  466. return;
  467. }
  468. handle = OpenOneDevice ();
  469. if (INVALID_HANDLE_VALUE == handle)
  470. {
  471. return;
  472. }
  473. result = GenUSB_GetCapabilities (handle, &caps);
  474. printf("desc length %d, config length %d\n",
  475. caps.DeviceDescriptorLength,
  476. caps.ConfigurationInformationLength);
  477. result = GenUSB_GetDeviceDescriptor (handle, &devDesc, sizeof (devDesc));
  478. printf("len %x, type %x, bcd %x, Class %x, subClass %x, Prot %x, Pack %x, \n"
  479. "Vid %x, Pid %x, Rev %x, Man %x, Prod %x, Serial %x, #config %x\n",
  480. devDesc.bLength,
  481. devDesc.bDescriptorType,
  482. devDesc.bcdUSB,
  483. devDesc.bDeviceClass,
  484. devDesc.bDeviceSubClass,
  485. devDesc.bDeviceProtocol,
  486. devDesc.bMaxPacketSize0,
  487. devDesc.idVendor,
  488. devDesc.idProduct,
  489. devDesc.bcdDevice,
  490. devDesc.iManufacturer,
  491. devDesc.iProduct,
  492. devDesc.iSerialNumber,
  493. devDesc.bNumConfigurations);
  494. printf("---------------------------------\n");
  495. configDesc = malloc (caps.ConfigurationInformationLength);
  496. result = GenUSB_GetConfigurationInformation (
  497. handle,
  498. configDesc,
  499. caps.ConfigurationInformationLength);
  500. printf("len %x, type %x, totlen %x, #ints %x, fig %x, figStr %x, Attr %x, pow %x\n",
  501. configDesc->bLength,
  502. configDesc->bDescriptorType,
  503. configDesc-> wTotalLength,
  504. configDesc->bNumInterfaces,
  505. configDesc->bConfigurationValue,
  506. configDesc->iConfiguration,
  507. configDesc->bmAttributes,
  508. configDesc->MaxPower);
  509. for (i = 0; i < caps.ConfigurationInformationLength; i++)
  510. {
  511. printf(" %x", ((PUCHAR)configDesc)[i]);
  512. }
  513. printf("\n");
  514. if (GetExtConfigDesc)
  515. {
  516. printf("------------Get Magic String Descriptor--------\n");
  517. result = GenUSB_GetStringDescriptor (handle,
  518. GENUSB_RECIPIENT_DEVICE,
  519. 0xEE,
  520. 0,
  521. stringDesc,
  522. sizeof (stringDesc));
  523. code = stringDesc [16];
  524. printf("String descriptor 0xEE\n");
  525. for (i=0; i < sizeof (stringDesc); i++)
  526. {
  527. printf(" %x", stringDesc [i]);
  528. }
  529. printf("\n magic code 0x%x\n", code);
  530. printf("---------Get OS Descriptor------------------\n");
  531. size = sizeof (GENUSB_REQUEST_RESULTS) + 0x28;
  532. extConfig = malloc (size);
  533. result = GenUSB_DefaultControlRequest (handle,
  534. 0xC0,
  535. code,
  536. 0x0000,
  537. 0,
  538. extConfig,
  539. size);
  540. printf("URB status %x\n", extConfig->Status);
  541. printf("length %x\n", extConfig->Length);
  542. printf("Extended Config descriptor\n");
  543. for (i=0; i < 40 ; i++)
  544. {
  545. printf(" %x", extConfig->Buffer[i]);
  546. }
  547. printf("\n");
  548. }
  549. printf("---------Set Configuraiton---------------------\n");
  550. printf("number interfaces %x\n", configDesc->bNumInterfaces);
  551. {
  552. USB_INTERFACE_DESCRIPTOR * interfaces;
  553. USBD_PIPE_INFORMATION pipes[MAX_INTS][MAX_ENDS];
  554. PGENUSB_CONFIGURATION_INFORMATION_ARRAY configArray;
  555. PGENUSB_INTERFACE_DESCRIPTOR_ARRAY interfaceArray;
  556. PUSB_ENDPOINT_DESCRIPTOR endpoint;
  557. PUSB_COMMON_DESCRIPTOR commonDesc;
  558. ULONG k;
  559. printf("----------------------Config Array-------------------\n");
  560. configArray = GenUSB_ParseDescriptorsToArray (configDesc);
  561. for (i=0; i < configArray->NumberInterfaces; i++)
  562. {
  563. interfaceArray = &configArray->Interfaces[i];
  564. printf("Interface %x\n", i);
  565. printf("Len %x, Type %x, # %x, AltSet %x, #end %x, "
  566. "Cl %x, SCl %x, Prot %x, i %x\n",
  567. interfaceArray->Interface.bLength,
  568. interfaceArray->Interface.bDescriptorType,
  569. interfaceArray->Interface.bInterfaceNumber,
  570. interfaceArray->Interface.bAlternateSetting,
  571. interfaceArray->Interface.bNumEndpoints,
  572. interfaceArray->Interface.bInterfaceClass,
  573. interfaceArray->Interface.bInterfaceSubClass,
  574. interfaceArray->Interface.bInterfaceProtocol,
  575. interfaceArray->Interface.iInterface);
  576. for (j=0; j < interfaceArray->NumberEndpointDescriptors; j++)
  577. {
  578. endpoint = interfaceArray->EndpointDescriptors[j];
  579. printf("(%x) %x :", j, endpoint->bDescriptorType);
  580. for (k=0; k < endpoint->bLength; k++)
  581. {
  582. printf(" %x", ((PUCHAR) endpoint)[k]);
  583. }
  584. printf("\n");
  585. }
  586. for (j=0; j < interfaceArray->NumberOtherDescriptors; j++)
  587. {
  588. commonDesc = interfaceArray->OtherDescriptors[j];
  589. printf("(%x) %x :", j, commonDesc->bDescriptorType);
  590. for (k=0; k < commonDesc->bLength; k++)
  591. {
  592. printf(" %x", ((PUCHAR) commonDesc)[k]);
  593. }
  594. printf("\n");
  595. }
  596. }
  597. size = (USHORT) (sizeof (USB_INTERFACE_DESCRIPTOR) * NumberInterfaces);
  598. interfaces = malloc (size);
  599. FillMemory (interfaces, size, -1);
  600. for (i=0; i < NumberInterfaces; i++)
  601. {
  602. interfaces[i].bInterfaceNumber = (UCHAR)i;
  603. }
  604. printf("numb ints %x\n", NumberInterfaces);
  605. for (i=0; i < NumberInterfaces; i++)
  606. {
  607. printf("Len %x, Type %x, # %x, AltSet %x, #end %x, "
  608. "Cl %x, SCl %x, Prot %x, i %x\n",
  609. interfaces[i].bLength,
  610. interfaces[i].bDescriptorType,
  611. interfaces[i].bInterfaceNumber,
  612. interfaces[i].bAlternateSetting,
  613. interfaces[i].bNumEndpoints,
  614. interfaces[i].bInterfaceClass,
  615. interfaces[i].bInterfaceSubClass,
  616. interfaces[i].bInterfaceProtocol,
  617. interfaces[i].iInterface);
  618. }
  619. result = GenUSB_SelectConfiguration (handle,
  620. NumberInterfaces,
  621. interfaces,
  622. &NumberInterfaces,
  623. interfaces);
  624. printf("result %x\n", result);
  625. printf("numb ints %x\n", NumberInterfaces);
  626. for (i=0; i<NumberInterfaces; i++)
  627. {
  628. printf("Len %x, Type %x, # %x, AltSet %x, #end %x, "
  629. "Cl %x, SCl %x, Prot %x, i %x\n",
  630. interfaces[i].bLength,
  631. interfaces[i].bDescriptorType,
  632. interfaces[i].bInterfaceNumber,
  633. interfaces[i].bAlternateSetting,
  634. interfaces[i].bNumEndpoints,
  635. interfaces[i].bInterfaceClass,
  636. interfaces[i].bInterfaceSubClass,
  637. interfaces[i].bInterfaceProtocol,
  638. interfaces[i].iInterface);
  639. }
  640. printf("----------------Get Pipe Info-----------------------\n");
  641. for (i=0; i<NumberInterfaces; i++)
  642. {
  643. interfaceArray = &configArray->Interfaces[i];
  644. for (j=0; j<interfaceArray->NumberEndpointDescriptors; j++)
  645. {
  646. endpoint = (PUSB_ENDPOINT_DESCRIPTOR)
  647. interfaceArray->EndpointDescriptors[j];
  648. GenUSB_GetPipeInformation (handle,
  649. (UCHAR) i, // interface
  650. endpoint->bEndpointAddress,
  651. &pipes[i][j]);
  652. printf("Max %x Addr %x Int %x Type %x Handle %x Trans %x Flags %x\n",
  653. pipes[i][j].MaximumPacketSize,
  654. pipes[i][j].EndpointAddress,
  655. pipes[i][j].Interval,
  656. pipes[i][j].PipeType,
  657. (ULONG) (ULONG_PTR) pipes[i][j].PipeHandle,
  658. pipes[i][j].MaximumTransferSize,
  659. pipes[i][j].PipeFlags);
  660. }
  661. }
  662. ReadWriteData (handle,
  663. Length,
  664. IterationCount,
  665. ReadInterface,
  666. ReadPipe,
  667. WriteInterface,
  668. WritePipe,
  669. Timeout,
  670. UseMajorReadsWrites,
  671. NoTruncate,
  672. &pipes[0][0]);
  673. }
  674. GenUSB_DeselectConfiguration (handle);
  675. CloseHandle (handle);
  676. return 0;
  677. }