LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-13-2017, 01:36 AM   #1
rng
Senior Member
 
Registered: Aug 2011
Posts: 1,059

Rep: Reputation: 41
Using udev to connect to Android device


I am using method from this page to connect my android mobile to my Debian9 system using udev rules: https://android.stackexchange.com/qu...10/39437#39437

* Find vendor and product ID using lsusb or dmesg output:
* As root, create rules file: /etc/udev/rules.d/51-android.rules
* Insert:
Code:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4e22", MODE="0666" GROUP="androiddev", SYMLINK+="android%n"
* Restart udev:
Code:
systemctl restart udev
However, the device is not getting recognized on disconnecting and reconnecting, even after rebooting. Where is the problem and how can it be solved? Thanks.
 
Old 08-13-2017, 03:56 AM   #2
ferrari
Senior Member
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 2,169

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
I do know that a udev rule matches need to use matching of the attributes of the device and the attributes from one single parent device.

References:
https://wiki.archlinux.org/index.php/udev
http://www.reactivated.net/writing_u...les.html#basic

So I'm wondering if the rule matching shouldn't use 'SUBSYSTEM="usb"' instead...
Code:
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4e22", MODE="0666", GROUP="androiddev", SYMLINK+="android%n"
Anyway, you can investigate valid attributes for a given device using the following:

Code:
lsusb
The bus and device node for a given device then can be used to get the device attributes, eg for bus 003, device 004
Code:
udevadm info -a -p $(udevadm info -q path -n /dev/bus/usb/003/004)
Hope this helps.

PS: I note your original rule was missing a comma between MODE and GROUP assignment parameters.

Last edited by ferrari; 08-13-2017 at 04:10 AM.
 
Old 08-13-2017, 04:29 AM   #3
aus9
LQ Addict
 
Registered: Oct 2003
Location: Australia
Distribution: MX 16
Posts: 5,283

Rep: Reputation: Disabled
Hi

as a local user run
Code:
groups
does this group exist?

I think plugdev group might be better?

personally I prefer android-file-transfer
https://github.com/whoozle/android-file-transfer-linux
 
Old 08-13-2017, 06:57 AM   #4
rng
Senior Member
 
Registered: Aug 2011
Posts: 1,059

Original Poster
Rep: Reputation: 41
I think following line is working:
Code:
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4e22", MODE="0666", GROUP="plugdev", SYMLINK+="android%n"
Now when I turn on MTP connect on android device, it appears in the file manager on desktop and I can access the files on the device. Thanks.

Last edited by rng; 08-13-2017 at 06:59 AM.
 
Old 08-13-2017, 02:46 PM   #5
ferrari
Senior Member
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 2,169

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
Thanks for the update.

Last edited by ferrari; 08-13-2017 at 02:47 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to connect your Android device on Ubuntu Linux LXer Syndicated Linux News 0 12-10-2015 01:51 PM
Device unable to connect to adb; LG LU2300 (Optimus Q) Android tensionwind Linux - Mobile 3 11-26-2011 06:42 AM
Can you force your android device to connect to only one wifi channel? archieval Linux - Mobile 0 01-26-2011 01:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration