You are not logged in.

#1 2021-02-07 16:51:40

raider_1010
Member
Registered: 2021-02-05
Posts: 7

Android automatic tether udev rule not working

Hi, i wanted to start usb tethering when the phone is attached but the command is not working.

90-android-tethering.rules

ACTION=="add", SUBSYSTEM=="usb", DRIVER=="usb", ATTR{product}=="Android", RUN+="/usr/bin/adb shell svc usb setFunctions rndis"

# ps aux | grep adb
root         440  0.3  0.3  14564  6244 ?        S    17:48   0:00 /usr/bin/adb shell svc usb setFunctions rndis
root         442  0.0  0.0   3168   872 ttyS0    S+   17:48   0:00 grep adb

It looks like the udev rule is triggering somethig but it is not working.
If i type the same command it works perfectly.
I remember that i had this situation times ago and it works by using a script but i really want to avoid that as it only one command.

Offline

#2 2021-02-07 18:02:27

raider_1010
Member
Registered: 2021-02-05
Posts: 7

Re: Android automatic tether udev rule not working

It seems that udev has no network access as the adb server needs that

Offline

#3 2021-02-08 08:05:23

seth
Member
Registered: 2012-09-03
Posts: 50,011

Re: Android automatic tether udev rule not working

How do you intend to use something that relies on "network access" (internet?) to setup tethering, where the latter is likely what's supposed to provide you w/ that "network access"??
=> Did you read https://wiki.archlinux.org/index.php/Android_tethering

adb is only(?) required for AziLink connections which is only required if your phone is, like, *really* old.

Online

#4 2021-02-08 08:35:17

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: Android automatic tether udev rule not working

seth wrote:

adb is only(?) required for AziLink connections which is only required if your phone is, like, *really* old.

Maybe enabling the android tether function using adb is a work-around for devices that hide or disable the function in the android settings?

udev stops processes after a few seconds, so possibly that is too short for adb.

Last edited by progandy (2021-02-08 09:35:18)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#5 2021-02-08 08:50:22

seth
Member
Registered: 2012-09-03
Posts: 50,011

Re: Android automatic tether udev rule not working

Let's pretend we're not doing something that violates the ToS here… ;-)
The process runs long enough to be grepped, but it might spawn too early (ie. the device is there but not yet ready to accept commands) in which case one could prepend a short sleep to give it some time.

In either (since the latter will last for the sleep) case see https://wiki.archlinux.org/index.php/Ud … _processes

But to be clear: on a non-castrated modern android there's no need for this at all.

Online

Board footer

Powered by FluxBB