dmitrystu / sboot_stm32

Secure USB DFU1.1 bootloader for STM32
Apache License 2.0
313 stars 67 forks source link

Add WCID mechanism #40

Closed dzarda closed 3 years ago

dzarda commented 3 years ago

WCID is a Windows-only mechanism for automatic driver assignment for USB devices.

The minimal solution consists of

If Windows sees a device manifesting this, it assigns the relevant driver type to it.

The result is that the device can be accessed out of the box (by utilities such as dfu-util). Zadig (for manual installation of driver) is no longer needed to obtain working order.

My setup: Flash usage with DFU_WCID: 4284 Flash usage without DFU_WCID: 4120

Note 1. WINUSB is always assumed simply because it's the default Windows driver and I think it covers all cases; dfu-util supports this Note 2. "Vendor Code " is a byte value that theoretically must match bRequest in the control transfer and is set by a byte in the EE string descriptor. Described here. This is kept at 0 and ignored since it has no significance.


Further description at https://github.com/pbatard/libwdi/wiki/WCID-Devices

Implementation inspired from https://github.com/devanlai/dapboot/blob/01730698e2228605f36d5c77e61e67ea715690c1/src/winusb.c