summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'stmhal/usb.c')
-rw-r--r--stmhal/usb.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/stmhal/usb.c b/stmhal/usb.c
index 152dc8f3cd..c522b64432 100644
--- a/stmhal/usb.c
+++ b/stmhal/usb.c
@@ -58,10 +58,14 @@ void pyb_usb_dev_init(usb_device_mode_t mode, usb_storage_medium_t medium) {
#ifdef USE_DEVICE_MODE
if (!dev_is_enabled) {
// only init USB once in the device's power-lifetime
+ // Windows needs a different PID to distinguish different device
+ // configurations, so we set it here depending on mode.
if (mode == USB_DEVICE_MODE_CDC_MSC) {
USBD_SelectMode(USBD_MODE_CDC_MSC);
+ USBD_SetPID(0x9800);
} else {
USBD_SelectMode(USBD_MODE_CDC_HID);
+ USBD_SetPID(0x9801);
}
USBD_Init(&hUSBDDevice, (USBD_DescriptorsTypeDef*)&VCP_Desc, 0);
USBD_RegisterClass(&hUSBDDevice, &USBD_CDC_MSC_HID);