Description:
With USB_WCID defined, the USB library answers the Microsoft OS 1.0 descriptor requests that Windows sends to a new device. Windows 8.1
and later then load their own WinUSB driver for the device when it is first plugged in: there is no driver to install, no
installer to run and no reboot.
The program is unchanged otherwise: it uses the same vendor requests (USB_SETUP_HANDLER, USBBufferWrite), and a PC program using LibUsbDotNet, libusb or WinUSB opens the device by its vendor ID and product ID, or by its device
interface GUID.
Enabling Constants:
| Constant | Controls | Default |
|---|---|---|
|
|
Define it to answer the Microsoft OS 1.0 descriptor requests (the OS string, the Extended Compat ID "WINUSB" and the Extended Properties). |
Not defined |
|
|
The device interface GUID, as a string of 38 characters in the form |
None |
|
|
The request code Windows uses to read the descriptors. It must not be one of the program’s own request codes. |
|
Example:
#chip 18F14K50, 48
#define USB_VID 0x04D8
#define USB_PID 0x0052
#define USB_REV 0x0100
'WinUSB without a driver
#define USB_WCID
#define USB_WCID_GUID "{BFC2B144-FB5A-4F56-98AC-93BC164EED46}"
#define USB_PRODUCT_NAME "GCBASIC WinUSB " + CHIPNAMESTR
#define USB_SETUP_HANDLER SetupHandler_CallBack
#include <usb.h>Notes:
- Windows asks a device for its Microsoft OS descriptors only once for each vendor ID, product ID and
USB_REV(bcdDevice), and remembers the answer. A device first plugged in withoutUSB_WCIDis not asked again untilUSB_REVchanges, or until its key underHKLM\SYSTEM\CurrentControlSet\Control\usbflags\(vendor ID, product ID and revision as twelve hexadecimal digits) is deleted. - The vendor ID and product ID are not those of the LibK driver above (
0x1209/0x2006): a PC with that driver installed would use it for the device instead of WinUSB. - LibUsbDotNet reads the revision from the device’s hardware ID as a decimal number: for
USB_REV 0x0100, search for revision100. - Windows 7 does not read these descriptors: it still needs a driver.
Tested on (but not limited to)
PIC18F14K50, PIC16F1454, PIC16F1455, PIC16F1459, PIC18F46J50 (PIC18F Starter Kit 1)
Windows 11 x64See Also:
- Inputs/Outputs — category overview

