Hello, I'm experimenting with a Teensy 3.6 in MTP+Serial mode, which required a bit of tinkering with the usb_desc.h. I just followed instructions in https://forum.pjrc.com/threads/43050-MTP-Responder-Contribution.
I can get it to work and access files from my computer, or send and receive serial data if I don't go in the mtpd.loop(). However, I would like to disable the teensy MTP mode while a certain serial command is not received, implying that the computer does not detect it as an MTP device. The usb_desc.h file describes the CDC and MTP interfaces, and I have been trying to disable the MTP interface, but whatever I do the computer always detects an MTP device.
The enabled case in usb_desc.h:
#define VENDOR_ID 0x16C0
#define PRODUCT_ID 0x04E0
#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',' ','S','E','R','I','A','L'}
#define PRODUCT_NAME_LEN 17
#define EP0_SIZE 64
#define NUM_ENDPOINTS 7
#define NUM_USB_BUFFERS 40
#define NUM_INTERFACE 3
#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 3
#define CDC_ACM_SIZE 16
#define CDC_RX_SIZE 64
#define CDC_TX_SIZE 64
#define MTP_INTERFACE 2 // MTP Disk
#define MTP_TX_ENDPOINT 6
#define MTP_TX_SIZE 64
#define MTP_RX_ENDPOINT 6
#define MTP_RX_SIZE 64
#define MTP_EVENT_ENDPOINT 7
#define MTP_EVENT_SIZE 16
#define MTP_EVENT_INTERVAL 10
#define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
#define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ONLY
#define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
#define ENDPOINT7_CONFIG ENDPOINT_RECEIVE_ONLY
Any advice?
Thank you in advance
I can get it to work and access files from my computer, or send and receive serial data if I don't go in the mtpd.loop(). However, I would like to disable the teensy MTP mode while a certain serial command is not received, implying that the computer does not detect it as an MTP device. The usb_desc.h file describes the CDC and MTP interfaces, and I have been trying to disable the MTP interface, but whatever I do the computer always detects an MTP device.
The enabled case in usb_desc.h:
#define VENDOR_ID 0x16C0
#define PRODUCT_ID 0x04E0
#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',' ','S','E','R','I','A','L'}
#define PRODUCT_NAME_LEN 17
#define EP0_SIZE 64
#define NUM_ENDPOINTS 7
#define NUM_USB_BUFFERS 40
#define NUM_INTERFACE 3
#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 3
#define CDC_ACM_SIZE 16
#define CDC_RX_SIZE 64
#define CDC_TX_SIZE 64
#define MTP_INTERFACE 2 // MTP Disk
#define MTP_TX_ENDPOINT 6
#define MTP_TX_SIZE 64
#define MTP_RX_ENDPOINT 6
#define MTP_RX_SIZE 64
#define MTP_EVENT_ENDPOINT 7
#define MTP_EVENT_SIZE 16
#define MTP_EVENT_INTERVAL 10
#define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
#define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
#define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ONLY
#define ENDPOINT6_CONFIG ENDPOINT_TRANSMIT_AND_RECEIVE
#define ENDPOINT7_CONFIG ENDPOINT_RECEIVE_ONLY
Any advice?
Thank you in advance