hardware: Raspberry Pi 2B+
I have a strange problem: I have a huawei e5577s that is plugged in via usb.
I have a hotplug.d/iface script that renames the openwrt "device" to "huawei1"
This script is based on the hotplug.d example found on the openwrt wiki, my cold boot and (adapted) hotplug works. I rename the interface, so that it can consistently be associated with the correct openwrt interface, and firewall zone. I have multiple huawei devices plugged in, with different idProduct information.
network.huawei1_dev=device network.huawei1_dev.name='huawei1' network.huawei1_dev.mac='0c:5b:8f:27:9a:64' network.huawei1_dev.idProduct='14dc' network.huawei1_dev.idVendor='12d1' network.huawei1_dev.version=' 2.10'
I added the idProduct bit, because huawei driver always assigns the same MAC. So this was an additional step I took to differentiate between the multiple huawei openwrt "devices".
my openwrt "interface" also happens to be named "huawei1"
At random times when the openwrt device goes down and comes back up, because I unplugged to sim swap. For background information, the hotplug.d/iface script will down openwrt device, then rename openwrt device, then openwrt device up.
luci will show the openwrt interface is up, and assigned an IP (what appears to be the same IP that was previously assigned from huawei e5577s dhcp server). However, when I connect to the console and run
ip addr show dev huawei1, there is no IPv4 assigned!
I have to manually assign the ip, and it works. But why does this happen randomly?
Where does luci store this information displayed? Perhaps I can pull that information into my hotplug.d/iface script if the IP is not assigned in reality, when the openwrt interface shows
ubus call network.interface.huawei1 down ubus call network.interface.huawei1 up
does not work work.
does not work
only reboot works
Another problem is restarting the openwrt interface. When I press stop. the openwrt device is down, and stays down. When I click restart, it does not bring the openwrt huawei1 device up, only the interface. Apparently by design it will only bring up virtual devices? Why? How to get around this problem? Because of this design, I had to add to my hotplug.d/iface script,
ip link set huawei1 up. To ensure that after the openwrt huawei1 device goes down, it will come back up again. So that it can "restart" properly.
Is there a better way to do it, another pre or post hook script that could be called when clicking restart?