From 58532bbb5b704e08a297d1703db221e7525576ae Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Wed, 13 Aug 2025 21:00:38 +0200 Subject: [PATCH] fix(h7): device version in DFU mode (#6513) Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com> --- radio/src/targets/common/arm/stm32/usbd_desc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/radio/src/targets/common/arm/stm32/usbd_desc.c b/radio/src/targets/common/arm/stm32/usbd_desc.c index 7c10c7d44..5a866a4aa 100644 --- a/radio/src/targets/common/arm/stm32/usbd_desc.c +++ b/radio/src/targets/common/arm/stm32/usbd_desc.c @@ -297,6 +297,10 @@ uint8_t * USBD_FS_DeviceDescriptor(USBD_SpeedTypeDef speed, uint16_t *length) int vid, pid; + /* 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); + switch (getSelectedUsbMode()) { case USB_JOYSTICK_MODE: vid = USBD_HID_VID; @@ -316,6 +320,9 @@ uint8_t * USBD_FS_DeviceDescriptor(USBD_SpeedTypeDef speed, uint16_t *length) case USB_DFU_MODE: vid = USBD_DFU_VID; pid = USBD_DFU_PID; + // H7RS and H750 both use 2.00 as 'bcdDevice' version + version_major = 0x02; + version_minor = 0x00; break; #endif default: @@ -323,10 +330,6 @@ uint8_t * USBD_FS_DeviceDescriptor(USBD_SpeedTypeDef speed, uint16_t *length) 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 */ __ALIGN_BEGIN const uint8_t USBD_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END = {