-#define DEFINE_USB_STRING(__name, __text) \
- struct { \
- UsbDescHeader __header; \
- uint8_t __body[sizeof(__text)]; \
- } PACKED __name = { \
- .__header = { \
- .bLength = sizeof(__name), \
- .bDescriptorType = USB_DT_STRING, \
- }, \
- .__body = {__text}, \
+/**
+ * Define and initialize an USB string descriptor.
+ *
+ * This macro is reuquired to properly declare and initialize a constant USB
+ * string in UTF-16LE format.
+ *
+ * The structure must contain the standard common USB header (UsbDescHeader)
+ * and the UTF-16LE string all packed in a contiguous memory region.
+ */
+#define DEFINE_USB_STRING(__name, __text) \
+ struct { \
+ UsbDescHeader __header; \
+ uint8_t __body[sizeof(__text)]; \
+ } PACKED __name = { \
+ .__header = { \
+ .bLength = \
+ cpu_to_le16((uint16_t)sizeof(__name)), \
+ .bDescriptorType = USB_DT_STRING, \
+ }, \
+ .__body = {__text}, \