Skip to content

Commit bd4ddec

Browse files
abxycarlescufi
authored andcommitted
usb: Add macro for user defined string descriptors
The new macro USBD_STRING_DESCR_USER_DEFINE works like USBD_STRING_DESCR_DEFINE with the exception of being ordered strictly after it. The new macro is needed to ensures that user defined string descriptors can be added without disturbing the order of string descriptors defined by the usb subsystem. Signed-off-by: Alexander Mihajlovic <[email protected]>
1 parent 281ad21 commit bd4ddec

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

include/usb/usb_device.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ extern "C" {
6060
static __in_section(usb, descriptor_##p, 3) __used __aligned(1)
6161
#define USBD_STRING_DESCR_DEFINE(p) \
6262
static __in_section(usb, descriptor_##p, 4) __used __aligned(1)
63-
#define USBD_TERM_DESCR_DEFINE(p) \
63+
#define USBD_STRING_DESCR_USER_DEFINE(p) \
6464
static __in_section(usb, descriptor_##p, 5) __used __aligned(1)
65+
#define USBD_TERM_DESCR_DEFINE(p) \
66+
static __in_section(usb, descriptor_##p, 6) __used __aligned(1)
6567

6668
/*
6769
* This macro should be used to place the struct usb_cfg_data

subsys/usb/class/netusb/function_ecm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ struct usb_cdc_ecm_mac_descr {
399399
uint8_t bString[USB_BSTRING_LENGTH(CONFIG_USB_DEVICE_NETWORK_ECM_MAC)];
400400
} __packed;
401401

402-
USBD_STRING_DESCR_DEFINE(primary) struct usb_cdc_ecm_mac_descr utf16le_mac = {
402+
USBD_STRING_DESCR_USER_DEFINE(primary) struct usb_cdc_ecm_mac_descr utf16le_mac = {
403403
.bLength = USB_STRING_DESCRIPTOR_LENGTH(
404404
CONFIG_USB_DEVICE_NETWORK_ECM_MAC),
405405
.bDescriptorType = USB_DESC_STRING,

0 commit comments

Comments
 (0)