Helpful ReplyMS-official "WinUSB class" driver for XP, Vista and 7

Author
chinzei
Super Member
  • Total Posts : 2250
  • Reward points : 0
  • Joined: 2003/11/07 12:39:02
  • Location: Tokyo, Japan
  • Status: offline
2014/04/03 09:52:37 (permalink)
4.33 (3)

MS-official "WinUSB class" driver for XP, Vista and 7

http://www.microchip.com/forums/FindPost/789872
ajs410:

What's really nice with Windows 8 is that you can supply a Microsoft descriptor that allows the system to automatically bind your vendor-defined interface to WinUSB without any INF file at all.  It will be plug-and-play exactly like HID - but only on Windows 8 or higher.

The MS-official "WinUSB class" driver extends this method back to XP, Vista and 7 (x86/x64).

As I noticed that this information is not popular even for USB experts like ajs410 yet, I post a brief summary, here.

A. Distribution
The driver file is distributed as "Windows Phone driver"
The detailed download instruction of this driver is described in this KB,

"Windows Phone 8 is not detected by your computer"
http://support.microsoft.com/kb/2749484/en-us
- Things to Try
- - 3. Update your Windows Phone 8 driver
- - - To manually download and install the Windows Phone driver:
- - - - a. Go to http://catalog.update.microsoft.com
- - - - b. Search for "windows phone winusb"

The direct link is (works just on IE),
http://catalog.update.mic...4522-9ad1-dcc969d94832

This CAB file is downloaded from above link,
AMD64_X86-en-20484220_5f2718fc6d44c5ae61d4275d679bbf1ededf58e5.cab

Extract winusbcompat.inf/.cat files from this CAB file.
For your convenience, I attached winusbcompat.zip to this post.


B. Installation
At plugin of a "WinUSB Device" (**1) to a PC (**2), specify the folder which contains winusbcompat.inf/.cat as its driver.

Once the winusbcompat.inf/.cat would be installed on the PC, another "WinUSB Devices" should be automatically recognized without any driver installation.

(**1) A device which returns MS OS descriptors for WinUSB, like Microchip "Device - WinUSB - Generic Driver Demo" example

(**2) Windows XP-SP3, Vista-SP2 (x86/x64), 7-SP1 (x86/x64)

Tsuneo
post edited by chinzei - 2014/04/03 09:58:35
#1
xiaofan
Super Member
  • Total Posts : 6247
  • Reward points : 0
  • Joined: 2005/04/14 07:05:25
  • Location: Singapore
  • Status: offline
Re: MS-official "WinUSB class" driver for XP, Vista and 7 2014/04/04 22:42:54 (permalink)
0
https://github.com/pbatard/libwdi/wiki/WCID-Devices
 
The above might be interesting info as well.

  USB_Links and libusb
#2
ajs410
Junior Member
  • Total Posts : 97
  • Reward points : 0
  • Joined: 2011/05/19 13:08:46
  • Location: 0
  • Status: offline
Re: MS-official "WinUSB class" driver for XP, Vista and 7 2014/04/07 11:02:31 (permalink)
+2 (1)
That is pretty awesome, thanks for the links.
 
One thing I would note about this approach.  Windows 8 is supported by what is called an "in-box driver" - that is, you can install a fresh copy of Windows 8 on a PC with no Internet connection, plug in a WCID Device, and WinUSB will be installed correctly and automatically for your device.
 
For Windows Vista and Windows 7, the driver is not in-box; you can think of it as an "out-box driver", since it requires contact with Windows Update, but the OS will still automatically install the driver without you having to sign one.  This is not a problem if your customers have guaranteed Internet access on the machine in question, but if you must handle the use case of an air-gapped machine, your software installation will still need a driver package.
 
What is really new to me, here, is that you can install this winusbcompat driver package once, and then every WCID device after that gets the benefit.  That is awesome, especially since it works back to XP (even though XP officially dies tomorrow).  Even better than that, you don't need an Authenticode signature to install your driver package if you use winusbcompat!  And it can be included in your installer in the event that you target air-gapped systems.
#3
salazar
Starting Member
  • Total Posts : 58
  • Reward points : 0
  • Joined: 2013/03/11 06:24:46
  • Location: 0
  • Status: offline
Re: MS-official "WinUSB class" driver for XP, Vista and 7 2014/08/28 10:23:30 (permalink)
0
I must not understand this or something, because I just don't see how this works. Using this method it will indeed bind the winusb.sys driver to the device. However, it doesn't look like this .inf file provides any device interface GUIDs. Without that, it seems impossible to open the device and use it with WinUSB functions?
 
Is there another way to open a WinUSB device without using SetupDiEnumDeviceInterfaces()? Or how does this actually work?
#4
chinzei
Super Member
  • Total Posts : 2250
  • Reward points : 0
  • Joined: 2003/11/07 12:39:02
  • Location: Tokyo, Japan
  • Status: offline
Re: MS-official "WinUSB class" driver for XP, Vista and 7 2014/08/28 22:18:15 (permalink)
+3 (2)
salazar:
However, it doesn't look like this .inf file provides any device interface GUIDs. Without that, it seems impossible to open the device and use it with WinUSB functions?


The fact you aren’t aware of is,
the target "WinUSB class" (or "WCID") device provides every information in INF file over MS OS descriptors, including interface GUID. And then, any specific INF file is not required any more for the target device.

Since WinXP SP2, MS have integrated the protocol to detect "WinUSB class" device, by asking MS OS descriptors to every USB device at the first plugin enumeration. When the target device correctly responds to this protocol, Windows assigns MS_COMP_WINUSB to the device interface. But it doesn’t go any further, unless MS_COMP_WINUSB class driver is installed. Above class driver binds MS_COMP_WINUSB device to WinUSB driver. That is, it is the missing link ;-)

You may refer to these topics.

How to install WinUSB.sys without a custom INF?
http://blogs.msdn.com/b/u...hout-a-custom-inf.aspx

Building USB devices for Windows
http://msdn.microsoft.com...dn385698(v=vs.85).aspx

Microsoft OS Descriptors
http://msdn.microsoft.com...dows/hardware/gg463179

Is there another way to open a WinUSB device without using SetupDiEnumDeviceInterfaces()?


No way.
The procedure around SetupDiEnumDeviceInterfaces() is stereotype.
Once you’ve written (or copied) it, you may reuse it without touching its contents.
Of course, you may apply "WinUSB libraries" on the web, to hide SetupDiEnumDeviceInterfaces() call.

Tsuneo


#5
salazar
Starting Member
  • Total Posts : 58
  • Reward points : 0
  • Joined: 2013/03/11 06:24:46
  • Location: 0
  • Status: offline
Re: MS-official "WinUSB class" driver for XP, Vista and 7 2014/09/05 14:33:52 (permalink)
0 (1)
A couple follow-up questions:
 
1. Under Windows XP, it does not seem possible to use this winusbcompat.inf file. The reason is that WinXP needs a coinstaller to get winusb.sys and winusb.dll, since those binaries did not ship with WinXP. But this winusbcompat.inf file does not mention a coinstaller. Does winusbcompat.inf actually work on WinXP? Or do you need a custom .inf anyways?
 
2. On my development computer (Windows 7 64-bit) I do not get a DeviceInterfaceGUID. I have tried numerous times uninstalling the device, deleting it from the registry, etc. Every time it reinstalls but does not give me a DeviceInterfaceGUID with which to open the device. I have not seen this problem on any other computer I have tested on. Is it possible that during development (adding the MS OS descriptors), that it corrupted something in the registry that I am not aware of, that is causing it not to list the DeviceInterfaceGUID?
#6
salazar
Starting Member
  • Total Posts : 58
  • Reward points : 0
  • Joined: 2013/03/11 06:24:46
  • Location: 0
  • Status: offline
Re: MS-official "WinUSB class" driver for XP, Vista and 7 2014/09/10 06:23:40 (permalink)
0
Just to add to question #2 above:
 
The problem computer is running Windows 7 64-bit SP1 (Build 7601). I have tried changing the USB product id to something new, but that also does not seem to solve the problem for me. No matter what I do, the inbox WinUSB drivers plus this winusbcompat.inf file do not register the DeviceInterfaceGUID on this one specific computer. Are there any WinUSB registry settings I could check?
#7
salazar
Starting Member
  • Total Posts : 58
  • Reward points : 0
  • Joined: 2013/03/11 06:24:46
  • Location: 0
  • Status: offline
Re: MS-official "WinUSB class" driver for XP, Vista and 7 2014/10/17 04:34:43 (permalink)
0
Anyone have any ideas on the 2 questions presented above?
#8
chinzei
Super Member
  • Total Posts : 2250
  • Reward points : 0
  • Joined: 2003/11/07 12:39:02
  • Location: Tokyo, Japan
  • Status: offline
Re: MS-official "WinUSB class" driver for XP, Vista and 7 2014/10/17 07:50:31 (permalink)
0
A) Name of WinUsb Device
The device "name" on the Device Manager depends on the OS version (**1).

a) Windows 8/8.1
The device name comes from the device - the iProduct string descriptor

b) Windows XP, Vista, 7
The name is always "WinUsb Device", which comes from winusb.inf

(**1) WinUSB Device - on MSDN site
http://msdn.microsoft.com...hh450799(v=vs.85).aspx
Described in "How to change the device description for a WinUSB device" section

These names are stored on this registry entry for each device
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_vvvv&PID_pppp\<serial-number>\DeviceDesc

At the first plug-in installation, this registry entry is made by the OS. As this registry entry is protected, we can’t change the value of this entry. That is, to change this entry from the default, a custom INF file is required, as described in above MSDN document.

But when "FriendlyName" entry is placed under the same key, Device Manager shows this "name" primarily instead of "DeviceDesc". FriendlyName entry is assigned manually, or by PC application (using SetupDiSetDeviceRegistryProperty(SPDRP_FRIENDLYNAME) under administrator privilege), as discussed on this topic.
http://www.microchip.com/forums/FindPost/477203

B) XP installation
If the target WinXP PC wouldn’t have been installed WinUSB before, "WinUSB Device" plug-in installation using winusbcompat.inf should fail. It’s because winusbcompat.inf refers to winusb.inf.

WinUSB is able to be pre-installed together with winusbcompat.inf. If you would like to customize the "name" of the device, however, ordinary INF-file installation of WinUSB is better.

Tsuneo
#9
salazar
Starting Member
  • Total Posts : 58
  • Reward points : 0
  • Joined: 2013/03/11 06:24:46
  • Location: 0
  • Status: offline
Re: MS-official "WinUSB class" driver for XP, Vista and 7 2014/10/20 08:43:53 (permalink)
0
There is one more issue that eludes me:
 
On my development computer (Windows 7 64-bit) I do not get a DeviceInterfaceGUID. I have tried numerous times uninstalling the device, deleting it from the registry, etc. Every time it reinstalls but does not give me a DeviceInterfaceGUID with which to open the device. I have not seen this problem on any other computer I have tested on. Is it possible that during development (adding the MS OS descriptors), that it corrupted something in the registry that I am not aware of, that is causing it not to list the DeviceInterfaceGUID?
 
This computer is running Windows 7 64-bit SP1 (Build 7601). I have tried changing the USB product id to something new, but that also does not seem to solve the problem for me. No matter what I do, the inbox WinUSB drivers plus this winusbcompat.inf file do not register the DeviceInterfaceGUID on this one specific computer. Are there any WinUSB registry settings I could check?
 
Any ideas what is happening here?
#10
salazar
Starting Member
  • Total Posts : 58
  • Reward points : 0
  • Joined: 2013/03/11 06:24:46
  • Location: 0
  • Status: offline
Re: MS-official "WinUSB class" driver for XP, Vista and 7 2014/10/27 04:29:01 (permalink)
0
Anyone know why the DeviceInterfaceGUID is not being installed on this specific computer?
#11
salazar
Starting Member
  • Total Posts : 58
  • Reward points : 0
  • Joined: 2013/03/11 06:24:46
  • Location: 0
  • Status: offline
Re: MS-official "WinUSB class" driver for XP, Vista and 7 2014/11/27 06:21:22 (permalink) ☄ Helpfulby bikeoid 2016/06/25 10:52:36
0 (1)
After many hours of debugging, I finally figured out that the DeviceInterfaceGUID for WinUSB devices was not being installed *only* when plugging the device into USB 3.0 ports on the Win7 machine. With that information, I finally found this thread:
 
http://www.microchip.com/forums/m802958.aspx
 
That thread solved my problem, and hopefully it will help others in this same situation.
#12
Jump to:
© 2018 APG vNext Commercial Version 4.5