Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 10 of 10

Thread: Trouble extending Mass Storage Device MTP Disk

  1. #1

    Trouble extending Mass Storage Device MTP Disk

    The MTP Responder works great using the provided MTP Disk (Experimental) usb type selection.

    However, if I try extending the MTP disk functionality with other usb devices I get odd problems.

    This is on Windows 7 ultimate sp1, using Teensy 3.6. I have tried clearing the USB cached devices, changing the USB descriptors and reinstalling many times but issues persist.

    For instance, if I try this addition to usb_desc.h

    #elif defined(USB_MTPDISK_SERIAL)
      #define VENDOR_ID		0x16C0
      #define PRODUCT_ID		0x04D7
      #define BCD_DEVICE		0x0215
      #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_USB_BUFFERS	30
      #define NUM_INTERFACE		3
      #define MTP_INTERFACE		3	// MTP Disk
      #define MTP_TX_ENDPOINT	4
      #define MTP_TX_SIZE		64
      #define MTP_RX_ENDPOINT	4
      #define MTP_RX_SIZE		64
      #define MTP_EVENT_ENDPOINT	5
      #define MTP_EVENT_SIZE	16
      #define MTP_EVENT_INTERVAL	10
      #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
    Along with this addition in boards.txt
    Code: + MIDI + MTP Disk
    MTP disk is present and is usable but the serial port appears broken, appearing as "unknown" in the ports menu.
    Other combinations I have tried always appear to leave one of the interfaces broken.

    Also, here is my clumsy attempt to write an MTP driver for Serialflash devices. This is also not working quite right yet, files transfer but the windows explorer does not refresh to show them until a replug. It was working but stopped at some point so not sure if it is just that I broke my Windows USB stack.
    So now I'm stuck. I don't know what I'm doing so no surprise really. Can anybody please suggest where I might be going wrong?

  2. #2
    Senior Member
    Join Date
    Jul 2014
    AFAIK, there is more to adding new USB device than adding text to usb_desc.h
    In the forum, some years ago, there was an example on how to add own devices

  3. #3
    I saw this
    which directed me to the instructions at the start of usb_desc.h which I followed to produce the entries above. I probably stuffed it up somehow. Can you please provide a link to the forum posts? I don't seem to be able to find much else.

  4. #4
    Cut-paste error above, the relevant entry in boards.txt is
    Code: + MTP Disk
    What I was really wanting is
    Code: + MIDI + Audio + MTP
    which I tried first but breaks worse. In this case transfers to MTP freeze after transferring a small number of packets leaving incomplete files. To debug this I tried simpler configurations and just having serial with MTP as above is enough to fail.

    Note that the original MTP with Teensy HID emulated serial still works for me, as does other serial based selections without MTP. I can have either serial or MTP but not both.

  5. #5
    Senior Member
    Join Date
    Jul 2014
    If you wanted to add new descriptor see for example
    if you to modify a descriptor this thread gives you also what you need to know
    caveat: I never modified/added USB_types

  6. #6
    Thanks for the reply, I had not seen that thread but it has left me a little bit confused. It speaks of XX_DESC_OFFSET and CONFIG_DESC_SIZE defines in the usb device entries. These do not seem to be mentioned or present in the current installed usb_desc.h. Are they still relevant or perhaps no longer required?

    However, the thread also suggests looking for #if defined(USB_XXX) in the usb type drivers, this sounds promising. I will examine the serial driver to see if it needs another #if defined() in order to pick up the modified type entry. Cheers!

  7. #7
    Too bad, not it. The serial picks up on
    #if defined(CDC_STATUS_INTERFACE) && defined(CDC_DATA_INTERFACE)
    which are defined in the failing entry. It seems to me the defines should be working and the driver is being brought in. On further reflection, I think if the driver was being excluded serial would not work or show up at all rather than being present but not functional as it is.

    My vague theory is that one of the endpoints is being clobbered somehow. I haven't a clue how to investigate this further. Is the entry I composed in the first post valid or did I make a mistake there?

  8. #8
    Any update on this?

  9. #9
    I never made any further progress on this despite spending too much time on it. I would very much like to see it working, but debugging it seems beyond my ability. Having exhausted myself with it, I thought I would wait for the topic to come up again, secretly hoping somebody else would perhaps fix it in the meantime. No such luck.

    I would love it if somebody could help to take a look at MTP combined with other USB types? Even in it's current state I found it a very useful functionality. It seems to be almost working..

  10. #10
    I need to be able to at least switch between MTP and Serial+MIDI, I don’t need them simultaneously but the user needs to be able to go into “disk mode”. So I will be putting some hours into this.

    Could you share your latest code/files and explain where you’re at? I will absolutely share my work as well.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts