From d7353fe6fe9c9d421ef045c0eea8d4591710e1ba Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 25 Oct 2014 22:55:07 +0100 Subject: stmhal: Change USB PID when in CDC+HID mode. This gets CDC+HID working on Windows, since it needs a different PID for a different USB configuration. Thanks to tmbinc and dhylands. --- stmhal/usb.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'stmhal/usb.c') diff --git a/stmhal/usb.c b/stmhal/usb.c index 152dc8f3c..c522b6443 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); -- cgit v1.2.3