Assigning device nodes and interface names on hotplug

I have a MT7628-based device that primarily acts as a station (rather than as an actual router/access point). It is physically connected to two different USB GSM modems that can be powered on and off via GPIO lines. The annoying thing is though, depending on what order I power them on in, the device nodes they appear as (/dev/cdc-wdm0 and /dev/cdc-wdm1) could correspond to either one. I won't always be powering them on in the same order, so I can't just rely on that.

Rather than try to detect this in application code, I'd like to have OpenWrt (18.06.5) assign those device nodes deterministically. They both have distinct USB device IDs, so it should be possible, but I can't figure out how. I know about the scripts in /etc/hotplug.d but this seems like it happens too late ie. the device node has already appeared and these scripts assign a network interface name to it. I think that if I can consistently get the right /dev/cdc-wdm* node assigned, the network interface naming will take care of itself.

Is there an earlier stage of device detection that I can hook into to enforce device node naming on USB hotplug?

1 Like

Create symlinks depending on device parameters:

Ah this didn't click the first time I read it, but I see what it's doing now. Thanks!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.