WinUSB Driver Installation

来源:互联网 发布:xstream java 编辑:程序博客网 时间:2024/05/21 09:46

Typically, in this scenario, you would see the following right after plugging in your device:

And if you consult the status, you eventually end up with:

This basically means that Windows is not aware of any driver compatible with your device, and will indeed need a custom WinUSB driver to be able to communicate with it.
To install your device so that it can be accessed with libusb, you should do the following then:

  1. Download and extract the WinUSB driver files (eg. to C:winusb_driver).[[BR]][[BR]] The driver package contains all the necessary binary files required for installation, which you don't need to touch, for both 32 and 64 bit Windows platform, as well as a set of .inf, which you will need to edit before you can install your device. How you should edit these files will be highlighted below.

  2. Identify your device in the device manager. Usually, it will be listed with a yellow warning sign, under Other devices -> unknown device, as demonstrated by the screenshot below:



    Alternatively, if you have multiple devices flagged as "unknown device" and you want to be sure that you select an USB device, you can select "View -> Devices by connection", so that you can select the proper USB device:



  3. Once you have identified your device, access the properties menu, as follows:



  4. Then select Details -> Hardware IDs:



  5. At this stage, you need to write down the VID_#### and PID_####.

    You also need to identify whether you have an MI_## part in the hardware IDs (eg: "USBVID_15BA&PID_0004&MI_01").

  6. Once you have the data above, you first need to select which inf file(s) you need to edit:
    • If you didn't see an MI_## part in the hardware ID above, then you have a single interface device, and you should edit 'libusb_device.inf'
    • If you do have an MI_## part, then you have a multiple interface device, and you also probably had multiple unknown devices listed in the device manager. In that case, you should create and edit one 'libusb_device_multiple_interfaces_#.inf' file for each interface

  7. The last piece of information that you will need to provide when editing the .inf file is a device interface GUID. You don't have to worry too much about what a GUID is, but you must ensure that you generate your own GUID for each inf file you are going to use. There are many ways to generate proper device GUIDs:
    • go to http://createguid.com/ and use the value that is generated for you
    • if you have the non-express version of Visual Studio installed, open a Visual Studio command prompt, type: guidgen and select "4. registry format"

  8. Let's consider for instance that we are installing a single interface Microsoft XBox Controller, with hardware ID: 'USBVID_045E&PID_0289', for which we have generated GUID '77A67990-822C-4BEF-B37A-9FB192BEC9AB'
    The relevant section of the 'libusb_device.inf' that we would change then are as follows:
    • DeviceName = "Microsoft XBox Controller Type S"
    • VendorID = "VID_045E"
    • ProductID = "PID_0289"
    • DeviceGUID = "{77A67990-822C-4BEF-B37A-9FB192BEC9AB}"

Note that DeviceName can be any string that you want your device to be identified with in Device Manager.
Also, make sure that you don't forget the double quotes for each element, and the round brackets around the GUID, if it wasn't already present. The other values in the file don't really need to be modified, unless you know exactly what you are doing.

  1. Once you have saved your modified .inf file, you should go back to Device Manager, right click on your device, and select "Update Driver Software":



  2. On the prompt, select "Browse my computer for driver software"



  3. Then click "Browse", select the directory where you have placed the .inf file and click "Next"



  4. On 64 bit platforms, you might get the following warning, which is benign and for which you should select "Install this driver software anyway"



  5. When the process is completed, you should get to the following screen



  6. And finally, you can check that your device is listed in the "libusb (WinUSB) devices" category



Congratulations - you can now start using your device with libusb.

原创粉丝点击