Professional Documents
Culture Documents
USB 2.0 and 3.0 standards and connected devices, or hardware data transmission basis
Data transmission in the USB standard, that is communication and interoperability of system
resources of various devices
Libraries and multithreaded programs, ie detailed aspects of USB data transfer programming
Table of Contents
Chapter 6. Unlocking the device for transmission. Reading and writing data ....... 191
Unblocking the device for transmission .............................................. ......................... 191
CreateFile () function .............................................. ................................................. 192
CloseHandle () function .............................................. ............................................. 194
Sample text environment program .............................................. ........ 194
Reading data in the form of a report ............................................. ..................................... 198
ReadFile () function .............................................. .................................................. 199
Readout of data buffer length .............................................. ................................ 203
Function HidD_GetInputReport () .............................................. .............................. 207
Reading button properties ............................................... ................................. 208
Reading the ownership of the value ............................................... ...................................... 213
Graphic environment application ............................................... ........................... 218
Recording of data in the form of a report ............................................. ........................................
225
WriteFile () function .............................................. .................................................. 225
Functions HidD_SetOutputReport () and HidD_SetFeature () ................................... 226
OVERLAPPED structure ................................................ ............................................ 227
Functions xxxEx ................................................ .................................................. ..... 230
The COMMTIMEOUTS structure ................................................ ...................................... 234
Features GetCommTimeouts () and SetCommTimeouts () .......................................... 235
DeviceIoControl () function .............................................. ............................................. 236
Orders from the hidclass.h ............................................ ..................................... 242
Orders from the usbioctl.h module ............................................ ............................................ 245
Identification of devices connected to the USB hub ........................... 247
URB structure ................................................ .................................................. ............ 262
The UsbBuildGetDescriptorRequest () function .............................................. ............... 267
Summary ................................................. .................................................. ........... 268
Exercises ................................................. .................................................. .................. 268
Chapter 7. WinUSB and LibUSB libraries ........................................... .......... 271
WinUSB library ................................................ .................................................. .... 271
Preparation of the installation package ............................................... .................... 272
Export functions of WinUSB library .............................................. .................. 277
LibusB Library ................................................ .................................................. ..... 289
Functions of the library kernel ............................................... ........................................... 292
Functions for managing the libusb device ............................................. ............. 293
Functions performing mass transfer .............................................. ....................... 300
Functions performing interrupt transfer .............................................. .............. 301
Asynchronous functions ................................................ ......................................... 301
Summary ................................................. .................................................. ........... 305
Chapter 8. Object oriented programming of USB transmission .................................... 307
Objectivity ................................................. .................................................. .............. 307
Project patterns ................................................ .................................................. ..... 314
Singleton ................................................. .................................................. ............. 314
Interfaces ................................................. .................................................. .................... 319
Counting interface references .............................................. ............................... 326