how to Teensy as All in one (Serial+MIDI+keyboard+Mouse+Audio+MTP)

Well, I guess, I'm guilty on the define issue, when I constructed the USB_MTPDISK_SERIAL many, many years ago, But I agree it would be the time to revise the code to be more flexible.
 
Last edited:
Please complete modification editing of files to work mix of (ser,midi, Audio,MTP) ,and adding option to select for USB type for Ser,midi,Audio,MTP. To test
 
@charnjit.
Read Paul's answer #4 and #7 on number of endpoints.
You can use my solution for testing. If there is something not clear, ask specific questions.
For us to help you, you should show that you read and follow suggestions. We can and are willing to help you and do some testing ourself. The forum is full of such examples. Asking 'Please complete modification editing of files', that is not how this forum works.
 
Paul's answer #4 and #7 on number of endpoints. Serial, Audio and MTP each need 2.
by following above i tried
C++:
#elif defined(USB_MIDI_AUDIO_SERIAL)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x048A
  #define MANUFACTURER_NAME    {'T','e','e','n','s','y','d','u','i','n','o'}
  #define MANUFACTURER_NAME_LEN    11
  #define PRODUCT_NAME        {'T','e','e','n','s','y',' ','M','I','D','I','/','A','u','d','i','o'}
  #define PRODUCT_NAME_LEN    17
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         7
  #define NUM_INTERFACE        6
  #define CDC_IAD_DESCRIPTOR    1
  #define CDC_STATUS_INTERFACE    0
  #define CDC_DATA_INTERFACE    1    // Serial
  #define CDC_ACM_ENDPOINT    2
  #define CDC_RX_ENDPOINT       3
  #define CDC_TX_ENDPOINT       3
  #define CDC_ACM_SIZE          16
  #define CDC_RX_SIZE_480       512
  #define CDC_TX_SIZE_480       512
  #define CDC_RX_SIZE_12        64
  #define CDC_TX_SIZE_12        64
 
  #define MTP_INTERFACE        2    // MTP
  #define MTP_TX_ENDPOINT      4
  #define MTP_TX_SIZE_12       64
  #define MTP_TX_SIZE_480      512
  #define MTP_RX_ENDPOINT      4
  #define MTP_RX_SIZE_12       64
  #define MTP_RX_SIZE_480      512
  #define MTP_EVENT_ENDPOINT    7
  #define MTP_EVENT_SIZE    32
  #define MTP_EVENT_INTERVAL_12    10    // 10 = 10 ms
  #define MTP_EVENT_INTERVAL_480 7    // 7 = 8 ms
 
  #define AUDIO_INTERFACE    3    // Audio (uses 3 consecutive interfaces)
  #define AUDIO_TX_ENDPOINT     5
  #define AUDIO_TX_SIZE         180
  #define AUDIO_RX_ENDPOINT     5
  #define AUDIO_RX_SIZE         180
  #define AUDIO_SYNC_ENDPOINT    6
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG    ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  #define ENDPOINT4_CONFIG    ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  #define ENDPOINT5_CONFIG    ENDPOINT_RECEIVE_ISOCHRONOUS + ENDPOINT_TRANSMIT_ISOCHRONOUS
  #define ENDPOINT6_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_ISOCHRONOUS
  #define ENDPOINT7_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
not work..after it tried line 7
C++:
  #define NUM_ENDPOINTS         6
it also not work...
then i tried to edit line
C++:
#if defined(USB_MTPDISK) || defined(USB_MTPDISK_SERIAL) || defined(USB_MIDI_AUDIO_SERIAL)
in [MTP_Teensy.cpp] and used code
C++:
#elif defined(USB_MIDI_AUDIO_SERIAL)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x048A
  #define MANUFACTURER_NAME    {'T','e','e','n','s','y','d','u','i','n','o'}
  #define MANUFACTURER_NAME_LEN    11
  #define PRODUCT_NAME        {'T','e','e','n','s','y',' ','M','I','D','I','/','A','u','d','i','o'}
  #define PRODUCT_NAME_LEN    17
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         7
  #define NUM_INTERFACE        6
  #define CDC_IAD_DESCRIPTOR    1
  #define CDC_STATUS_INTERFACE    0
  #define CDC_DATA_INTERFACE    1    // Serial
  #define CDC_ACM_ENDPOINT    2
  #define CDC_RX_ENDPOINT       3
  #define CDC_TX_ENDPOINT       3
  #define CDC_ACM_SIZE          16
  #define CDC_RX_SIZE_480       512
  #define CDC_TX_SIZE_480       512
  #define CDC_RX_SIZE_12        64
  #define CDC_TX_SIZE_12        64
 
  #define MTP_INTERFACE        2    // MTP
  #define MTP_TX_ENDPOINT      4
  #define MTP_TX_SIZE_12       64
  #define MTP_TX_SIZE_480      512
  #define MTP_RX_ENDPOINT      4
  #define MTP_RX_SIZE_12       64
  #define MTP_RX_SIZE_480      512
  #define MTP_EVENT_ENDPOINT    7
  #define MTP_EVENT_SIZE    32
  #define MTP_EVENT_INTERVAL_12    10    // 10 = 10 ms
  #define MTP_EVENT_INTERVAL_480 7    // 7 = 8 ms
 
  #define AUDIO_INTERFACE    3    // Audio (uses 3 consecutive interfaces)
  #define AUDIO_TX_ENDPOINT     5
  #define AUDIO_TX_SIZE         180
  #define AUDIO_RX_ENDPOINT     5
  #define AUDIO_RX_SIZE         180
  #define AUDIO_SYNC_ENDPOINT    6
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG    ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  #define ENDPOINT4_CONFIG    ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  #define ENDPOINT5_CONFIG    ENDPOINT_RECEIVE_ISOCHRONOUS + ENDPOINT_TRANSMIT_ISOCHRONOUS
  #define ENDPOINT6_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_ISOCHRONOUS
  #define ENDPOINT7_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
given by WMXZ. in post #20
it also not work...........
i am really Disapointed. what to try???
 
Last edited:
@charnjit: Did you follow the required advice in post #18, post #21, & <post #22> regarding changing the PID each & every time that you made a change (to get around Windows' undesirable caching of configurations) ?? Without making that specific change, your updates are probably not getting recognized (as @PaulStoffregen explained). You may actually have a correct configuration, but Windows caching may be hiding your potential success.

Mark J Culross
KD5RXT
 
Where can i see to change the PID number or BCD version number with each edit.
inwhich file it is shown???
i will try it now,, please reply
 
PID mean Product_ID, as said in #22. Please read always what has been written so far.
 
inwhich set of interface should be made changes
USB_MTPDISK or USB_MTPDISK_SERIAL or USB_MIDI_AUDIO_SERIAL or ?Any more?

As
#define PRODUCT_ID 0x04D1 is for USB_MTPDISK
#define PRODUCT_ID 0x048A is for USB_MTPDISK_SERIAL
#define PRODUCT_ID 0x048A is for USB_MIDI_AUDIO_SERIAL
what new ID should be try ,,i don't have idea ......Please guess and reply???
 
The one in your modified descriptor. I would simply use 0x048B and try. Note when changing descriptor you need to press the boot button.
Also, you should uninstall the COM ports (I do not have a Win7, so I cannot advice how, but google 'Windows 7 uninstall com ports' should give you instructions). Maybe windows will then forget the settings. It works for later Windows.
 
Thank a lot WMXZ .. Your suggetion helped me . Device got ready (Serial+Audio+MTP)....
A short code i got in this thread working....
C++:
#include <SD.h>
#include <MTP_Teensy.h>
#define CS_SD BUILTIN_SDCARD

void setup() {
  Serial.begin(9600);
  MTP.begin();
  SD.begin(CS_SD);
  MTP.addFilesystem(SD, "SD Card");
}

void loop() {
  MTP.loop();  //This is mandatory to be placed in the loop code. Serial.begin(9600);
}
my win7 detect Teensy's SD Card successfully
thank you
 
what new ID should be try ,,i don't have idea ......Please guess and reply???
Note: PJRC I purchased a certain number of PIDs, I am not sure how many he still has left.

If you ever look up VIDs, like using:

You will see output like:
1762376875578.png

That is the VID of 0x16c0 is owned by Van Ooijen, but I believe he was selling of parts of it as there is only so many
possible VIDs...

The other thing I ran into when testing MTP, was on Linux machines with Paul's udev.rules
```
#
# The latest version of this file may be found at:
# http://www.pjrc.com/teensy/00-teensy.rules
#
# This file must be placed at:
#
# /etc/udev/rules.d/00-teensy.rules (preferred location)
# or
# /lib/udev/rules.d/00-teensy.rules (req'd on some broken systems)
#
# To install, type this command in a terminal:
# sudo cp 00-teensy.rules /etc/udev/rules.d/00-teensy.rules
#
# After this file is installed, physically unplug and reconnect Teensy.
#
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04*", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1"
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789a]*", ENV{MTP_NO_PROBE}="1"
KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04*", MODE:="0666", RUN:="/bin/stty -F /dev/%k raw -echo"
KERNEL=="hidraw*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04*", MODE:="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04*", MODE:="0666"
KERNEL=="hidraw*", ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="013*", MODE:="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="013*", MODE:="0666"

#
# If you share your linux system with other users, or just don't like the
# idea of write permission for everybody, you can replace MODE:="0666" with
# OWNER:="yourusername" to create the device owned by you, or with
# GROUP:="somegroupname" and mange access using standard unix groups.
#
# ModemManager tends to interfere with USB Serial devices like Teensy.
# Problems manifest as the Arduino Serial Monitor missing some incoming
# data, and "Unable to open /dev/ttyACM0 for reboot request" when
# uploading. If you experience these problems, disable or remove
# ModemManager from your system. If you must use a modem, perhaps
# try disabling the "MM_FILTER_RULE_TTY_ACM_INTERFACE" ModemManager
# rule. Changing ModemManager's filter policy from "strict" to "default"
# may also help. But if you don't use a modem, completely removing
# the troublesome ModemManager is the most effective solution.
```
That there are ranges of PIDs that are specifically told not to try MTP on:
Code:
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789a]*", ENV{MTP_NO_PROBE}="1"

So for example:
Code:
#define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x04D1
Works, that is it does not set the MTP_NO_PROBE,

But:
Code:
#elif defined(USB_MIDI16_AUDIO_SERIAL)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x048A
Does match and as such MTP won't work with it...
 
True, for Linux, but Windows has no idea of the udev rules so MTP may appear to work fine on that, only to fail on Linux...

There would also seem to be a limited subset of the unknown range of Teensy PIDs for which the SEREMU interface will work. Undocumented AFAIK, so once again we're left groping about in the dark.
 
My hunch is that for personal and on Windows use any PID should work. For example using the PID from USE_EVERYTHING (0x0476) could be a good candidate for testing and custom usb descriptor, as it is not implemented in T4.x (too many endpoints?)
 
For any version of Windows, you need to use a different PID/Version combo to get Windows to pay attention to the fact your device is different than the last time it connected. It's really annoying, but that's how Microsoft made it.

However, Windows is able to detect some changes with the same VID/PID/Version number, so this isn't a 100% absolute rule. Just know that it will sometimes use old info.

Of course with Windows 7 you will also be facing other really frustrating problems. Many people believe Windows was solid because everyone in the world used it for so long, but the reality before Windows 10 was Microsoft shipped a lot of very buggy USB code. It only worked well because they had a virtual monopoly. Every USB device developer had to test with Windows, avoiding the problems. USB products of that era generally didn't do ambitious things like several USB interfaces on the same USB device. Usually manufacturers supplied their own drivers, because pre-10 Windows was so bad. For making a custom USB device with so much stuff, you really should use Linux or at least Windows 10.
 
Another approach to changing to a previously unused PID/Version is to use something like USBDeview to uninstall the device from Windows. (It’s a fairly complex tool, please be sure to read the documentation properly.)

I also use USBtreeView, which will often show warnings if you’ve messed up the USB descriptors somehow.

@PaulStoffregen, is there any chance at all you could take your eyes off the other balls you’re juggling and provide some documentation on publicly available Teensy PIDs (that e.g. the loader will identify as a Teensy when re-programming), and any “special values” that exist, like valid ranges for the teensy_gateway used for SEREMU?
 
Back
Top