Skip to content

Commit 5dd455d

Browse files
committed
Change VID/PID info so USB works on Windows.
1 parent fee89d5 commit 5dd455d

2 files changed

Lines changed: 25 additions & 9 deletions

File tree

stm/lib/usbd_desc.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,10 @@
5252
/** @defgroup USBD_DESC_Private_Defines
5353
* @{
5454
*/
55+
/*
5556
#define USBD_VID 0x0483 // TODO set VID
56-
5757
#define USBD_PID 0x5720 // TODO set PID
5858
59-
/** @defgroup USB_String_Descriptors
60-
* @{
61-
*/
6259
#define USBD_LANGID_STRING 0x409
6360
#define USBD_MANUFACTURER_STRING "STMicroelectronics" // TODO set
6461
#define USBD_PRODUCT_HS_STRING "VCP/MSC in HS Mode" // TODO set
@@ -69,10 +66,27 @@
6966
#define USBD_INTERFACE_HS_STRING "VCP/MSC Interface" // TODO set
7067
#define USBD_CONFIGURATION_FS_STRING "VCP/MSC Config" // TODO set
7168
#define USBD_INTERFACE_FS_STRING "VCP/MSC Interface" // TODO set
69+
*/
7270
/**
7371
* @}
7472
*/
7573

74+
// seems we need to use this VID/PID to get it to work on windows
75+
76+
#define USBD_VID 0x0483
77+
#define USBD_PID 0x5740
78+
79+
#define USBD_LANGID_STRING 0x409
80+
#define USBD_MANUFACTURER_STRING "STMicroelectronics"
81+
#define USBD_PRODUCT_HS_STRING "STM32 Virtual ComPort in HS mode"
82+
#define USBD_SERIALNUMBER_HS_STRING "00000000050B"
83+
#define USBD_PRODUCT_FS_STRING "STM32 Virtual ComPort in FS Mode"
84+
#define USBD_SERIALNUMBER_FS_STRING "00000000050C"
85+
#define USBD_CONFIGURATION_HS_STRING "VCP Config"
86+
#define USBD_INTERFACE_HS_STRING "VCP Interface"
87+
#define USBD_CONFIGURATION_FS_STRING "VCP Config"
88+
#define USBD_INTERFACE_FS_STRING "VCP Interface"
89+
7690

7791
/** @defgroup USBD_DESC_Private_Macros
7892
* @{

stm/lib/usbd_pyb_core.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
#include "usbd_msc_bot.h"
7272
#include "usbd_msc_mem.h"
7373

74-
#define USB_PYB_CONFIG_DESC_SIZ 98
74+
#define USB_PYB_CONFIG_DESC_SIZ (98)
7575

7676
#define MSC_EPIN_SIZE MSC_MAX_PACKET
7777
#define MSC_EPOUT_SIZE MSC_MAX_PACKET
@@ -150,7 +150,7 @@ __ALIGN_BEGIN static uint8_t usbd_pyb_CfgDesc[USB_PYB_CONFIG_DESC_SIZ] __ALIGN_E
150150
HIBYTE(USB_PYB_CONFIG_DESC_SIZ),
151151
0x03, // bNumInterfaces: 3 interfaces
152152
0x01, // bConfigurationValue: Configuration value
153-
0x00, // iConfiguration: Index of string descriptor describing the configuration
153+
0x04, // iConfiguration: Index of string descriptor describing the configuration
154154
0x80, // bmAttributes: bus powered; 0xc0 for self powered
155155
0xfa, // bMaxPower: in units of 2mA
156156

@@ -163,7 +163,7 @@ __ALIGN_BEGIN static uint8_t usbd_pyb_CfgDesc[USB_PYB_CONFIG_DESC_SIZ] __ALIGN_E
163163
0x00, // bFunctionClass: ?
164164
0x00, // bFunctionSubClass: ?
165165
0x00, // bFunctionProtocol: ?
166-
0x00, // iFunction: index of string for this function
166+
0x04, // iFunction: index of string for this function
167167

168168
//--------------------------------------------------------------------------
169169
// Interface Descriptor
@@ -252,9 +252,9 @@ __ALIGN_BEGIN static uint8_t usbd_pyb_CfgDesc[USB_PYB_CONFIG_DESC_SIZ] __ALIGN_E
252252
USB_INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType: interface descriptor
253253
0x02, // bInterfaceNumber: Number of Interface
254254
0x00, // bAlternateSetting: Alternate setting
255-
0x02, // bNumEndpoints*/
255+
0x02, // bNumEndpoints
256256
0x08, // bInterfaceClass: MSC Class
257-
0x06, // bInterfaceSubClass : SCSI transparent*/
257+
0x06, // bInterfaceSubClass : SCSI transparent
258258
0x50, // nInterfaceProtocol
259259
0x00, // iInterface:
260260

@@ -397,6 +397,7 @@ static uint8_t usbd_pyb_Setup(void *pdev, USB_SETUP_REQ *req) {
397397

398398
// Standard Device Request ---------------------------------------------
399399
case (USB_REQ_TYPE_STANDARD | USB_REQ_RECIPIENT_DEVICE):
400+
/*
400401
switch (req->bRequest) {
401402
case USB_REQ_GET_DESCRIPTOR:
402403
{
@@ -409,6 +410,7 @@ static uint8_t usbd_pyb_Setup(void *pdev, USB_SETUP_REQ *req) {
409410
return USBD_CtlSendData(pdev, pbuf, len);
410411
}
411412
}
413+
*/
412414
break;
413415

414416
// Standard Interface Request ------------------------------------------

0 commit comments

Comments
 (0)