4343#define USBD_SERIALNUMBER_HS_STRING "000000000010"
4444#define USBD_PRODUCT_FS_STRING "Pyboard Virtual Comm Port in FS Mode"
4545#define USBD_SERIALNUMBER_FS_STRING "000000000011"
46- #define USBD_CONFIGURATION_HS_STRING "VCP Config"
47- #define USBD_INTERFACE_HS_STRING "VCP Interface"
48- #define USBD_CONFIGURATION_FS_STRING "VCP Config"
49- #define USBD_INTERFACE_FS_STRING "VCP Interface"
46+ #define USBD_CONFIGURATION_HS_STRING "Pyboard Config"
47+ #define USBD_INTERFACE_HS_STRING "Pyboard Interface"
48+ #define USBD_CONFIGURATION_FS_STRING "Pyboard Config"
49+ #define USBD_INTERFACE_FS_STRING "Pyboard Interface"
5050
5151// USB Standard Device Descriptor
52+ // needs to be in RAM because we modify the VID and PID
5253__ALIGN_BEGIN static uint8_t hUSBDDeviceDesc [USB_LEN_DEV_DESC ] __ALIGN_END = {
5354 0x12 , // bLength
5455 USB_DESC_TYPE_DEVICE , // bDescriptorType
5556 0x00 , // bcdUSB
5657 0x02 ,
57- 0x00 , // bDeviceClass
58- 0x00 , // bDeviceSubClass
59- 0x00 , // bDeviceProtocol
58+ 0xef , // bDeviceClass: Miscellaneous Device Class
59+ 0x02 , // bDeviceSubClass: Common Class
60+ 0x01 , // bDeviceProtocol: Interface Association Descriptor
6061 USB_MAX_EP0_SIZE , // bMaxPacketSize
6162 LOBYTE (USBD_VID ), // idVendor
6263 HIBYTE (USBD_VID ), // idVendor
@@ -91,7 +92,7 @@ void USBD_SetPID(uint16_t pid) {
9192 * @param length: Pointer to data length variable
9293 * @retval Pointer to descriptor buffer
9394 */
94- STATIC uint8_t * USBD_VCP_DeviceDescriptor (USBD_SpeedTypeDef speed , uint16_t * length ) {
95+ STATIC uint8_t * USBD_DeviceDescriptor (USBD_SpeedTypeDef speed , uint16_t * length ) {
9596 * length = sizeof (hUSBDDeviceDesc );
9697 return hUSBDDeviceDesc ;
9798}
@@ -102,7 +103,7 @@ STATIC uint8_t *USBD_VCP_DeviceDescriptor(USBD_SpeedTypeDef speed, uint16_t *len
102103 * @param length: Pointer to data length variable
103104 * @retval Pointer to descriptor buffer
104105 */
105- STATIC uint8_t * USBD_VCP_LangIDStrDescriptor (USBD_SpeedTypeDef speed , uint16_t * length ) {
106+ STATIC uint8_t * USBD_LangIDStrDescriptor (USBD_SpeedTypeDef speed , uint16_t * length ) {
106107 * length = sizeof (USBD_LangIDDesc );
107108 return USBD_LangIDDesc ;
108109}
@@ -113,7 +114,7 @@ STATIC uint8_t *USBD_VCP_LangIDStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *
113114 * @param length: Pointer to data length variable
114115 * @retval Pointer to descriptor buffer
115116 */
116- STATIC uint8_t * USBD_VCP_ProductStrDescriptor (USBD_SpeedTypeDef speed , uint16_t * length ) {
117+ STATIC uint8_t * USBD_ProductStrDescriptor (USBD_SpeedTypeDef speed , uint16_t * length ) {
117118 if (speed == 0 ) {
118119 USBD_GetString ((uint8_t * )USBD_PRODUCT_HS_STRING , USBD_StrDesc , length );
119120 } else {
@@ -128,7 +129,7 @@ STATIC uint8_t *USBD_VCP_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t
128129 * @param length: Pointer to data length variable
129130 * @retval Pointer to descriptor buffer
130131 */
131- STATIC uint8_t * USBD_VCP_ManufacturerStrDescriptor (USBD_SpeedTypeDef speed , uint16_t * length ) {
132+ STATIC uint8_t * USBD_ManufacturerStrDescriptor (USBD_SpeedTypeDef speed , uint16_t * length ) {
132133 USBD_GetString ((uint8_t * )USBD_MANUFACTURER_STRING , USBD_StrDesc , length );
133134 return USBD_StrDesc ;
134135}
@@ -139,7 +140,7 @@ STATIC uint8_t *USBD_VCP_ManufacturerStrDescriptor(USBD_SpeedTypeDef speed, uint
139140 * @param length: Pointer to data length variable
140141 * @retval Pointer to descriptor buffer
141142 */
142- STATIC uint8_t * USBD_VCP_SerialStrDescriptor (USBD_SpeedTypeDef speed , uint16_t * length ) {
143+ STATIC uint8_t * USBD_SerialStrDescriptor (USBD_SpeedTypeDef speed , uint16_t * length ) {
143144 if (speed == USBD_SPEED_HIGH ) {
144145 USBD_GetString ((uint8_t * )USBD_SERIALNUMBER_HS_STRING , USBD_StrDesc , length );
145146 } else {
@@ -154,7 +155,7 @@ STATIC uint8_t *USBD_VCP_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *
154155 * @param length: Pointer to data length variable
155156 * @retval Pointer to descriptor buffer
156157 */
157- STATIC uint8_t * USBD_VCP_ConfigStrDescriptor (USBD_SpeedTypeDef speed , uint16_t * length ) {
158+ STATIC uint8_t * USBD_ConfigStrDescriptor (USBD_SpeedTypeDef speed , uint16_t * length ) {
158159 if (speed == USBD_SPEED_HIGH ) {
159160 USBD_GetString ((uint8_t * )USBD_CONFIGURATION_HS_STRING , USBD_StrDesc , length );
160161 } else {
@@ -169,7 +170,7 @@ STATIC uint8_t *USBD_VCP_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *
169170 * @param length: Pointer to data length variable
170171 * @retval Pointer to descriptor buffer
171172 */
172- STATIC uint8_t * USBD_VCP_InterfaceStrDescriptor (USBD_SpeedTypeDef speed , uint16_t * length ) {
173+ STATIC uint8_t * USBD_InterfaceStrDescriptor (USBD_SpeedTypeDef speed , uint16_t * length ) {
173174 if (speed == 0 ) {
174175 USBD_GetString ((uint8_t * )USBD_INTERFACE_HS_STRING , USBD_StrDesc , length );
175176 } else {
@@ -178,14 +179,14 @@ STATIC uint8_t *USBD_VCP_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_
178179 return USBD_StrDesc ;
179180}
180181
181- const USBD_DescriptorsTypeDef VCP_Desc = {
182- USBD_VCP_DeviceDescriptor ,
183- USBD_VCP_LangIDStrDescriptor ,
184- USBD_VCP_ManufacturerStrDescriptor ,
185- USBD_VCP_ProductStrDescriptor ,
186- USBD_VCP_SerialStrDescriptor ,
187- USBD_VCP_ConfigStrDescriptor ,
188- USBD_VCP_InterfaceStrDescriptor ,
182+ const USBD_DescriptorsTypeDef USBD_Descriptors = {
183+ USBD_DeviceDescriptor ,
184+ USBD_LangIDStrDescriptor ,
185+ USBD_ManufacturerStrDescriptor ,
186+ USBD_ProductStrDescriptor ,
187+ USBD_SerialStrDescriptor ,
188+ USBD_ConfigStrDescriptor ,
189+ USBD_InterfaceStrDescriptor ,
189190};
190191
191192/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
0 commit comments