2
votes

I'm developing firmware for a USB device with an STM32F070 microcontroller. I generated a bare-metal (no-OS) code base with STM32CubeMX, setting the device up as a USB CDC (Communications Device Class), so that it is automatically detected as a VCP (Virtual COM Port) by Windows 7, 8, and 10. Driver Details shows that it is using the Windows usbser.sys driver.

USB CDC configuration in STM32CubeMX

USB Serial Device detected in Windows Device Manager

When I change the USB Vendor ID (VID) or Product ID (PID) or Manufacturer String, it is still quickly detected as a USB Serial Device by Windows 10 Device Manager, but not by Windows 7 or 8. Windows 7 and 8 spend a long time searching Windows Update for a driver, and then are unable to find one.

How can I modify the device firmware/descriptors to enable Windows 7 and 8 hosts to automatically install the usbser.sys driver for the device when it has vendor-specific values for the USB VID, PID, and Manufacturer String?

2

2 Answers

4
votes

Windows 10 comes with a new driver named usbser.inf that will match devices conforming to the USB CDC ACM specification and cause the usbser.sys driver to be loaded for them.

To get your USB CDC ACM device working on older versions of Windows, you will need to provide an INF file yourself that tells Windows to load usbser.sys when it sees a USB device with your vendor ID and product ID. For Windows 7, Vista, and XP, this is just a simple matter of writing the INF file and distributing it to your customers. For Windows 8 and later, you will need to purchase a code signing certificate and then sign the INF file (or look into software utilities like zadig and libwdi that let you bypass the signature checks).

Please note that signing is different from WHQL. Once you have the signing certificate, you can sign the driver yourself without any waiting time or any approval from Microsoft.

Here is an example of an INF file that uses usbser.sys:

https://github.com/pololu/a-star/blob/master/drivers/a-star.inf

I wrote a lot about how to sign driver packages in this article:

http://www.davidegrayson.com/signing/

1
votes

the problem is the .inf file. in win 10 there is a new one (usbser.inf) that loads the driver usbser.sys automatically in win 7 and 8 you have to write your own .inf file that links your PID and VID to the usbser.sys driver, see https://msdn.microsoft.com/de-de/library/windows/hardware/ff538820%28v=vs.85%29.aspx and https://msdn.microsoft.com/de-de/library/windows/hardware/dn707976%28v=vs.85%29.aspx

In Windows 8.1 and earlier versions of the operating system, Usbser.sys is not automatically loaded when a USB-to-serial device is attached to a computer. To load the driver, you need to write an INF that references the modem INF (mdmcpq.inf) and includes [Install] and [Needs] sections. Those sections are required for instantiating the service, copying inbox binaries, and registering a device interface GUID that applications require to find the device and talk to it. That INF specifies "Usbser" as a lower filter driver in a device stack.

source: https://msdn.microsoft.com/de-de/library/windows/hardware/dn707976%28v=vs.85%29.aspx

In https://msdn.microsoft.com/de-de/library/windows/hardware/dn707976%28v=vs.85%29.aspx, Do I need to write my own host side USB driver for a CDC device and https://community.nxp.com/thread/301439 are example .inf files for win 7 and 8.