5

My c# application must use multiple identical USB MIDI interfaces which are all from the same manufacturer.

In device manager, all devices appear with the same driver name / CLSID - only the PNPDeviceID is different. When I list all MIDI inputs / outputs (using MIDI-dot-net), they appear as follows:

  • ACME-MIDI: Port 1
  • 1- ACME-MIDI: Port 1
  • 2- ACME-MIDI: Port 1

Unfortunately, those names are not always the same for the same device. The ports of device 1 appear sometimes as "ACME-MIDI: Port 1" and sometimes as "1-ACME: Port 1" (they change e.g. after a reboot).

I have used different ways trying to find what name belongs to what device (SetupDi, WMI, Win32_PnPSignedDriver, ...) but I either get the device ID OR the port names it reports, but I'm unable to find the reported MIDI port name (ACME-MIDI: Port n) using the device id or driver key.

Any suggestions?

Update

I'm still looking for a solution to list the Input / Output ports of a MIDI USB interface on a given port (e.g. using Windows API). Seems like this is quite tricky, that's why I start a bounty on this.

lenniep
  • 679
  • 4
  • 11
  • 27
  • You have to use the number of the USB port that the device is connected to. (Look for some property with a value like "Port_#0002.Hub_#0004" or better "PCIROOT(0)#PCI(1D00)#USBROOT(0)#USB(1)#USB(2)".) – CL. Nov 27 '14 at 16:11
  • I was thinking perhaps something along the lines of CL's comment would work. Did you ever get a solution? I have a similar issue with identical scanners. – topshot Oct 11 '16 at 15:54
  • I ended up using different devices with distinct names, so I haven't found any solution yet. If you find something, please let me know =) – lenniep Nov 11 '16 at 10:10

1 Answers1

0

Unfortunately, when using the MIDI APIs alone there is no way to differentiate the devices. You must rely on their name. Fortunately, while the devices order can change, it's my experience that this doesn't typically happen on reboot. However, as you have seen, it can.

I've handled this in the past in my own software by prompting the user to press a key or move a control knob on a device to differentiate them.

Brad
  • 159,648
  • 54
  • 349
  • 530
  • That's what I was afraid of. Since the MIDI devices are being used in a Windows Service in my case, there is no chance for any user interaction. The only thing I know for sure is which interface is connected to which USB port. I was hoping that there is any possibility to get the names using the USB port identifiers... – lenniep Nov 28 '14 at 07:20
  • @lenniep MIDI doesn't require USB, but if you are working with devices that you **know** will be USB there may be an option. I don't know how to do that though. I had this same problem several years ago and never did find a solution. – Brad Nov 28 '14 at 15:05
  • Thanks, I still hope to find a solution. If I was able to determine which USB MIDI interface is connected to which port and which "MIDI Ports" this interfaces provides it should work. – lenniep Nov 28 '14 at 15:26