Fast/Easy way to STOP usb tether connection?

EDIT: It looks like the USB tethering only has to be switched off on the phone before disconnecting. The router will auto reconnect/disconnect without issue. So from OpenWRT’s end all is well. From Android’s end (Andoid 15 LineageOS 22), unplugging hot and replugging doesn’t work (USB tethering switch is grayed out after reconnecting). But if USB tethering is switched off first all is well.

USB tethering works great with the caveat that if the Android phone connected to the router becomes unplugged (i.e. someone answers a call and walks off with it) the connection is a little inconvenient to restart. You can’t just replug the phone via USB and have the internet tether restored. You have to Reboot the router.

However, a neater/cleaner way is to login to LuCI and “STOP” the usb tether connection. Unplug the phone. Then after the phone call, plug the phone back in and RESTART the usb tether connection.

This isn’t practical because by the time someone logs into LuCI and does all this, the phone call is long done ringing.

Is there a one button way (or even an automatic way) STOP the tether and RESTART when plugged in? Manually works great. But it is impractical as mentioned.

Maybe turn off tethering on the phone before unplugging it? Perhaps inconvenient if you have in incoming call, but it should work the way you want it to.

Hotplug script

2 Likes

Interesting. I've never had to perform either of these steps to restore a tethering connection. Tethering is restored for me by plugging the phone back in and turning tethering back on.

What version of Android is running on the phone?

It’s Android 15 (LineageOS 22). I will try (I think I’ve tried it) only turning tethering off on the phone. I know if I just yank the USB cable without touching any settings at all, the phone’s tethering option switch will be grayed out when plugged back in (impossible to turn back on without a router reboot).

EDIT: I am incorrect. If I turn off tethering on the phone first, then unplug, all is well. No need to log into the router’s interface or SSH etc.

1 Like

You can try to power off usb port with uhubctl, ifconfig usb0 down, ip a del and so on.