Search code examples
windowsmacosusbdevice-driver

what happens when you plug in a new USB device?


I have an embedded device with a USB connection. When the user plugs the device into their PC (Windows, OSX), how does the operating system discover what drivers to install? How do I get my drivers to be selected? Can they reside on some central server (run by the OS vendor)?


Solution

  • This is for Windows :

    When a USB device is plugged into the system, the USB bus driver is notified. The bus driver sends a standard USB request (USB_DEVICE_DESCRIPTOR) to the device. With this the device reports its name and type. (bDeviceClass/bDeviceSubClass/bDeviceProtocol).

    With this information, Windows creates an device entry in the system. This the Hardware-ID. The system now tries to find either a generic driver which can handle the device (HID/UVC) or a driver which specifically registered itself to support this Hardware-ID.

    To register a driver as the handler for a specific device, you have to install the driver into the system, or you must supply Microsoft with one, which they can provide on their servers.