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

Thread: T3.6 USB Host MIDI - Theory of operation question

  1. #1
    Member
    Join Date
    May 2018
    Location
    Portland, OR USA
    Posts
    27

    T3.6 USB Host MIDI - Theory of operation question

    If I missed this info in another thread feel free to point to it, I’ve been browsing and reading for several hours today and haven’t come across these answers. But learned a ton of other stuff in the search! :-)

    I’m working on a MIDI router device that bridges several “5-pin DINs” (via serial UARTs) to the “USB device port” and the “USB host ports via 4 port hub”.

    I’d like to know when a device is connected/disconnected to one of the USB host ports. Is there a callback function I can register with the USB host object to be notified? Or do I need to poll it through the available() function? Or???

    I know about the product string and manufacture string functions, but The device really needs to keep a list of which physical port each device is plugged into. This info is needed so the user can select routings for MIDI messages by physical port numbers. Perhaps the hub number is also needed in case an additional hub is plugged in.

    I noticed the device port/hub number in the debug dump, but can’t find an easy way to get this info via a function?

    Any help would be awesome. And thanks to all who are working on the USB host! Especially Paul for keeping MIDI top of mind.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,915
    Quote Originally Posted by SteveBar View Post
    I’d like to know when a device is connected/disconnected to one of the USB host ports.
    USBHost_t36 follows the Arduino convention where you can use the device name as a boolean, which tests as true if the USB device is connected, or false if not connected.

  3. #3
    Member
    Join Date
    May 2018
    Location
    Portland, OR USA
    Posts
    27
    Hi Paul thanks for the reply.
    Any chance of getting a function to read the port and hub numbers? Otherwise the user has no idea which physical device corresponds to which logical device# in the enumeration list:
    MIDIDevice midi01(myusb);
    MIDIDevice midi02(myusb);
    MIDIDevice midi03(myusb);
    ...etc

    All my tests show the sort order of this list is based on the device response time not physical USB port. See UI moc-up below.


    Also I’m trying to find the “required reading” USB chapter you suggested, can you re-post the link here?
    Thanks again
    Steve

    Click image for larger version. 

Name:	MRTR Black Top Mount v5.jpg 
Views:	6 
Size:	149.6 KB 
ID:	16403
    Last edited by SteveBar; 04-11-2019 at 04:35 PM.

Posting Permissions

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