diff options
author | James Buren <braewoods+rb@braewoods.net> | 2021-03-25 13:10:50 -0500 |
---|---|---|
committer | James Buren <braewoods+rb@braewoods.net> | 2021-03-25 13:26:03 -0500 |
commit | 018372bf39d8bc994c9aec325fd71640c4de2f9e (patch) | |
tree | 7115c79c89cde5f34b9e6facacca12e493dbdb38 /firmware/usbstack | |
parent | 7652e6f8dfc1c19876e6c897bc1e7c9a556f58a2 (diff) |
usb: implement macro for initializing USB strings
This uses the new unicode string literal feature that is available
now to greatly simplify the initialization of these special string
types. This makes them much more readable at a quick glance.
Change-Id: Iad8b49aa763486608e3bb7e83fb8abfb48ce0a7b
Diffstat (limited to 'firmware/usbstack')
-rw-r--r-- | firmware/usbstack/usb_core.c | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c index 038aef241f..3d187c8cab 100644 --- a/firmware/usbstack/usb_core.c +++ b/firmware/usbstack/usb_core.c @@ -120,43 +120,22 @@ static const struct usb_qualifier_descriptor __attribute__((aligned(2))) static const struct usb_string_descriptor __attribute__((aligned(2))) usb_string_iManufacturer = -{ - 24, - USB_DT_STRING, - {'R', 'o', 'c', 'k', 'b', 'o', 'x', '.', 'o', 'r', 'g'} -}; +USB_STRING_INITIALIZER(u"Rockbox.org"); static const struct usb_string_descriptor __attribute__((aligned(2))) usb_string_iProduct = -{ - 42, - USB_DT_STRING, - {'R', 'o', 'c', 'k', 'b', 'o', 'x', ' ', - 'm', 'e', 'd', 'i', 'a', ' ', - 'p', 'l', 'a', 'y', 'e', 'r'} -}; +USB_STRING_INITIALIZER(u"Rockbox media player"); static struct usb_string_descriptor __attribute__((aligned(2))) usb_string_iSerial = -{ - 84, - USB_DT_STRING, - {'0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0'} -}; +USB_STRING_INITIALIZER(u"00000000000000000000000000000000000000000"); /* Generic for all targets */ /* this is stringid #0: languages supported */ static const struct usb_string_descriptor __attribute__((aligned(2))) lang_descriptor = -{ - 4, - USB_DT_STRING, - {0x0409} /* LANGID US English */ -}; +USB_STRING_INITIALIZER(u"\x0409"); /* LANGID US English */ static const struct usb_string_descriptor* const usb_strings[] = { |