Part of the whole SD card mux game involves finding the card reader the SD card for a particular board is plugged into.
Following a lead provided by Zygmunt, it seems that you can address devices by USB topology by looking in /sys/bus/usb/devices/ -- for example, the front right USB port on my laptop seems to correspond to a directories called "1-1.2" and "1-1.2:1.0" in here, the back left port corresponds to "3-1" and "3-1:1.0" and a particular port on a USB hub plugged into the front left USB port seems to correspond to "2-1.2.3" and "2-1.2.3:1.0". So this seems to be reasonably straightforward (although I don't know if the mapping is necessarily stable across reboots or kernel upgrades -- seems like it should be though).
The next fun is mapping this directory to a block device. Poking finds that (with the card reader plugged into the last location mentioned above) the directory at:
/sys/bus/usb/devices/2-1.2.3:1.0/host31/target31:0:0/31:0:0:0/block/
contains a directory called 'sdb' and indeed the sd card is mounted as /dev/sdb. Playing around shows that the 31 here is a number that gets incremented each time you plug/unplug the reader (or maybe any USB device). So this suggests that we could address the card reader in this port as "2-1.2.3:1.0" and to e.g. run l-m-c targetting the card in the reader, we should look at
/dev/$(ls /sys/bus/usb/devices/${address}/host*/target*/*:0:0:0/block)
which seems like it would work but frankly also seems like a total hack.
Do any of you know if this can be done in a cleaner way?
Cheers, mwh