Is it possible to find out which USB port the MIDI device is connected to in portmidi / pyportmidi

I plug in several identical USB MIDI devices and talk to them using Python and pyportmidi. I noticed that when I run my code on Linux, sometimes the device's MIDI ports are listed in a different order, so I am sending messages to the wrong devices. Since devices do not have unique identifiers, I am told that I must identify them using the USB port they are connected to.

Is there a way to get this information? My application will work on Linux, but Mac OS support is useful for development.

This is annoying because they are usually listed in a sane order - the first device in the hub is the first device in portmidi, but sometimes it doesn't work - usually the first 2 devices are switched. I have to physically move the devices without detaching to fix them.


source to share

1 answer


must do the trick. All devices and their respective hubs are listed here.



All Articles