Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 17 Oct 2018, 14:12
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
Autoconnect Android USB Tethering with udev rule
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [3 Posts]  
Author Message
drunkjedi


Joined: 24 May 2015
Posts: 897

PostPosted: Sat 10 Mar 2018, 03:53    Post subject:  Autoconnect Android USB Tethering with udev rule  

This is my try which, well.... works.

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:
KERNEL=="usb0", SUBSYSTEM=="net", RUN+="/usr/sbin/dhcpcd usb0"
Replace the usb0 with what you found on your system
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.
Back to top
View user's profile Send private message 
drunkjedi


Joined: 24 May 2015
Posts: 897

PostPosted: Sat 10 Mar 2018, 04:15    Post subject:  

There's chance to modify the udev rule with more details from command
Code:
udevadm info -a -p /sys/class/net/usb0
Like ATTRS{serial}=="8a16e391" (for my phone, your's maybe different) or something else, but I think it would be more specific and wouldn't connect other android device of mine automatically.

I have a almost 4 year old Oneplus One and a Xiaomi Note 4.

Both work fine with this method.
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 2270
Location: In The Way

PostPosted: Sat 10 Mar 2018, 07:27    Post subject:  

I think this is very useful!

I will test it out.

thanks
stemsee
Back to top
View user's profile Send private message MSN Messenger 
Display posts from previous:   Sort by:   
Page 1 of 1 [3 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0422s ][ Queries: 13 (0.0164s) ][ GZIP on ]