How Do I Disable the SEREMU USB Interface?

submo

Member
I'm working on a Teensy4 USB MIDI device, and I would to disable the SEREMU USB interface, but I'm not sure what's the best way to do this?

I've tried commenting out #define SEREMU_INTERFACE in the usb_desc.h file, but that will cause lots of errors like:
Code:
C:\arduino-1.8.19\hardware\teensy\avr\cores\teensy4\Print.cpp:95:50: error: 'Serial' was not declared in this scope; did you mean 'Serial7'?
   95 |         if (file >= 0 && file <= 2) file = (int)&Serial;
      |                                                  ^~~~~~
      |                                                  Serial7

So any ideas on what's the best way to do this? There's been a couple of forum threads here about the same subject, but with no solution.
TIA
 
NO USB is an option - though that must not be desired.

Looking at arduino-1.8.19\hardware\teensy\avr\cores\teensy4\usb_desc.h:
There are a number of the USB options that do not include "SEREMU_INTERFACE"
Like this one and others: #if defined(USB_SERIAL)

Not sure which was chosen - and perhaps it ends up included some other way
 
My goal is to have just a USB MIDI Device, without any other additional interfaces added. The SEREMU interface (HID) gets added automatically when selecting the USB type as Midi. Like I said I've already tried just commenting out the #define SEREMU_INTERFACE in the Midi section of usb_desc.h, but that seems to have a knock on affect causes errors.

I could simply delete the SEREMU descriptors from usb_desc.c to stop it enumerating as a HID device, but not sure if that's the best way to go about it? or if that may cause other problems?

Was hoping someone here could help guide me on this.
 
I could simply delete the SEREMU descriptors from usb_desc.c to stop it enumerating as a HID device, but not sure if that's the best way to go about it? or if that may cause other problems?

I can confirm you're on the right path.

The code was not designed or tested for what you're trying to accomplish, so you're almost certainly going to have some errors to resolve. The good news is the code is open source, so you can try to modify it to suit your needs. And it does have some attempt to make things configurable with usb_desc.h, so you're not starting from a really difficult place where everything is tightly hard-coded (as with Teensy 2.0). But you can expect to have several errors that need to be resolved, because Serial as either CDC or HID is expected in so many places.

When you do achieve success, please understand the automatic upload from Arduino IDE absolutely will not work. Without either CDC or HID as Serial, there is nothing on the Teensy side to hear the USB communication which requests going into programming mode. You will need to press the pushbutton on Teensy every time you want to get back into programming mode to be able to upload another version of your code. It's a bit tedious, so just know before you do all this troubleshooting work that having to press the pushbutton is the expected end result after you have successfully removed Serial.
 
Back
Top