Sharing a method I came up with to make easytether driver more reliable

I have switched to an unlimited data prepaid on a phone and was looking for a way to get tether working. I was VERY excited to find easytether which works amazingly well, however I had a critical issue that the driver wouldn’t connect reliably when the phone restarts,

This was a problem because I found that my phone’s speed would degrade throughout the day, and rebooting it improved the performance. I set it to restart every day at 5PM so it’s at peak performance before I get home. I also set the easy tether app to be opened at startup, which only works if the lock screen is turned off (I still use a lockscreen app to keep a guest from poking around)

It seemed that when the phone USB device triggers a hotplug event, it’s too early for the easytether app to start listening, so the easytether-usb application closes out. I made the below modification to the hotplug.d 99-easytether-usb script

In your phone developer options, make sure transfer files is the default usb mode

root@npancmgw01:~# cat /etc/hotplug.d/usb/99-easytether-usb
#!/bin/sh

[ "$ACTION" = "add" ] || exit 0

[ "$INTERFACE" = "255/66/1" ] && {
        pgrep -f launch-easytether | xargs kill -9 
        killall -9 easytether-usb
        /root/launch-easytether.sh > /dev/null &
}



root@npancmgw01:~# cat /root/launch-easytether.sh
#!/bin/sh

while true;do
    
    if $(pgrep easytether-usb > /dev/null) ; then
echo null
      else
     /usr/bin/easytether-usb -n -s <device serial number>
    fi
    sleep 60
 done

Finally, i recently discovered this is needed to trigger the hotplug event when the router restarts, the phone usb device needs to reinitialize.
Add this at the end of your system startup script NOTE: 1-1 is the usbcontroller and port number your phone is plugged into.

sh -c 'sleep 60; echo 1 > /sys/bus/usb/devices/1-1/remove'

The first script is the replacement which kills any process with “launch-easytether” in the commandline, and also ensures easytether-usb is not running to prevent a conflict
The second script is what actually launches easytether using the serialnumber of your phone (check easytether-usb --help for info). It will check if easytether-usb process is running, and if it isn’t it will start the driver and wait 60 seconds before trying again.

This will restart the driver if it crashes for any reason, and retries while the phone and app are starting until the driver makes a connection. This takes a “hacky” solution to using unlimited mobile phone with easytether that needs the USB reconnected constantly, and makes it just as reliable as an LTE modem.

3 Likes

Just ine detail ill add, ive found that setting the easy tether app to start 30 seconds after bootup is the most reliable, if its launched immediately, or even 10 seconds after the phone starts, it wont respond to the driver until the usb tether checkbox is toggled off and on.

I use tasker for the on boot launch app action, so i just add a 30sec delay before launching easytether.

Its unfortunate the app is dead and hasnt been updated since 2018, it would be nice if they improved it.

If there is a similar app that is mire recent and has a linux tap driver, i will highly appreciate the reference.

2 Likes

Thanks for sharing. I added this post to “featured” so it is easier to find and refer.

1 Like