Skip to content

Commit

Permalink
ADD: interface descriptor UART names
Browse files Browse the repository at this point in the history
  • Loading branch information
r2axz committed Feb 8, 2022
1 parent f7d8576 commit 3ee0271
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
20 changes: 13 additions & 7 deletions usb_descriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,22 @@ const usb_endpoint_t usb_endpoints[usb_endpoint_address_last] = {
},
};

const usb_string_descriptor_t usb_string_lang = USB_ARRAY_DESC(usb_language_code_en_US);
const usb_string_descriptor_t usb_string_manufacturer = USB_STRING_DESC("R2AXZ Kirill Kotyagin");
const usb_string_descriptor_t usb_string_product = USB_STRING_DESC("Bluepill Serial Monster");
const usb_string_descriptor_t usb_string_serial = USB_STRING_DESC("NO SERIAL"); /* Placeholder, replaced by STM32 UID */
const usb_string_descriptor_t usb_string_lang = USB_ARRAY_DESC(usb_language_code_en_US);
const usb_string_descriptor_t usb_string_manufacturer = USB_STRING_DESC("R2AXZ Kirill Kotyagin");
const usb_string_descriptor_t usb_string_product = USB_STRING_DESC("Bluepill Serial Monster");
const usb_string_descriptor_t usb_string_serial = USB_STRING_DESC("NO SERIAL"); /* Placeholder, replaced by STM32 UID */
const usb_string_descriptor_t usb_string_uart_1_interface_name = USB_STRING_DESC("UART1");
const usb_string_descriptor_t usb_string_uart_2_interface_name = USB_STRING_DESC("UART2");
const usb_string_descriptor_t usb_string_uart_3_interface_name = USB_STRING_DESC("UART3");

const usb_string_descriptor_t *usb_string_descriptors[usb_string_index_last] = {
&usb_string_lang,
&usb_string_manufacturer,
&usb_string_product,
&usb_string_serial,
&usb_string_uart_1_interface_name,
&usb_string_uart_2_interface_name,
&usb_string_uart_3_interface_name,
};

const usb_device_descriptor_t usb_device_descriptor = {
Expand Down Expand Up @@ -126,7 +132,7 @@ const usb_device_configuration_descriptor_t usb_configuration_descriptor = {
.bInterfaceClass = usb_class_cdc,
.bInterfaceSubClass = usb_subclass_cdc_acm,
.bInterfaceProtocol = USB_PROTOCOL_CDC_DEFAULT,
.iInterface = usb_string_index_none
.iInterface = usb_string_index_uart_1_interface_name,
},
.cdc_hdr_0 = {
.bFunctionLength = sizeof(usb_configuration_descriptor.cdc_hdr_0),
Expand Down Expand Up @@ -208,7 +214,7 @@ const usb_device_configuration_descriptor_t usb_configuration_descriptor = {
.bInterfaceClass = usb_class_cdc,
.bInterfaceSubClass = usb_subclass_cdc_acm,
.bInterfaceProtocol = USB_PROTOCOL_CDC_DEFAULT,
.iInterface = usb_string_index_none
.iInterface = usb_string_index_uart_2_interface_name,
},
.cdc_hdr_1 = {
.bFunctionLength = sizeof(usb_configuration_descriptor.cdc_hdr_1),
Expand Down Expand Up @@ -290,7 +296,7 @@ const usb_device_configuration_descriptor_t usb_configuration_descriptor = {
.bInterfaceClass = usb_class_cdc,
.bInterfaceSubClass = usb_subclass_cdc_acm,
.bInterfaceProtocol = USB_PROTOCOL_CDC_DEFAULT,
.iInterface = usb_string_index_none
.iInterface = usb_string_index_uart_3_interface_name,
},
.cdc_hdr_2 = {
.bFunctionLength = sizeof(usb_configuration_descriptor.cdc_hdr_2),
Expand Down
3 changes: 3 additions & 0 deletions usb_descriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ typedef enum {
usb_string_index_manufacturer,
usb_string_index_product,
usb_string_index_serial,
usb_string_index_uart_1_interface_name,
usb_string_index_uart_2_interface_name,
usb_string_index_uart_3_interface_name,
usb_string_index_last,
} __attribute__ ((packed)) usb_string_index_t;

Expand Down

0 comments on commit 3ee0271

Please sign in to comment.