Ok thanks for confirming it should work, I'll give it another try.
While testing this, I just have one line in both the mapping_in and mapping_out sections for the same device:
{ ch = 1, pitch = 1, mode = "range", type = "sld", dataref = "sim/flightmodel/engine/ENGN_thro[0]", value_min = 0, value_max = 1 }
...the hope being that as I send Pitchbend messages from the controller to change the throttle value, XMidiCtrl should essentially send the same PB messages back to the controller to update the fader position.
Yeah, I'd keep the current manual ID system as it works now (which would at least handle that), and have selecting a device by name as an alternative/optional addressing scheme.
I could think of ways of extending it - for example, when building a list of MIDI device names, if you have multiple devices with the same name, you can add an instance number, so for example, to reference the first "LaunchControl XL", you'd specify as a name for your device mapping in the config file like "LaunchControl XL #1". This doesn't help if the list gets reordered though, as you might be referring to the incorrect device if the order changes - but then the current ID scheme also fails if that happens anyway, as it again just uses the position in the current list of devices. And if there is only, say one "LaunchControl XL" device found, but the user has mappings for "LaunchControl XL #1" and "LaunchControl XL #2", say, you just use the first device, and ignore the mappings set up for additional devices which aren't available.
Given what the system reports for a MIDI Port (especially cross-platform), it's difficult to always reliably detect which of multiple devices you are referring to consistently. At least referring to devices in the toml files by name will handle a lot of scripts that would otherwise stop working when the list of devices changes and your controller is now in a different position and has a different ID.
Thanks!