LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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,198

Rep: Reputation: 47
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
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,781

Rep: Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139Reputation: 1139
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 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

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,198

Original Poster
Rep: Reputation: 47
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
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,781

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

Last edited by ferrari; 08-13-2017 at 02:47 PM.
 
Old 10-29-2017, 03:32 AM   #6
watchingu
Member
 
Registered: Oct 2017
Location: USA
Distribution: Arch Linux, Debian Stable, Debian Unstable
Posts: 73

Rep: Reputation: 17
I use WiFi File Transfer Pro:

https://play.google.com/store/apps/d...iletransferpro

Very easy to use and has always worked for me. It basically acts like a server on your mobile device. Tip: Do not logout from your browser. Just clear your history and shut down the browser.

Edit: Came across this tip a few minutes ago (10/30/2017): The Simplest Way to Move Files to and from Your Phone

Last edited by watchingu; 10-30-2017 at 01:48 AM. Reason: Adding another tip.
 
  


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 02:44 AM.

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
Open Source Consulting | Domain Registration