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

charnjit

Well-known member
I want to All in one AS in title of thread above. when we select board "Teensy 4.1" from TOOLS menu ..looking no option

supported to (Serial+MIDI+keyboard+Mouse+Audio+MTP). if it is possible , i guess modification needed in files...
usb_desc.h from C:\Program Files\Arduino\hardware\teensy\avr\cores\teensy4
usb_desc.c from C:\Program Files\Arduino\hardware\teensy\avr\cores\teensy4
boards.txt from C:\Program Files\Arduino\hardware\teensy\avr
but i don't know what & Inwhich file??
i am showing them below
-usb_desc.h...... from [C:\Program Files\Arduino\hardware\teensy\avr\cores\teensy4]
C++:
/* Teensyduino Core Library
 * http://www.pjrc.com/teensy/
 * Copyright (c) 2017 PJRC.COM, LLC.
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * 1. The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * 2. If the Software is incorporated into a build system that allows
 * selection among a list of target devices, then similar target
 * devices manufactured by PJRC.COM must be included in the list of
 * target devices and selectable in the same manner.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

#pragma once

// This header is NOT meant to be included when compiling
// user sketches in Arduino.  The low-level functions
// provided by usb_dev.c are meant to be called only by
// code which provides higher-level interfaces to the user.

#include <stdint.h>
#include <stddef.h>

#define ENDPOINT_TRANSMIT_UNUSED    0x00020000
#define ENDPOINT_TRANSMIT_ISOCHRONOUS    0x00C40000
#define ENDPOINT_TRANSMIT_BULK        0x00C80000
#define ENDPOINT_TRANSMIT_INTERRUPT    0x00CC0000
#define ENDPOINT_RECEIVE_UNUSED        0x00000002
#define ENDPOINT_RECEIVE_ISOCHRONOUS    0x000000C4
#define ENDPOINT_RECEIVE_BULK        0x000000C8
#define ENDPOINT_RECEIVE_INTERRUPT    0x000000CC

/*
Each group of #define lines below corresponds to one of the
settings in the Tools > USB Type menu.  This file defines what
type of USB device is actually created for each of those menu
options.

Each "interface" is a set of functionality your PC or Mac will
use and treat as if it is a unique device.  Within each interface,
the "endpoints" are the actual communication channels.  Most
interfaces use 1, 2 or 3 endpoints.  By editing only this file,
you can customize the USB Types to be any collection of interfaces.

To modify a USB Type, delete the XYZ_INTERFACE lines for any
interfaces you wish to remove, and copy them from another USB Type
for any you want to add.

Give each interface a unique number, and edit NUM_INTERFACE to
reflect the total number of interfaces.

Next, assign unique endpoint numbers to all the endpoints across
all the interfaces your device has.  You can reuse an endpoint
number for transmit and receive, but the same endpoint number must
not be used twice to transmit, or twice to receive.

Most endpoints also require their maximum size, and some also
need an interval specification (the number of milliseconds the
PC will check for data from that endpoint).  For existing
interfaces, usually these other settings should not be changed.

Edit NUM_ENDPOINTS to be at least the largest endpoint number used.

Edit the ENDPOINT*_CONFIG lines so each endpoint is configured
the proper way (transmit, receive, or both).

If you are using existing interfaces (making your own device with
a different set of interfaces) the code in all other files should
automatically adapt to the new endpoints you specify here.

If you need to create a new type of interface, you'll need to write
the code which sends and receives packets, and presents an API to
the user.  Usually, a pair of files are added for the actual code,
and code is also added in usb_dev.c for any control transfers,
interrupt-level code, or other very low-level stuff not possible
from the packet send/receive functons.  Code also is added in
usb_inst.c to create an instance of your C++ object.  This message
gives a quick summary of things you will need to know:
https://forum.pjrc.com/threads/49045?p=164512&viewfull=1#post164512

You may edit the Vendor and Product ID numbers, and strings.  If
the numbers are changed, Teensyduino may not be able to automatically
find and reboot your board when you click the Upload button in
the Arduino IDE.  You will need to press the Program button on
Teensy to initiate programming.

Some operating systems, especially Windows, may cache USB device
info.  Changes to the device name may not update on the same
computer unless the vendor or product ID numbers change, or the
"bcdDevice" revision code is increased.

If these instructions are missing steps or could be improved, please
let me know?  http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports
*/


#if defined(USB_SERIAL)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x0483
  #define MANUFACTURER_NAME    {'T','e','e','n','s','y','d','u','i','n','o'}
  #define MANUFACTURER_NAME_LEN    11
  #define PRODUCT_NAME        {'U','S','B',' ','S','e','r','i','a','l'}
  #define PRODUCT_NAME_LEN    10
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS        4
  #define NUM_USB_BUFFERS    12
  #define NUM_INTERFACE        3
  #define CDC_IAD_DESCRIPTOR    1       // Serial
  #define CDC_STATUS_INTERFACE    0
  #define CDC_DATA_INTERFACE    1
  #define CDC_ACM_ENDPOINT    2
  #define CDC_RX_ENDPOINT       3
  #define CDC_TX_ENDPOINT       4
  #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 EXPERIMENTAL_INTERFACE 2
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG    ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_UNUSED
  #define ENDPOINT4_CONFIG      ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_BULK

#elif defined(USB_DUAL_SERIAL)
  #define VENDOR_ID             0x16C0
  #define PRODUCT_ID            0x048B
  #define MANUFACTURER_NAME     {'T','e','e','n','s','y','d','u','i','n','o'}
  #define MANUFACTURER_NAME_LEN 11
  #define PRODUCT_NAME          {'D','u','a','l',' ','S','e','r','i','a','l'}
  #define PRODUCT_NAME_LEN      11
  #define EP0_SIZE              64
  #define NUM_ENDPOINTS         5
  #define NUM_INTERFACE         4
  #define CDC_IAD_DESCRIPTOR    1       // Serial
  #define CDC_STATUS_INTERFACE  0
  #define CDC_DATA_INTERFACE    1
  #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 CDC2_STATUS_INTERFACE 2       // SerialUSB1
  #define CDC2_DATA_INTERFACE   3
  #define CDC2_ACM_ENDPOINT     4
  #define CDC2_RX_ENDPOINT      5
  #define CDC2_TX_ENDPOINT      5
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG    ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  #define ENDPOINT4_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT5_CONFIG    ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK

#elif defined(USB_TRIPLE_SERIAL)
  #define VENDOR_ID             0x16C0
  #define PRODUCT_ID            0x048C
  #define MANUFACTURER_NAME     {'T','e','e','n','s','y','d','u','i','n','o'}
  #define MANUFACTURER_NAME_LEN 11
  #define PRODUCT_NAME          {'T','r','i','p','l','e',' ','S','e','r','i','a','l'}
  #define PRODUCT_NAME_LEN      13
  #define EP0_SIZE              64
  #define NUM_ENDPOINTS         7
  #define NUM_INTERFACE         6
  #define CDC_IAD_DESCRIPTOR    1       // Serial
  #define CDC_STATUS_INTERFACE  0
  #define CDC_DATA_INTERFACE    1
  #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 CDC2_STATUS_INTERFACE 2       // SerialUSB1
  #define CDC2_DATA_INTERFACE   3
  #define CDC2_ACM_ENDPOINT     4
  #define CDC2_RX_ENDPOINT      5
  #define CDC2_TX_ENDPOINT      5
  #define CDC3_STATUS_INTERFACE 4       // SerialUSB2
  #define CDC3_DATA_INTERFACE   5
  #define CDC3_ACM_ENDPOINT     6
  #define CDC3_RX_ENDPOINT      7
  #define CDC3_TX_ENDPOINT      7
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG    ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  #define ENDPOINT4_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT5_CONFIG    ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  #define ENDPOINT6_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT7_CONFIG    ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK

#elif defined(USB_KEYBOARDONLY)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x04D0
  #define MANUFACTURER_NAME    {'T','e','e','n','s','y','d','u','i','n','o'}
  #define MANUFACTURER_NAME_LEN    11
  #define PRODUCT_NAME        {'K','e','y','b','o','a','r','d'}
  #define PRODUCT_NAME_LEN    8
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         4
  #define NUM_USB_BUFFERS    14
  #define NUM_INTERFACE        3
  #define SEREMU_INTERFACE      1    // Serial emulation
  #define SEREMU_TX_ENDPOINT    2
  #define SEREMU_TX_SIZE        64
  #define SEREMU_TX_INTERVAL    1    // TODO: is this ok for 480 Mbit speed
  #define SEREMU_RX_ENDPOINT    2
  #define SEREMU_RX_SIZE        32
  #define SEREMU_RX_INTERVAL    2    // TODO: is this ok for 480 Mbit speed
  #define KEYBOARD_INTERFACE    0    // Keyboard
  #define KEYBOARD_ENDPOINT     3
  #define KEYBOARD_SIZE         8    // 8 = normal boot protocol, 16 = NKRO
  #define KEYBOARD_INTERVAL     1    // TODO: is this ok for 480 Mbit speed
  #define KEYMEDIA_INTERFACE    2    // Keyboard Media Keys
  #define KEYMEDIA_ENDPOINT     4
  #define KEYMEDIA_SIZE         8
  #define KEYMEDIA_INTERVAL     4    // TODO: is this ok for 480 Mbit speed
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT4_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT

#elif defined(USB_HID)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x0482
  #define MANUFACTURER_NAME    {'T','e','e','n','s','y','d','u','i','n','o'}
  #define MANUFACTURER_NAME_LEN    11
  #define PRODUCT_NAME        {'K','e','y','b','o','a','r','d','/','M','o','u','s','e','/','J','o','y','s','t','i','c','k'}
  #define PRODUCT_NAME_LEN    23
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         6
  #define NUM_USB_BUFFERS    24
  #define NUM_INTERFACE        5
  #define SEREMU_INTERFACE      2    // Serial emulation
  #define SEREMU_TX_ENDPOINT    2
  #define SEREMU_TX_SIZE        64
  #define SEREMU_TX_INTERVAL    1
  #define SEREMU_RX_ENDPOINT    2
  #define SEREMU_RX_SIZE        32
  #define SEREMU_RX_INTERVAL    2
  #define KEYBOARD_INTERFACE    0    // Keyboard
  #define KEYBOARD_ENDPOINT     3
  #define KEYBOARD_SIZE         8    // 8 = normal boot protocol, 16 = NKRO
  #define KEYBOARD_INTERVAL     1
  #define KEYMEDIA_INTERFACE    4    // Keyboard Media Keys
  #define KEYMEDIA_ENDPOINT     4
  #define KEYMEDIA_SIZE         8
  #define KEYMEDIA_INTERVAL     4
  #define MOUSE_INTERFACE       1    // Mouse
  #define MOUSE_ENDPOINT        5
  #define MOUSE_SIZE            8
  #define MOUSE_INTERVAL        1
  #define JOYSTICK_INTERFACE    3    // Joystick
  #define JOYSTICK_ENDPOINT     6
  #define JOYSTICK_SIZE         12    //  12 = normal, 64 = extreme joystick
  #define JOYSTICK_INTERVAL     2
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT4_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT5_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT6_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT

#elif defined(USB_SERIAL_HID)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x0487
  #define DEVICE_CLASS        0xEF
  #define DEVICE_SUBCLASS    0x02
  #define DEVICE_PROTOCOL    0x01
  #define MANUFACTURER_NAME    {'T','e','e','n','s','y','d','u','i','n','o'}
  #define MANUFACTURER_NAME_LEN    11
  #define PRODUCT_NAME        {'S','e','r','i','a','l','/','K','e','y','b','o','a','r','d','/','M','o','u','s','e','/','J','o','y','s','t','i','c','k'}
  #define PRODUCT_NAME_LEN    30
  #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 KEYBOARD_INTERFACE    2    // Keyboard
  #define KEYBOARD_ENDPOINT     4
  #define KEYBOARD_SIZE         8    // 8 = normal boot protocol, 16 = NKRO
  #define KEYBOARD_INTERVAL     1
  #define KEYMEDIA_INTERFACE    5    // Keyboard Media Keys
  #define KEYMEDIA_ENDPOINT     5
  #define KEYMEDIA_SIZE         8
  #define KEYMEDIA_INTERVAL     4
  #define MOUSE_INTERFACE       3    // Mouse
  #define MOUSE_ENDPOINT        6
  #define MOUSE_SIZE            8
  #define MOUSE_INTERVAL        2
  #define JOYSTICK_INTERFACE    4    // Joystick
  #define JOYSTICK_ENDPOINT     7
  #define JOYSTICK_SIZE         12    //  12 = normal, 64 = extreme joystick
  #define JOYSTICK_INTERVAL     1
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG    ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  #define ENDPOINT4_CONFIG      ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT5_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT6_CONFIG      ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT7_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT

#elif defined(USB_TOUCHSCREEN)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x04D3
  #define MANUFACTURER_NAME    {'T','e','e','n','s','y','d','u','i','n','o'}
  #define MANUFACTURER_NAME_LEN    11
  #define PRODUCT_NAME        {'K','e','y','b','o','a','r','d','/','T','o','u','c','h','s','c','r','e','e','n'}
  #define PRODUCT_NAME_LEN    20
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         5
  #define NUM_INTERFACE        4
  #define SEREMU_INTERFACE      1    // Serial emulation
  #define SEREMU_TX_ENDPOINT    2
  #define SEREMU_TX_SIZE        64
  #define SEREMU_TX_INTERVAL    1
  #define SEREMU_RX_ENDPOINT    2
  #define SEREMU_RX_SIZE        32
  #define SEREMU_RX_INTERVAL    2
  #define KEYBOARD_INTERFACE    0    // Keyboard
  #define KEYBOARD_ENDPOINT     3
  #define KEYBOARD_SIZE         8    // 8 = normal boot protocol, 16 = NKRO
  #define KEYBOARD_INTERVAL     1
  #define KEYMEDIA_INTERFACE    2    // Keyboard Media Keys
  #define KEYMEDIA_ENDPOINT     4
  #define KEYMEDIA_SIZE         8
  #define KEYMEDIA_INTERVAL     4
  #define MULTITOUCH_INTERFACE  3    // Touchscreen
  #define MULTITOUCH_ENDPOINT   5
  #define MULTITOUCH_SIZE       9
  #define MULTITOUCH_FINGERS    10
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG      ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT4_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT5_CONFIG      ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT

#elif defined(USB_HID_TOUCHSCREEN)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x04D4
  #define MANUFACTURER_NAME    {'T','e','e','n','s','y','d','u','i','n','o'}
  #define MANUFACTURER_NAME_LEN    11
  #define PRODUCT_NAME        {'K','e','y','b','o','a','r','d','/','M','o','u','s','e','/','T','o','u','c','h','s','c','r','e','e','n'}
  #define PRODUCT_NAME_LEN    26
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         6
  #define NUM_INTERFACE        5
  #define SEREMU_INTERFACE      2    // Serial emulation
  #define SEREMU_TX_ENDPOINT    2
  #define SEREMU_TX_SIZE        64
  #define SEREMU_TX_INTERVAL    1
  #define SEREMU_RX_ENDPOINT    2
  #define SEREMU_RX_SIZE        32
  #define SEREMU_RX_INTERVAL    2
  #define KEYBOARD_INTERFACE    0    // Keyboard
  #define KEYBOARD_ENDPOINT     3
  #define KEYBOARD_SIZE         8    // 8 = normal boot protocol, 16 = NKRO
  #define KEYBOARD_INTERVAL     1
  #define KEYMEDIA_INTERFACE    3    // Keyboard Media Keys
  #define KEYMEDIA_ENDPOINT     4
  #define KEYMEDIA_SIZE         8
  #define KEYMEDIA_INTERVAL     4
  #define MOUSE_INTERFACE       1    // Mouse
  #define MOUSE_ENDPOINT        6
  #define MOUSE_SIZE            8
  #define MOUSE_INTERVAL        2
  #define MULTITOUCH_INTERFACE  4    // Touchscreen
  #define MULTITOUCH_ENDPOINT   5
  #define MULTITOUCH_SIZE       9
  #define MULTITOUCH_FINGERS    10
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG      ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT4_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT5_CONFIG      ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT6_CONFIG      ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT

#elif defined(USB_MIDI)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x0485
  #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'}
  #define PRODUCT_NAME_LEN    11
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         4
  #define NUM_INTERFACE        2
  #define SEREMU_INTERFACE      1    // Serial emulation
  #define SEREMU_TX_ENDPOINT    2
  #define SEREMU_TX_SIZE        64
  #define SEREMU_TX_INTERVAL    1
  #define SEREMU_RX_ENDPOINT    2
  #define SEREMU_RX_SIZE        32
  #define SEREMU_RX_INTERVAL    2
  #define MIDI_INTERFACE        0    // MIDI
  #define MIDI_NUM_CABLES       1
  #define MIDI_TX_ENDPOINT      3
  #define MIDI_TX_SIZE_12       64
  #define MIDI_TX_SIZE_480      512
  #define MIDI_RX_ENDPOINT      3
  #define MIDI_RX_SIZE_12       64
  #define MIDI_RX_SIZE_480      512
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG    ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK

#elif defined(USB_MIDI4)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x0485
  #define BCD_DEVICE        0x0211
  #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','x','4'}
  #define PRODUCT_NAME_LEN    13
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         3
  #define NUM_INTERFACE        2
  #define SEREMU_INTERFACE      1    // Serial emulation
  #define SEREMU_TX_ENDPOINT    2
  #define SEREMU_TX_SIZE        64
  #define SEREMU_TX_INTERVAL    1
  #define SEREMU_RX_ENDPOINT    2
  #define SEREMU_RX_SIZE        32
  #define SEREMU_RX_INTERVAL    2
  #define MIDI_INTERFACE        0    // MIDI
  #define MIDI_NUM_CABLES       4
  #define MIDI_TX_ENDPOINT      3
  #define MIDI_TX_SIZE_12       64
  #define MIDI_TX_SIZE_480      512
  #define MIDI_RX_ENDPOINT      3
  #define MIDI_RX_SIZE_12       64
  #define MIDI_RX_SIZE_480      512
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG    ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK

#elif defined(USB_MIDI16)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x0485
  #define BCD_DEVICE        0x0212
  #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','x','1','6'}
  #define PRODUCT_NAME_LEN    14
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         3
  #define NUM_INTERFACE        2
  #define SEREMU_INTERFACE      1    // Serial emulation
  #define SEREMU_TX_ENDPOINT    2
  #define SEREMU_TX_SIZE        64
  #define SEREMU_TX_INTERVAL    1
  #define SEREMU_RX_ENDPOINT    2
  #define SEREMU_RX_SIZE        32
  #define SEREMU_RX_INTERVAL    2
  #define MIDI_INTERFACE        0    // MIDI
  #define MIDI_NUM_CABLES       16
  #define MIDI_TX_ENDPOINT      3
  #define MIDI_TX_SIZE_12       64
  #define MIDI_TX_SIZE_480      512
  #define MIDI_RX_ENDPOINT      3
  #define MIDI_RX_SIZE_12       64
  #define MIDI_RX_SIZE_480      512
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG    ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK

#elif defined(USB_MIDI_SERIAL)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x0489
  #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'}
  #define PRODUCT_NAME_LEN    11
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         4
  #define NUM_INTERFACE        3
  #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 MIDI_INTERFACE        2    // MIDI
  #define MIDI_NUM_CABLES       1
  #define MIDI_TX_ENDPOINT      4
  #define MIDI_TX_SIZE_12       64
  #define MIDI_TX_SIZE_480      512
  #define MIDI_RX_ENDPOINT      4
  #define MIDI_RX_SIZE_12       64
  #define MIDI_RX_SIZE_480      512
  #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

#elif defined(USB_MIDI4_SERIAL)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x0489
  #define BCD_DEVICE        0x0211
  #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','x','4'}
  #define PRODUCT_NAME_LEN    13
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         4
  #define NUM_INTERFACE        3
  #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 MIDI_INTERFACE        2    // MIDI
  #define MIDI_NUM_CABLES       4
  #define MIDI_TX_ENDPOINT      4
  #define MIDI_TX_SIZE_12       64
  #define MIDI_TX_SIZE_480      512
  #define MIDI_RX_ENDPOINT      4
  #define MIDI_RX_SIZE_12       64
  #define MIDI_RX_SIZE_480      512
  #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

#elif defined(USB_MIDI16_SERIAL)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x0489
  #define BCD_DEVICE        0x0212
  #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','x','1','6'}
  #define PRODUCT_NAME_LEN    14
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         4
  #define NUM_INTERFACE        3
  #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 MIDI_INTERFACE        2    // MIDI
  #define MIDI_NUM_CABLES       16
  #define MIDI_TX_ENDPOINT      4
  #define MIDI_TX_SIZE_12       64
  #define MIDI_TX_SIZE_480      512
  #define MIDI_RX_ENDPOINT      4
  #define MIDI_RX_SIZE_12       64
  #define MIDI_RX_SIZE_480      512
  #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

#elif defined(USB_RAWHID)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x0486
  #define RAWHID_USAGE_PAGE    0xFFAB  // recommended: 0xFF00 to 0xFFFF
  #define RAWHID_USAGE        0x0200  // recommended: 0x0100 to 0xFFFF
  #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','d','u','i','n','o',' ','R','a','w','H','I','D'}
  #define PRODUCT_NAME_LEN    18
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         4
  #define NUM_INTERFACE        2
  #define RAWHID_INTERFACE      0    // RawHID
  #define RAWHID_TX_ENDPOINT    3
  #define RAWHID_TX_SIZE        64
  #define RAWHID_TX_INTERVAL    1     // TODO: is this ok for 480 Mbit speed
  #define RAWHID_RX_ENDPOINT    4
  #define RAWHID_RX_SIZE        64
  #define RAWHID_RX_INTERVAL    1     // TODO: is this ok for 480 Mbit speed
  #define SEREMU_INTERFACE      1    // Serial emulation
  #define SEREMU_TX_ENDPOINT    2
  #define SEREMU_TX_SIZE        64
  #define SEREMU_TX_INTERVAL    1     // TODO: is this ok for 480 Mbit speed
  #define SEREMU_RX_ENDPOINT    2
  #define SEREMU_RX_SIZE        32
  #define SEREMU_RX_INTERVAL    2     // TODO: is this ok for 480 Mbit speed
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT4_CONFIG    ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_UNUSED

#elif defined(USB_FLIGHTSIM)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x0488
  #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',' ','F','l','i','g','h','t',' ','S','i','m',' ','C','o','n','t','r','o','l','s'}
  #define PRODUCT_NAME_LEN    26
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         3
  #define NUM_INTERFACE        2
  #define FLIGHTSIM_INTERFACE    0    // Flight Sim Control
  #define FLIGHTSIM_TX_ENDPOINT    3
  #define FLIGHTSIM_TX_SIZE    64
  #define FLIGHTSIM_TX_INTERVAL    1
  #define FLIGHTSIM_RX_ENDPOINT    3
  #define FLIGHTSIM_RX_SIZE    64
  #define FLIGHTSIM_RX_INTERVAL    1
  #define SEREMU_INTERFACE      1    // Serial emulation
  #define SEREMU_TX_ENDPOINT    2
  #define SEREMU_TX_SIZE        64
  #define SEREMU_TX_INTERVAL    1
  #define SEREMU_RX_ENDPOINT    2
  #define SEREMU_RX_SIZE        32
  #define SEREMU_RX_INTERVAL    2
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG    ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK

#elif defined(USB_FLIGHTSIM_JOYSTICK)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x0488
  #define BCD_DEVICE        0x0211
  #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',' ','F','l','i','g','h','t',' ','S','i','m',' ','C','o','n','t','r','o','l','s'}
  #define PRODUCT_NAME_LEN    26
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         4
  #define NUM_INTERFACE        3
  #define FLIGHTSIM_INTERFACE    0    // Flight Sim Control
  #define FLIGHTSIM_TX_ENDPOINT    3
  #define FLIGHTSIM_TX_SIZE    64
  #define FLIGHTSIM_TX_INTERVAL    1
  #define FLIGHTSIM_RX_ENDPOINT    3
  #define FLIGHTSIM_RX_SIZE    64
  #define FLIGHTSIM_RX_INTERVAL    1
  #define SEREMU_INTERFACE      1    // Serial emulation
  #define SEREMU_TX_ENDPOINT    2
  #define SEREMU_TX_SIZE        64
  #define SEREMU_TX_INTERVAL    1
  #define SEREMU_RX_ENDPOINT    2
  #define SEREMU_RX_SIZE        32
  #define SEREMU_RX_INTERVAL    2
  #define JOYSTICK_INTERFACE    2    // Joystick
  #define JOYSTICK_ENDPOINT     4
  #define JOYSTICK_SIZE         12    //  12 = normal, 64 = extreme joystick
  #define JOYSTICK_INTERVAL     1
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG    ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  #define ENDPOINT4_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT

#elif defined(USB_MTPDISK)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x04D1
  #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','T','P',' ','D','i','s','k'}
  #define PRODUCT_NAME_LEN    15
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         4
  #define NUM_INTERFACE        2
  #define MTP_INTERFACE        1    // MTP Disk
  #define MTP_TX_ENDPOINT    3
  #define MTP_TX_SIZE_12    64
  #define MTP_TX_SIZE_480    512
  #define MTP_RX_ENDPOINT    3
  #define MTP_RX_SIZE_12    64
  #define MTP_RX_SIZE_480    512
  #define MTP_EVENT_ENDPOINT    4
  #define MTP_EVENT_SIZE    32
  #define MTP_EVENT_INTERVAL_12    10    // 10 = 10 ms
  #define MTP_EVENT_INTERVAL_480 7    // 7 = 8 ms
  #define SEREMU_INTERFACE      0    // Serial emulation
  #define SEREMU_TX_ENDPOINT    2
  #define SEREMU_TX_SIZE        64
  #define SEREMU_TX_INTERVAL    1
  #define SEREMU_RX_ENDPOINT    2
  #define SEREMU_RX_SIZE        32
  #define SEREMU_RX_INTERVAL    2
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG    ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  #define ENDPOINT4_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT

#elif defined(USB_MTPDISK_SERIAL)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x04D5
  #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','T','P',' ','D','i','s','k'}
  #define PRODUCT_NAME_LEN    15
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         5
  #define NUM_INTERFACE        3
  #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 Disk
  #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    5
  #define MTP_EVENT_SIZE    32
  #define MTP_EVENT_INTERVAL_12    10    // 10 = 10 ms
  #define MTP_EVENT_INTERVAL_480 7    // 7 = 8 ms
  #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_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT

#elif defined(USB_AUDIO)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x04D2
  #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',' ','A','u','d','i','o'}
  #define PRODUCT_NAME_LEN    12
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         4
  #define NUM_INTERFACE        4
  #define SEREMU_INTERFACE      0    // Serial emulation
  #define SEREMU_TX_ENDPOINT    2
  #define SEREMU_TX_SIZE        64
  #define SEREMU_TX_INTERVAL    1
  #define SEREMU_RX_ENDPOINT    2
  #define SEREMU_RX_SIZE        32
  #define SEREMU_RX_INTERVAL    2
  #define AUDIO_INTERFACE    1    // Audio (uses 3 consecutive interfaces)
  #define AUDIO_TX_ENDPOINT     3
  #define AUDIO_TX_SIZE         180
  #define AUDIO_RX_ENDPOINT     3
  #define AUDIO_RX_SIZE         180
  #define AUDIO_SYNC_ENDPOINT    4
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG    ENDPOINT_RECEIVE_ISOCHRONOUS + ENDPOINT_TRANSMIT_ISOCHRONOUS
  #define ENDPOINT4_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_ISOCHRONOUS

#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         6
  #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 MIDI_INTERFACE        2    // MIDI
  #define MIDI_NUM_CABLES       1
  #define MIDI_TX_ENDPOINT      4
  #define MIDI_TX_SIZE_12       64
  #define MIDI_TX_SIZE_480      512
  #define MIDI_RX_ENDPOINT      4
  #define MIDI_RX_SIZE_12       64
  #define MIDI_RX_SIZE_480      512
  #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

#elif defined(USB_MIDI16_AUDIO_SERIAL)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x048A
  #define BCD_DEVICE        0x0212
  #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','x','1','6','/','A','u','d','i','o'}
  #define PRODUCT_NAME_LEN    20
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         8
  #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 MIDI_INTERFACE        2    // MIDI
  #define MIDI_NUM_CABLES       16
  #define MIDI_TX_ENDPOINT      4
  #define MIDI_TX_SIZE_12       64
  #define MIDI_TX_SIZE_480      512
  #define MIDI_RX_ENDPOINT      4
  #define MIDI_RX_SIZE_12       64
  #define MIDI_RX_SIZE_480      512
  #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

#elif defined(USB_EVERYTHING)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x0476
  #define RAWHID_USAGE_PAGE    0xFFAB  // recommended: 0xFF00 to 0xFFFF
  #define RAWHID_USAGE        0x0200  // recommended: 0x0100 to 0xFFFF
  #define DEVICE_CLASS        0xEF
  #define DEVICE_SUBCLASS    0x02
  #define DEVICE_PROTOCOL    0x01
  #define MANUFACTURER_NAME    {'T','e','e','n','s','y','d','u','i','n','o'}
  #define MANUFACTURER_NAME_LEN    11
  #define PRODUCT_NAME        {'A','l','l',' ','T','h','e',' ','T','h','i','n','g','s'}
  #define PRODUCT_NAME_LEN    14
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         15
  #define NUM_INTERFACE        13
  #define CDC_IAD_DESCRIPTOR    1
  #define CDC_STATUS_INTERFACE    0
  #define CDC_DATA_INTERFACE    1    // Serial
  #define CDC_ACM_ENDPOINT    1
  #define CDC_RX_ENDPOINT       2
  #define CDC_TX_ENDPOINT       2
  #define CDC_ACM_SIZE          16
  #define CDC_RX_SIZE           64
  #define CDC_TX_SIZE           64
  #define MIDI_INTERFACE        2    // MIDI
  #define MIDI_NUM_CABLES       16
  #define MIDI_TX_ENDPOINT      3
  #define MIDI_TX_SIZE          64
  #define MIDI_RX_ENDPOINT      3
  #define MIDI_RX_SIZE          64
  #define KEYBOARD_INTERFACE    3    // Keyboard
  #define KEYBOARD_ENDPOINT     4
  #define KEYBOARD_SIZE         8    // 8 = normal boot protocol, 16 = NKRO
  #define KEYBOARD_INTERVAL     1
  #define MOUSE_INTERFACE       4    // Mouse
  #define MOUSE_ENDPOINT        5
  #define MOUSE_SIZE            8
  #define MOUSE_INTERVAL        2
  #define RAWHID_INTERFACE      5    // RawHID
  #define RAWHID_TX_ENDPOINT    6
  #define RAWHID_TX_SIZE        64
  #define RAWHID_TX_INTERVAL    1
  #define RAWHID_RX_ENDPOINT    6
  #define RAWHID_RX_SIZE        64
  #define RAWHID_RX_INTERVAL    1
  #define FLIGHTSIM_INTERFACE    6    // Flight Sim Control
  #define FLIGHTSIM_TX_ENDPOINT    9
  #define FLIGHTSIM_TX_SIZE    64
  #define FLIGHTSIM_TX_INTERVAL    1
  #define FLIGHTSIM_RX_ENDPOINT    9
  #define FLIGHTSIM_RX_SIZE    64
  #define FLIGHTSIM_RX_INTERVAL    1
  #define JOYSTICK_INTERFACE    7    // Joystick
  #define JOYSTICK_ENDPOINT     10
  #define JOYSTICK_SIZE         12    //  12 = normal, 64 = extreme joystick
  #define JOYSTICK_INTERVAL     1
/*
  #define MTP_INTERFACE        8    // MTP Disk
  #define MTP_TX_ENDPOINT    11
  #define MTP_TX_SIZE        64
  #define MTP_RX_ENDPOINT    3
  #define MTP_RX_SIZE        64
  #define MTP_EVENT_ENDPOINT    11
  #define MTP_EVENT_SIZE    16
  #define MTP_EVENT_INTERVAL    10
*/
  #define KEYMEDIA_INTERFACE    8    // Keyboard Media Keys
  #define KEYMEDIA_ENDPOINT     12
  #define KEYMEDIA_SIZE         8
  #define KEYMEDIA_INTERVAL     4
  #define AUDIO_INTERFACE    9    // Audio (uses 3 consecutive interfaces)
  #define AUDIO_TX_ENDPOINT     13
  #define AUDIO_TX_SIZE         180
  #define AUDIO_RX_ENDPOINT     13
  #define AUDIO_RX_SIZE         180
  #define AUDIO_SYNC_ENDPOINT    14
  #define MULTITOUCH_INTERFACE  12    // Touchscreen
  #define MULTITOUCH_ENDPOINT   15
  #define MULTITOUCH_SIZE       9
  #define MULTITOUCH_FINGERS    10
  #define ENDPOINT1_CONFIG    ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT2_CONFIG    ENDPOINT_TRANSMIT_AND_RECEIVE
  #define ENDPOINT3_CONFIG    ENDPOINT_TRANSMIT_AND_RECEIVE
  #define ENDPOINT4_CONFIG    ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT5_CONFIG    ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT6_CONFIG    ENDPOINT_TRANSMIT_AND_RECEIVE
  #define ENDPOINT7_CONFIG    ENDPOINT_TRANSMIT_AND_RECEIVE
  #define ENDPOINT8_CONFIG    ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT9_CONFIG    ENDPOINT_TRANSMIT_AND_RECEIVE
  #define ENDPOINT10_CONFIG    ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT11_CONFIG    ENDPOINT_TRANSMIT_AND_RECEIVE
  #define ENDPOINT12_CONFIG    ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT13_CONFIG    (ENDPOINT_RECEIVE_ISOCHRONOUS|ENDPOINT_TRANSMIT_ISOCHRONOUS)
  #define ENDPOINT14_CONFIG    ENDPOINT_TRANSMIT_ISOCHRONOUS
  #define ENDPOINT15_CONFIG    ENDPOINT_TRANSMIT_ONLY

#endif

#ifdef USB_DESC_LIST_DEFINE
#if defined(NUM_ENDPOINTS) && NUM_ENDPOINTS > 0
// NUM_ENDPOINTS = number of non-zero endpoints (0 to 7)
extern const uint32_t usb_endpoint_config_table[NUM_ENDPOINTS];

typedef struct {
    uint16_t    wValue;
    uint16_t    wIndex;
    const uint8_t    *addr;
    uint16_t    length;
} usb_descriptor_list_t;

extern const usb_descriptor_list_t usb_descriptor_list[];
#endif // NUM_ENDPOINTS
#endif // USB_DESC_LIST_DEFINE
and code parts of "boards.txt" for Teensy 4.1 menu

Code:
teensy41.name=Teensy 4.1
#teensy41.upload.maximum_size=8126464
teensy41.build.board=TEENSY41
teensy41.build.flags.ld=-Wl,--gc-sections,--relax "-T{build.core.path}/imxrt1062_t41.ld"
#teensy41.upload.maximum_data_size=524288
teensy41.upload.tool=teensyloader
teensy41.upload.tool.default=teensyloader
teensy41.upload.tool.teensy=teensyloader
teensy41.upload.protocol=teensy
teensy41.upload_port.modelID=0x25
teensy41.build.core=teensy4
teensy41.build.mcu=imxrt1062
teensy41.build.warn_data_percentage=99
teensy41.build.toolchain=arm/bin/
teensy41.build.command.gcc=arm-none-eabi-gcc
teensy41.build.command.g++=arm-none-eabi-g++
teensy41.build.command.ar=arm-none-eabi-gcc-ar
teensy41.build.command.objcopy=arm-none-eabi-objcopy
teensy41.build.command.objdump=arm-none-eabi-objdump
teensy41.build.command.linker=arm-none-eabi-gcc
teensy41.build.command.size=arm-none-eabi-size
teensy41.build.flags.common=-g -Wall -ffunction-sections -fdata-sections -nostdlib
teensy41.build.flags.dep=-MMD
teensy41.build.flags.optimize=-Os
teensy41.build.flags.cpu=-mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16
teensy41.build.flags.defs=-D__IMXRT1062__ -DTEENSYDUINO=160
teensy41.build.flags.cpp=-std=gnu++17 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -Wno-psabi
teensy41.build.flags.c=
teensy41.build.flags.S=-x assembler-with-cpp
teensy41.build.flags.libs=-larm_cortexM7lfsp_math -lm -lstdc++
teensy41.serial.restart_cmd=false
teensy41.menu.usb.serial=Serial
teensy41.menu.usb.serial.build.usbtype=USB_SERIAL
teensy41.menu.usb.serial.upload_port.usbtype=USB_SERIAL
teensy41.menu.usb.serial2=Dual Serial
teensy41.menu.usb.serial2.build.usbtype=USB_DUAL_SERIAL
teensy41.menu.usb.serial2.upload_port.usbtype=USB_DUAL_SERIAL
teensy41.menu.usb.serial3=Triple Serial
teensy41.menu.usb.serial3.build.usbtype=USB_TRIPLE_SERIAL
teensy41.menu.usb.serial3.upload_port.usbtype=USB_TRIPLE_SERIAL
teensy41.menu.usb.keyboard=Keyboard
teensy41.menu.usb.keyboard.build.usbtype=USB_KEYBOARDONLY
teensy41.menu.usb.keyboard.upload_port.usbtype=USB_KEYBOARDONLY
teensy41.menu.usb.keyboard.fake_serial=teensy_gateway
teensy41.menu.usb.touch=Keyboard + Touch Screen
teensy41.menu.usb.touch.build.usbtype=USB_TOUCHSCREEN
teensy41.menu.usb.touch.upload_port.usbtype=USB_TOUCHSCREEN
teensy41.menu.usb.touch.fake_serial=teensy_gateway
teensy41.menu.usb.hidtouch=Keyboard + Mouse + Touch Screen
teensy41.menu.usb.hidtouch.build.usbtype=USB_HID_TOUCHSCREEN
teensy41.menu.usb.hidtouch.upload_port.usbtype=USB_HID_TOUCHSCREEN
teensy41.menu.usb.hidtouch.fake_serial=teensy_gateway
teensy41.menu.usb.hid=Keyboard + Mouse + Joystick
teensy41.menu.usb.hid.build.usbtype=USB_HID
teensy41.menu.usb.hid.upload_port.usbtype=USB_HID
teensy41.menu.usb.hid.fake_serial=teensy_gateway
teensy41.menu.usb.serialhid=Serial + Keyboard + Mouse + Joystick
teensy41.menu.usb.serialhid.build.usbtype=USB_SERIAL_HID
teensy41.menu.usb.serialhid.upload_port.usbtype=USB_SERIAL_HID
teensy41.menu.usb.midi=MIDI
teensy41.menu.usb.midi.build.usbtype=USB_MIDI
teensy41.menu.usb.midi.upload_port.usbtype=USB_MIDI
teensy41.menu.usb.midi.fake_serial=teensy_gateway
teensy41.menu.usb.midi4=MIDIx4
teensy41.menu.usb.midi4.build.usbtype=USB_MIDI4
teensy41.menu.usb.midi4.upload_port.usbtype=USB_MIDI4
teensy41.menu.usb.midi4.fake_serial=teensy_gateway
teensy41.menu.usb.midi16=MIDIx16
teensy41.menu.usb.midi16.build.usbtype=USB_MIDI16
teensy41.menu.usb.midi16.upload_port.usbtype=USB_MIDI16
teensy41.menu.usb.midi16.fake_serial=teensy_gateway
teensy41.menu.usb.serialmidi=Serial + MIDI
teensy41.menu.usb.serialmidi.build.usbtype=USB_MIDI_SERIAL
teensy41.menu.usb.serialmidi.upload_port.usbtype=USB_MIDI_SERIAL
teensy41.menu.usb.serialmidi4=Serial + MIDIx4
teensy41.menu.usb.serialmidi4.build.usbtype=USB_MIDI4_SERIAL
teensy41.menu.usb.serialmidi4.upload_port.usbtype=USB_MIDI4_SERIAL
teensy41.menu.usb.serialmidi16=Serial + MIDIx16
teensy41.menu.usb.serialmidi16.build.usbtype=USB_MIDI16_SERIAL
teensy41.menu.usb.serialmidi16.upload_port.usbtype=USB_MIDI16_SERIAL
teensy41.menu.usb.audio=Audio
teensy41.menu.usb.audio.build.usbtype=USB_AUDIO
teensy41.menu.usb.audio.upload_port.usbtype=USB_AUDIO
teensy41.menu.usb.audio.fake_serial=teensy_gateway
teensy41.menu.usb.serialmidiaudio=Serial + MIDI + Audio
teensy41.menu.usb.serialmidiaudio.build.usbtype=USB_MIDI_AUDIO_SERIAL
teensy41.menu.usb.serialmidiaudio.upload_port.usbtype=USB_MIDI_AUDIO_SERIAL
teensy41.menu.usb.serialmidi16audio=Serial + MIDIx16 + Audio
teensy41.menu.usb.serialmidi16audio.build.usbtype=USB_MIDI16_AUDIO_SERIAL
teensy41.menu.usb.serialmidi16audio.upload_port.usbtype=USB_MIDI16_AUDIO_SERIAL
teensy41.menu.usb.mtp=MTP Disk (Experimental)
teensy41.menu.usb.mtp.build.usbtype=USB_MTPDISK
teensy41.menu.usb.mtp.upload_port.usbtype=USB_MTPDISK
teensy41.menu.usb.mtp.fake_serial=teensy_gateway
teensy41.menu.usb.serialmtp=Serial + MTP Disk (Experimental)
teensy41.menu.usb.serialmtp.build.usbtype=USB_MTPDISK_SERIAL
teensy41.menu.usb.serialmtp.upload_port.usbtype=USB_MTPDISK_SERIAL
teensy41.menu.usb.rawhid=Raw HID
teensy41.menu.usb.rawhid.build.usbtype=USB_RAWHID
teensy41.menu.usb.rawhid.upload_port.usbtype=USB_RAWHID
teensy41.menu.usb.rawhid.fake_serial=teensy_gateway
teensy41.menu.usb.flightsim=Flight Sim Controls
teensy41.menu.usb.flightsim.build.usbtype=USB_FLIGHTSIM
teensy41.menu.usb.flightsim.upload_port.usbtype=USB_FLIGHTSIM
teensy41.menu.usb.flightsim.fake_serial=teensy_gateway
teensy41.menu.usb.flightsimjoystick=Flight Sim Controls + Joystick
teensy41.menu.usb.flightsimjoystick.build.usbtype=USB_FLIGHTSIM_JOYSTICK
teensy41.menu.usb.flightsimjoystick.upload_port.usbtype=USB_FLIGHTSIM_JOYSTICK
teensy41.menu.usb.flightsimjoystick.fake_serial=teensy_gateway
#teensy41.menu.usb.disable=No USB
#teensy41.menu.usb.disable.build.usbtype=USB_DISABLED

i also attached original full files in attachments, you can see if needed
please reply with modification what is required for my ALL in one Device?????
thank you.
 

Attachments

  • usb_desc.c
    139.4 KB · Views: 10
  • usb_desc.h
    39.5 KB · Views: 9
  • boards.txt
    93.1 KB · Views: 8
Maybe <this> post provides the answer (not possible due to hardware limitations). And <this> post has additional info that may be useful/applicable.

Mark J Culross
KD5RXT
 
Just to clarify, Keyboard normally uses 2 endpoints, but is it theoretically possible to do with 1 if you drop the media/consumer keys interface.

According to HID protocol, those keys can also theoretically be implemented on the same endpoint. But Microsoft Windows doesn't support it. So if you try doing down that path know in advance there are a lot of HID things that only work with Linux and (sometimes) MacOS. We had this in very early Teensy Keyboard implementation, but it was changed to 2 endpoints to work with Windows.
 
Yes, at least in theory those 3 should be able to work because each needs 2 endpoints. They will exactly consume all 6 usable endpoints.

It should be possible with only editing usb_desc.h. But MTP isn't nearly as mature as the others. Please let us know if you get it working?
 
Out of interest, I noticed that the “emulated serial“ (?) that you get if you choose an option without CDC serial from the Tools menu, only uses one endpoint. Is it technically possible to have two of those at once, along with e.g. Audio and MTP?
 
Is it technically possible to have two of those

Yes, but "technically possible" would require quite a lot of programming work. You can't get there by just editing usb_desc.h.

On the Teensy side, you'd need to at least duplicate some of the code where the endpoint numbers are used. If you want to be able to reliably detect which interface is which on the host side, you'd also need to duplicate the HID report descriptor and give it a different HID usage number.

On the host side, you'd need to write software to communicate with the new 2nd HID interface. The old hid_listen program from the Teensy 1.0 and Teensy 2.0 days before Arduino IDE was the main focus might be helpful.
 
Pleas look a bit here.
this code for Audio in usb_desc.h
C++:
#elif defined(USB_AUDIO)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x04D2
  #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',' ','A','u','d','i','o'}
  #define PRODUCT_NAME_LEN    12
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         4
  #define NUM_INTERFACE        4
  #define SEREMU_INTERFACE      0    // Serial emulation
  #define SEREMU_TX_ENDPOINT    2
  #define SEREMU_TX_SIZE        64
  #define SEREMU_TX_INTERVAL    1
  #define SEREMU_RX_ENDPOINT    2
  #define SEREMU_RX_SIZE        32
  #define SEREMU_RX_INTERVAL    2
  #define AUDIO_INTERFACE    2    // Audio (uses 3 consecutive interfaces)
  #define AUDIO_TX_ENDPOINT     3     
  #define AUDIO_TX_SIZE         180   
  #define AUDIO_RX_ENDPOINT     3   
  #define AUDIO_RX_SIZE         180
  #define AUDIO_SYNC_ENDPOINT    4     
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG    ENDPOINT_RECEIVE_ISOCHRONOUS + ENDPOINT_TRANSMIT_ISOCHRONOUS   
  #define ENDPOINT4_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_ISOCHRONOUS
i tried it mix into
C++:
#elif defined(USB_MTPDISK)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x04D1
  #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','T','P',' ','D','i','s','k'}
  #define PRODUCT_NAME_LEN    15
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         4
  #define NUM_INTERFACE        2
  #define MTP_INTERFACE        1    // MTP Disk
  #define MTP_TX_ENDPOINT    3
  #define MTP_TX_SIZE_12    64
  #define MTP_TX_SIZE_480    512
  #define MTP_RX_ENDPOINT    3
  #define MTP_RX_SIZE_12    64
  #define MTP_RX_SIZE_480    512
  #define MTP_EVENT_ENDPOINT    4
  #define MTP_EVENT_SIZE    32
  #define MTP_EVENT_INTERVAL_12    10    // 10 = 10 ms
  #define MTP_EVENT_INTERVAL_480 7    // 7 = 8 ms
  #define SEREMU_INTERFACE      0    // Serial emulation
  #define SEREMU_TX_ENDPOINT    2
  #define SEREMU_TX_SIZE        64
  #define SEREMU_TX_INTERVAL    1
  #define SEREMU_RX_ENDPOINT    2
  #define SEREMU_RX_SIZE        32
  #define SEREMU_RX_INTERVAL    2
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG    ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  #define ENDPOINT4_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
after my mixing it became as below
C++:
#elif defined(USB_MTPDISK)   // my mix (serial+MTP+Audio)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x04D1
  #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','T','P',' ','D','i','s','k'}
  #define PRODUCT_NAME_LEN    15
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         6
  #define NUM_INTERFACE        3
  #define MTP_INTERFACE        1    // MTP Disk
  #define MTP_TX_ENDPOINT    3
  #define MTP_TX_SIZE_12    64
  #define MTP_TX_SIZE_480    512
  #define MTP_RX_ENDPOINT    3
  #define MTP_RX_SIZE_12    64
  #define MTP_RX_SIZE_480    512
  #define MTP_EVENT_ENDPOINT    4
  #define MTP_EVENT_SIZE    32
  #define MTP_EVENT_INTERVAL_12    10    // 10 = 10 ms
  #define MTP_EVENT_INTERVAL_480 7    // 7 = 8 ms
  #define SEREMU_INTERFACE      0    // Serial emulation
  #define SEREMU_TX_ENDPOINT    2
  #define SEREMU_TX_SIZE        64
  #define SEREMU_TX_INTERVAL    1
  #define SEREMU_RX_ENDPOINT    2
  #define SEREMU_RX_SIZE        32
  #define SEREMU_RX_INTERVAL    2
  #define AUDIO_INTERFACE    2    // Audio (uses 3 consecutive interfaces)
  #define AUDIO_TX_ENDPOINT     5     //3
  #define AUDIO_TX_SIZE         180   //
  #define AUDIO_RX_ENDPOINT     5    // 3
  #define AUDIO_RX_SIZE         180
  #define AUDIO_SYNC_ENDPOINT    6     // 4
  #define ENDPOINT2_CONFIG    ENDPOINT_RECEIVE_INTERRUPT + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT3_CONFIG    ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_BULK
  #define ENDPOINT4_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT5_CONFIG    ENDPOINT_RECEIVE_ISOCHRONOUS + ENDPOINT_TRANSMIT_ISOCHRONOUS    // Audio
  #define ENDPOINT6_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_ISOCHRONOUS        // Audio
after mixing code it not working for MTP's built-in examples
but before mixing code it was working successfully for MTP's built-in examples
please reply with correct mixing if it is in-correct ?????
 
Reading Paul's comment correctly, you should not use seremu, but serial i.e. (CDC or MTP Serial experimental)
 
Yes, but "technically possible" would require quite a lot of programming work. You can't get there by just editing usb_desc.h.
Thanks Paul, sounds like very much a back burner/never going to do it for me, especially with the need for host-side code. A second serial port is very handy for debugging, but I can usually limp along with the existing dual serial options.

@charnjit, I think your mixed code has one error I can see, in that NUM_INTERFACES is set to 3, and I think it should be 5; note the comment that says Audio uses 3 interfaces.
 
now tried mix Audio code in (USB_MTPDISK_SERIAL).
i left seremu. before ... NUM_INTERFACES was 3 . i set it 6 by add 3 for audio.
it became in usb_desc.h
C++:
#elif defined(USB_MTPDISK_SERIAL)        // Testing ......     (Serial+MTP+Audio)             
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x04D5
  #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','T','P',' ','D','i','s','k'}
  #define PRODUCT_NAME_LEN    15
  #define EP0_SIZE        64
  #define NUM_ENDPOINTS         6       
  #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 Disk
  #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    5
  #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    1    // Audio (uses 3 consecutive interfaces)
  #define AUDIO_TX_ENDPOINT     6
  #define AUDIO_TX_SIZE         180
  #define AUDIO_RX_ENDPOINT     3
  #define AUDIO_RX_SIZE         180
  #define AUDIO_SYNC_ENDPOINT    7
  #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_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT6_CONFIG    ENDPOINT_RECEIVE_ISOCHRONOUS + ENDPOINT_TRANSMIT_ISOCHRONOUS   // Audio
  #define ENDPOINT7_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_ISOCHRONOUS        // Audio
after upload example . .. teensy is looking offline in Serial Monitor.
what mistake in mixing ?????
 
You need NUM_ENDPOINTS at 7.

From the comments in usb_desc.h:

Code:
Edit NUM_ENDPOINTS to be at least the largest endpoint number used.
 
Thank you Paul...
NUM_ENDPOINTS 7 also did not work.
teensy became offline from port . after press reset button , it became present on port but offline in Serial monitor.
failed!!
 
not sure if
Code:
#define CDC_DATA_INTERFACE    1    // Serial
and
Code:
#define AUDIO_INTERFACE    1    // Audio (uses 3 consecutive interfaces)
is correct
 
occuring same problem using
C++:
#elif defined(USB_MTPDISK_SERIAL)        // Trying (Serial+MTP+Audio)            
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x04D5
  #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','T','P',' ','D','i','s','k'}
  #define PRODUCT_NAME_LEN    15
  #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    3    // 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 Disk
  #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    5
  #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    1    // Audio (uses 3 consecutive interfaces)  was 1
  #define AUDIO_TX_ENDPOINT     6
  #define AUDIO_TX_SIZE         180
  #define AUDIO_RX_ENDPOINT     3
  #define AUDIO_RX_SIZE         180
  #define AUDIO_SYNC_ENDPOINT    7
  #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_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
  #define ENDPOINT6_CONFIG    ENDPOINT_RECEIVE_ISOCHRONOUS + ENDPOINT_TRANSMIT_ISOCHRONOUS   // Audio
  #define ENDPOINT7_CONFIG    ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_ISOCHRONOUS        // Audio
is it possible????? or we are waste efforts
 
Last edited:
Are you using Windows? If so, you (probably) need to change the PID number or BCD version number with each edit. Windows caches USB device info in its registry, and for reasons only Microsoft can understand they use that stale info even if the just-read USB descriptors say otherwise.

If you're using Linux, sometimes the kernel will log really helpful messages. In a terminal, use "tail -f /var/log/syslog" or "dmesg --follow", then do the upload and watch at the kernel tells you.
 
running window7 32bit. sorry did not understand "PID" /"BCD" . I think mistake is another one in mixing of interfaces.
alone [(USB_MTPDISK)] works. alone [Serial+Midi+Audio] works. not work all these in one.
have you never read/write any post on a Audio project having MTP????
Or
No anyone tried MTP interface add to another interfere???
 
Last edited:
This is working for me (Arduino 2.2.6 /TD 0.60.5)
Code:
#include <Audio.h>
#include <MTP_Teensy.h>

AudioInputI2S            acq;
AudioOutputUSB           usb1;

AudioConnection          patchCord1(acq, 0, usb1, 0);
AudioConnection          patchCord2(acq, 1, usb1, 1);

#include <SD.h>
#include <MTP_Teensy.h>
#define CS_SD BUILTIN_SDCARD

void setup() {
  // put your setup code here, to run once:
  AudioMemory(80);


  // mandatory to begin the MTP session.
  MTP.begin();

  // Add SD Card
  SD.begin(CS_SD);
  MTP.addFilesystem(SD, "SD Card");

}

void loop() {
  // put your main code here, to run repeatedly:

  MTP.loop();  //This is mandatory to be placed in the loop code.
  static uint32_t t0=0;
  if(millis()>t0+1000)
  {
    Serial.println(AudioMemoryUsageMax());
    AudioMemoryUsageMaxReset();
    t0=millis();
  }
}
using a modified Audio_midi_serial type
Code:
#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

Obviously I selected as usb type serial+midi+audio

to get this compiled I replaced in the cores 'MTP_Teensy.* and 'MTP_Storage.*' files
Code:
#if defined(USB_MTPDISK) || defined(USB_MTPDISK_SERIAL)
by
Code:
#if defined(USB_MTPDISK) || defined(USB_MTPDISK_SERIAL) || defined(USB_MIDI_AUDIO_SERIAL)

on Windows11 no PID change required.
I got USB audio enumerated and could simulaneously address the SD card

PS: This is a quick and dirty approach, but Paul may augment the usb_desc.h and board.txt file if needed
 
Last edited:
running window7 32bit.

Windows 10 was the very first version Microsoft made that didn't have a lot of really painful USB driver bugs. Crafting multi-interface USB devices to work with those early version of Windows is much harder, not because of anything you do wrong, but because Microsoft just didn't care about USB driver quality until Windows 8 flopped in the market.

But even on Windows 10 and 11, you will face the problem where Windows doesn't notice your USB device has changed if it has the same VID-PID-Version numbers in the main device descriptor.
 
A couple of points to add.

No one has explained PID - it's the #define PRODUCT_ID 0x048A or similar line. Valid values for correct working with Teensyduino are not documented anywhere I can (easily) find, but can be inferred from the Linux udev rules as anything from 0x470 to 0x4AF. I think.

As @WMXZ notes, you'll currently need to change some MTP files in cores. This is inconsistent with usual practice for making your own USB mix, and stems from a commit made in June 2025. I'll take a look at some point and put in a pull request if I think I have a solution, and if someone doesn't beat me to it.
 
I would have no issue with making a PR, e.g. creating a new USB device, say Audio-MTP-Serial with all the changes in core and boards.txt, but IMHO, the PID should be chosen by Paul and integrated into the upload procedure, so that the new PID is recognized and no Boot-button press is necessary.
 
It's not so much about the new option, but that Paul broke the ability to easily make your own mix using MTP as one of the interfaces. As you noted, he put
C++:
#if defined(USB_MTPDISK) || defined(USB_MTPDISK_SERIAL)
in the MTP*.* files, whereas for consistency it should be
C++:
#include "usb_desc.h"
#if defined(MTP_INTERFACE)
That way, any custom interface mix which includes an MTP interface will compile in the MTP code. This approach is more consistent with other interface types, I think.
 
...adding options to the Tools menu, with corresponding PIDs etc., is definitely Paul's job. There's no repo for any of that stuff, it's all internal PJRC voodoo.
 
Back
Top