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

StackOverflow https://stackoverflow.com/questions/9790715

  •  25-05-2021
  •  | 
  •  

Question

I'm connecting a several identical USB-MIDI devices and talking to them using Python and pyportmidi. I have noticed that when I run my code on Linux, occasionally the MIDI ports of the devices are enumerated in a different order, so I send messages to the wrong devices. As the devices do not have unique identifiers, I am told that I should identify them by which USB port they are connected to.

Is there any way to retrieve this information? My app will run on Linux, but Mac OS support is useful for development.

It's annoying because they usually enumerate in a sensible order - the first device in the hub is the first device in portmidi, but sometimes they don't - usually the first 2 devices are switched. I have to physically move the devices without unplugging to fix them.

No correct solution

OTHER TIPS

lsusb should do the trick. All devices and their respective hubs are listed there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top