Skip to content

shared/tinyusb: Fix build errors with CDC support disabled. #17708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions shared/tinyusb/mp_usbd.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@
// Initialise TinyUSB device.
static inline void mp_usbd_init_tud(void) {
tusb_init();
#if MICROPY_HW_USB_CDC
tud_cdc_configure_fifo_t cfg = { .rx_persistent = 0, .tx_persistent = 1 };
tud_cdc_configure_fifo(&cfg);
#endif
}

// Run the TinyUSB device task
Expand Down
4 changes: 4 additions & 0 deletions shared/tinyusb/mp_usbd_descriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ const uint8_t mp_usbd_builtin_desc_cfg[MP_USBD_BUILTIN_DESC_CFG_LEN] = {
};

const uint16_t *tud_descriptor_string_cb(uint8_t index, uint16_t langid) {
#if CFG_TUD_CDC
char serial_buf[MICROPY_HW_USB_DESC_STR_MAX + 1]; // Includes terminating NUL byte
#endif
static uint16_t desc_wstr[MICROPY_HW_USB_DESC_STR_MAX + 1]; // Includes prefix uint16_t
const char *desc_str = NULL;
uint16_t desc_len;
Expand Down Expand Up @@ -95,10 +97,12 @@ const uint16_t *tud_descriptor_string_cb(uint8_t index, uint16_t langid) {
if (desc_str == NULL) {
// Fall back to the "static" string
switch (index) {
#if CFG_TUD_CDC
case USBD_STR_SERIAL:
mp_usbd_port_get_serial_number(serial_buf);
desc_str = serial_buf;
break;
#endif
case USBD_STR_MANUF:
desc_str = MICROPY_HW_USB_MANUFACTURER_STRING;
break;
Expand Down
2 changes: 2 additions & 0 deletions shared/tinyusb/mp_usbd_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,11 @@ static uint16_t runtime_dev_open(uint8_t rhport, tusb_desc_interface_t const *it
}

// If TinyUSB built-in drivers are enabled, don't claim any interface in the built-in range
#if USBD_ITF_BUILTIN_MAX > 0
if (mp_usb_device_builtin_enabled(usbd) && itf_desc->bInterfaceNumber < USBD_ITF_BUILTIN_MAX) {
return 0;
}
#endif

// Determine the total descriptor length of the interface(s) we are going to claim
uint8_t assoc_itf_count = _runtime_dev_count_itfs(itf_desc);
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy