Hotplug cdc_ether modem to replace wan interface device

Hi,

I have a cdc_ether usb modem (Huawei E3372) that I use with GL-MT300A. To use it I had to add a device 'eth1' and dhcp interface. I would like to make this more generic however. I would like to have a hotplug event that detects that a cdc_ether device was connected, grabs it's interface name and creates appropriate device in uci. Then it replaces it as 'wan' interface device and places wan interface as a part of lan switch. Can someone help me to make a script in /etc/hotplug.d/usb that would detect a cdc_ether modem? I can easily do the uci stuff later. I obviously need to detect disconnection so I can restore old wan to ethernet port :slight_smile:
Thanks!

similar, but for a printer - P910nd was broken in the new version of openwrt 23.05 - #8 by Oleh.vn

1 Like

Thanks! My main problem is that I created a dummy script in /etc/hotplug.d/usb - this script just dumps $(env) to logd and there is no info in any variable that device is a cdc_ether, hence this is my main issue - how to identify it :slight_smile: