I don't know any side-effects or more efficient way of doing it.
If you do Please tell and I will update this HowTo.
This is done in Fatdog, But should work in other puppies which have udev.
Problem:
Well not a problem, a small inconvenience.
Whenever I connect my android and switch On usb tethering on it, I have to select usb tethering option in Fatdog's control panel.
Which runs an script /usr/sbin/usb-tether.sh
Which presents an gui to select interface and activate network on it.
I wanted to automate it.
HowTo:
① First connect your android to your pc by usb cable.
② Switch On usb tethering in android settings.
③ Run ip link command in terminal it should give you interface name like usb? or enp?s??u?. (in place of ? mark there will be some numbers). On my system it's usb0.
④ Now using above info I can just run command dhcpcd usb0 (or busybox command udhcpc -i usb0) and my net will be On. But to automate it I have to write a udev rule. So....
⑤ Create a file /etc/udev/rules.d/81-android-tether.rules with the following content
Code: Select all
KERNEL=="usb0", SUBSYSTEM=="net", RUN+="/usr/sbin/dhcpcd usb0"
⑥ That's it, save your work, run command udevadm control --reload then run udevadm trigger or plug out your android and plugin again.
or simply restart the system.