mido: Cannot connect to MIDI device with two identical MIDI USB VID PID

I’ve two identical MIDI devices with the same MIDI USB VID and PID. One of the two devices is set into update mode and registers with a different set of MIDI input/output port names. Functions mido.get_input_names() and mido.get_output_names() returns an incorrect list of MIDI port names when both MIDI devices are connected to the computer.

Python test script:

import mido

print(mido.get_input_names())
print(mido.get_output_names())

Output:

1. Connect first device A and run test script (Correct output):
    ['MyDevice 0']
    ['Microsoft GS Wavetable Synth 0', 'MyDevice 1']

2. Connect second device in update mode and run test script again (Correct output):
    ['MyDevice-update 0']
    ['Microsoft GS Wavetable Synth 0', 'MyDevice-update 1']

Connect first device, then second device in update mode and run script again (Incorrect output):
    ['MyDevice 0', 'MyDevice 1', 'MyDevice 1']
    ['MyDevice 1', 'Microsoft GS Wavetable Synth 0', 'MyDevice 1', 'MyDevice 2']

I can open MIDI ports on MyDevice 1, but not on MyDevice-update x. Is there a workaround or do I something wrong?

Info:

  • Windows 10
  • Mido: v1.2.10
  • python-rtmidi: 1.4.9
  • Python: v3.9.10

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

Just stumbled across that: https://gist.github.com/yoggy/1485181 Maybe enough.

Thanks for your hint. Same problem with updated source. So the problem is located in the Windows API. I think research stops here:

Output (incorrect):

MIDI input devices:
    0 : name = MyDevice-update
    1 : name = MyDevice-update
MIDI output devices:
    0 : name = Microsoft GS Wavetable Synth
    1 : name = MyDevice-update
    2 : name = MyDevice-update

wMsg=MIM_OPEN

I’ve built this Windows C# MIDI UWP example from source and works as expected: https://docs.microsoft.com/en-us/samples/microsoft/windows-universal-samples/midi/