Skip to content

USE_TINYUSB_HOST check is needed on Pico's to compile #1159

@tuulikauri

Description

@tuulikauri

Describe the bug
Fails to compile on Pico2W (I assume also on Pico, PicoW, and Pico2) if using TinyUSB Host mode.

To Reproduce
Using earle philhower core and Arduino IDE.
In Arduino IDE Tools->USB Stack menu
Select Adafruit TinyUSB Host (Native) as the USB Stack setting
Compile any project.
Control-Surface tries to use TinyUSBDevice.mounted(); but it fails to compile as this isn't found (it's not a USB device when its in host mode, and the check for USE_TINYUSB passes).

This is the fix; add a check for !defined(USE_TINYUSB_HOST) here:
Arduino\libraries\Control_Surface\src\MIDI_Interfaces\PicoUSBInit.hpp Line 16:
defined(USE_TINYUSB) && !defined(CS_USB_MIDI_NOT_SUPPORTED) && !defined(USE_TINYUSB_HOST)

With this change to the library, the code compiles in TinyUSB Host mode on a Pico 2W.

Expected behavior
Compiles.

Code
This is the fix; add !defined(USE_TINYUSB_HOST) here:
Arduino\libraries\Control_Surface\src\MIDI_Interfaces\PicoUSBInit.hpp Line 16:
defined(USE_TINYUSB) && !defined(CS_USB_MIDI_NOT_SUPPORTED) && !defined(USE_TINYUSB_HOST)

Sorry I don't have time to do a PR with this fix right now and I'm starting to forget so thought it's better to leave this brief and incomplete note here. I intend to come back to this with a PR for the fix.

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