Skip to content

Conversation

jiri-novotny
Copy link

Fix missing user string descriptor getters in MSC and CustomHID USBD_ClassTypeDef

Signed-off-by: Jiri Novotny <jiri.novotny3@jablotron.cz>
@ALABSTM ALABSTM self-assigned this Sep 18, 2025
@ALABSTM ALABSTM added bug Something isn't working mw Middleware-related issue or pull-request. usb USB-related (host or device) issue or pull-request st usb STMicroelectronics' Universal Serial Bus (Host or Device) library labels Sep 18, 2025
@ALABSTM ALABSTM moved this from In progress to To do in stm32cube-mcu-mw-dashboard Sep 18, 2025
@ALABSTM ALABSTM added enhancement New feature or request bug Something isn't working and removed bug Something isn't working enhancement New feature or request labels Sep 23, 2025
@ALABSTM
Copy link
Collaborator

ALABSTM commented Sep 23, 2025

Hi @jiri-novotny,

Thank you for this proposal. I had a look to source files of other classes and noticed the structure member you are referring to is not initialized neither, as you can see below. This can be on purpose. Please let me ask and get back to you once I have more info.

From your side, did you experience any failure or see any reported error due to this uninitialized member?

With regards,

USBD_ClassTypeDef USBD_CCID =
{
USBD_CCID_Init,
USBD_CCID_DeInit,
USBD_CCID_Setup,
NULL, /*EP0_TxSent*/
NULL, /*EP0_RxReady*/
USBD_CCID_DataIn,
USBD_CCID_DataOut,
NULL, /*SOF */
NULL, /*ISOIn*/
NULL, /*ISOOut*/
#ifdef USE_USBD_COMPOSITE
NULL,
NULL,
NULL,
NULL,
#else
USBD_CCID_GetHSCfgDesc,
USBD_CCID_GetFSCfgDesc,
USBD_CCID_GetOtherSpeedCfgDesc,
USBD_CCID_GetDeviceQualifierDescriptor,
#endif /* USE_USBD_COMPOSITE */
};

USBD_ClassTypeDef USBD_HID =
{
USBD_HID_Init,
USBD_HID_DeInit,
USBD_HID_Setup,
NULL, /* EP0_TxSent */
NULL, /* EP0_RxReady */
USBD_HID_DataIn, /* DataIn */
NULL, /* DataOut */
NULL, /* SOF */
NULL,
NULL,
#ifdef USE_USBD_COMPOSITE
NULL,
NULL,
NULL,
NULL,
#else
USBD_HID_GetHSCfgDesc,
USBD_HID_GetFSCfgDesc,
USBD_HID_GetOtherSpeedCfgDesc,
USBD_HID_GetDeviceQualifierDesc,
#endif /* USE_USBD_COMPOSITE */
};

@ALABSTM ALABSTM moved this from To do to Analyzed in stm32cube-mcu-mw-dashboard Sep 23, 2025
@ALABSTM ALABSTM added the internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system label Sep 23, 2025
@ALABSTM
Copy link
Collaborator

ALABSTM commented Sep 23, 2025

ST Internal Reference: 218172

@jiri-novotny
Copy link
Author

That is possible, currently in my app is only using HID and MSC.
Maybe you can also set default value for USBD_SUPPORT_USER_STRING_DESC to 0 in in usbd_conf_template.h

Without change I get this warning:

/data/workspace/stm32/project/lib/stm32-mw-usb-device/Class/CustomHID/Src/usbd_customhid.c:131:1: error: missing initializer for field 'GetUsrStrDescriptor' of 'USBD_ClassTypeDef' {aka 'struct _Device_cb'} [-Werror=missing-field-initializers]
  131 | };
      | ^
In file included from /data/workspace/stm32/project/lib/stm32-mw-usb-device/Core/Inc/usbd_ioreq.h:28,
                 from /data/workspace/stm32/project/lib/stm32-mw-usb-device/Class/CustomHID/Inc/usbd_customhid.h:28,
                 from /data/workspace/stm32/project/lib/stm32-mw-usb-device/Class/CustomHID/Src/usbd_customhid.c:46:
/data/workspace/stm32/project/lib/stm32-mw-usb-device/Core/Inc/usbd_def.h:265:15: note: 'GetUsrStrDescriptor' declared here
  265 |   uint8_t  *(*GetUsrStrDescriptor)(struct _USBD_HandleTypeDef *pdev, uint8_t index,  uint16_t *length);
      |               ^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system mw Middleware-related issue or pull-request. st usb STMicroelectronics' Universal Serial Bus (Host or Device) library usb USB-related (host or device) issue or pull-request

Projects

Development

Successfully merging this pull request may close these issues.

2 participants