How does Windows install the USB device driver?

I built a USB device (CDC), made a driver for it (inf, cat, sys, dll) using libusb. It is normally installed via the device manager. But Windows somehow automatically installs drivers on flash drives, printers, and other devices connected to the USB bus. Where do they come from? Are they in the flash drive controller? How do I load the driver into my controller so that it installs automatically in Windows?

Author: maestro, 2015-11-27

2 answers

Windows automatically installs only the drivers that it has. Some drivers for the most common devices are bundled with the OS itself, some are drivers for previously installed devices, and some are found in the Microsoft database via Windows Update. The USB flash drive controller does not and cannot have any drivers. The maximum that can be done is to add a virtual CD-ROM to the device, on which the required driver will be installed.

 3
Author: , 2015-11-27 05:49:22

Windows can use the so - called class driver for a device-a driver for an entire class of devices. For example, in usbstor. inf there is a string "USB\Class_08&SubClass_02&Prot_50", which indicates that for a USB device with class 8 (Mass storage, the main specification for USB), subclass 2 (ATAPI, the specification for Mass Storage class) and protocol 50 (Mass storage bulk only, also speca for Mass Storage class), you need to download USBSTOR.SYS regardless of the specific VID/PID. But if a driver is found by VID-PID-it will be loaded exactly.

 1
Author: Владимир Мартьянов, 2015-12-14 21:47:26