

WinUsb_QueryInterfaceSettings fills the caller-allocated USB_INTERFACE_DESCRIPTOR structure (passed in the UsbAltInterfaceDescriptor parameter) with information about the interface. Therefore, for these devices the AlternateSettingNumber parameter is set to zero and the function is called only one time.

Some USB devices, such as the OSR Fx2 device, support only one interface without any alternative setting. The WinUSB interface handle corresponds to the first interface. The function returns LowSpeed (0x01) or HighSpeed (0x03).Ĭall WinUsb_QueryInterfaceSettings and pass the device's interface handles to obtain the corresponding interface descriptors. To get the device's speed, set DEVICE_SPEED (0x01) in the InformationType parameter. The following list shows the WinUSB functions that you can call to get USB-specific information:Ĭall WinUsb_QueryDeviceInformation to request information from the device descriptors for the device. However, the application completes device queries by calling WinUsb_GetDescriptor. The procedure is similar to the one that USB device drivers use. Next, query the device for USB-specific information such as device speed, interface descriptors, related endpoints, and their pipes. Step 2: Query the device for USB descriptors For example code that gets the device handle and opens the device, see Template code discussion. The template enumerates devices by using SetupAPI routines, opens a file handle for the device, and creates a WinUSB interface handle required for subsequent tasks. You can use the template as a starting point.įor information about the template code, how to create, build, deploy, and debug the skeleton app, see Write a Windows desktop app based on the WinUSB template. To access a USB device, start by creating a skeleton app based on the WinUSB template included in the integrated environment of Windows Driver Kit (WDK) (with Debugging Tools for Windows) and Microsoft Visual Studio.

Step 1: Create a skeleton app based on the WinUSB template You can use these examples to extend the procedures to other USB devices.
