fix(usb): report correct version number (#4904)
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
/* USER CODE BEGIN INCLUDE */
|
/* USER CODE BEGIN INCLUDE */
|
||||||
#include "hal/usb_driver.h"
|
#include "hal/usb_driver.h"
|
||||||
#include "usb_descriptor.h"
|
#include "usb_descriptor.h"
|
||||||
|
#include "stamp.h"
|
||||||
/* USER CODE END INCLUDE */
|
/* USER CODE END INCLUDE */
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
@@ -295,12 +296,16 @@ uint8_t * USBD_FS_DeviceDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
|||||||
pid = 0;
|
pid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* version has to be bcd coded */
|
||||||
|
uint8_t version_minor = ((VERSION_MINOR / 10) << 4) | (VERSION_MINOR % 10);
|
||||||
|
uint8_t version_major = ((VERSION_MAJOR / 10) << 4) | (VERSION_MAJOR % 10);
|
||||||
|
|
||||||
/* USB Standard Device Descriptor */
|
/* USB Standard Device Descriptor */
|
||||||
__ALIGN_BEGIN const uint8_t USBD_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
__ALIGN_BEGIN const uint8_t USBD_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
|
||||||
{
|
{
|
||||||
USB_LEN_DEV_DESC, /*bLength */
|
USB_LEN_DEV_DESC, /*bLength */
|
||||||
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
|
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
|
||||||
0x00, /*bcdUSB */
|
0x00, /*bcdUSB USB specification release number in binary-coded decimal*/
|
||||||
0x02,
|
0x02,
|
||||||
0x00, /*bDeviceClass*/
|
0x00, /*bDeviceClass*/
|
||||||
0x00, /*bDeviceSubClass*/
|
0x00, /*bDeviceSubClass*/
|
||||||
@@ -308,11 +313,11 @@ uint8_t * USBD_FS_DeviceDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
|
|||||||
USB_MAX_EP0_SIZE, /*bMaxPacketSize*/
|
USB_MAX_EP0_SIZE, /*bMaxPacketSize*/
|
||||||
LOBYTE(vid), /*idVendor*/
|
LOBYTE(vid), /*idVendor*/
|
||||||
HIBYTE(vid), /*idVendor*/
|
HIBYTE(vid), /*idVendor*/
|
||||||
LOBYTE(pid), /*idVendor*/
|
LOBYTE(pid), /*idProduct*/
|
||||||
HIBYTE(pid), /*idVendor*/
|
HIBYTE(pid), /*idProduct*/
|
||||||
0x00, /*bcdDevice rel. 2.00*/
|
version_minor, /*bcdDevice device release number in binary-coded decimal*/
|
||||||
0x02,
|
version_major,
|
||||||
USBD_IDX_MFC_STR, /*Index of manufacturer string*/
|
USBD_IDX_MFC_STR, /*Index of manufacturer string*/
|
||||||
USBD_IDX_PRODUCT_STR, /*Index of product string*/
|
USBD_IDX_PRODUCT_STR, /*Index of product string*/
|
||||||
USBD_IDX_SERIAL_STR, /*Index of serial number string*/
|
USBD_IDX_SERIAL_STR, /*Index of serial number string*/
|
||||||
USBD_MAX_NUM_CONFIGURATION /*bNumConfigurations*/
|
USBD_MAX_NUM_CONFIGURATION /*bNumConfigurations*/
|
||||||
|
|||||||
Reference in New Issue
Block a user