Skip to content

Adafruit TinyUSB 3.5.0 change breaks this library #28

Open
@maxgerhardt

Description

@maxgerhardt

Describe the bug

In the future, when the library is compiled against the newly-released Adafruit TinyUSB 3.5.0 version, this library will fail to compile. It uses the USBH_EPSIZE_BULK_MAX enum defined in a private include header (host/usbh_pvt.h)

#ifndef CFG_TUH_MAX_CABLES
#define CFG_TUH_MAX_CABLES 16
#endif
#ifndef CFG_TUH_MIDI_RX_BUFSIZE
#define CFG_TUH_MIDI_RX_BUFSIZE USBH_EPSIZE_BULK_MAX
#endif
#ifndef CFG_TUH_MIDI_TX_BUFSIZE
#define CFG_TUH_MIDI_TX_BUFSIZE USBH_EPSIZE_BULK_MAX
#endif
#ifndef CFG_TUH_MIDI_EP_BUFSIZE
#define CFG_TUH_MIDI_EP_BUFSIZE USBH_EPSIZE_BULK_MAX
#endif

Which was removed in adafruit/Adafruit_TinyUSB_Arduino@fafc824. All usages of this enum seem to have been replaced with USBH_EPSIZE_BULK_MAX, which was newly defined in the src/host/usbh.h header.

To Reproduce
Steps to reproduce the behavior:

  1. See project setup in https://community.platformio.org/t/usbh-epsize-bulk-max-not-defined-in-usb-midi-host-library/47483/3?u=maxgerhardt

Expected behavior
Library should not include and use types from a private include header, as the things defined therein can change without notice, not being part of an official API.

A version that would for Adafruit TinyUSB below and above 3.5.0 is to redefine

#define USED_MIDI_EPSIZE_BULK_MPS   (TUD_OPT_HIGH_SPEED ? TUSB_EPSIZE_BULK_HS : TUSB_EPSIZE_BULK_FS)

since all these values are defined in the public API src/common/tusb_types.h.

Screenshots
-/-

What is your setup like?

  • Arduino
  • Target hardware board: Adafruit Feather USB Host (Raspberry Pi RP2040)
  • What is your build machine: Windows
  • What build machine OS and version: Windows 10
  • Version of this library: 2.2.0
  • Version of build software: PlatformIO, platform-raspberrypi 55cd180ac22e612e7528ddac8d3fda63e09c666d
  • How are you loading build images to the target: -/-

Additional context

Error message when using Adafruit TinyUSB 3.5.0

.pio\libdeps\adafruit_feather_usb_host\usb_midi_host\usb_midi_host.c:42:35: error: 'USBH_EPSIZE_BULK_MAX' undeclared here (not in a function); did you mean 'TUSB_EPSIZE_BULK_HS'?
   42 |   #define CFG_TUH_MIDI_RX_BUFSIZE USBH_EPSIZE_BULK_MAX
      |                                   ^~~~~~~~~~~~~~~~~~~~
.pio\libdeps\adafruit_feather_usb_host\usb_midi_host\usb_midi_host.c:56:19: note: in expansion of macro 'CFG_TUH_MIDI_RX_BUFSIZE'
   56 | } midih_limits = {CFG_TUH_MIDI_RX_BUFSIZE, CFG_TUH_MIDI_TX_BUFSIZE, CFG_TUH_MAX_CABLES};
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
Compiling .pio\build\adafruit_feather_usb_host\src\main.cpp.o
*** [.pio\build\adafruit_feather_usb_host\libf67\usb_midi_host\usb_midi_host.c.o] 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions