LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Using udev to connect to Android device (https://www.linuxquestions.org/questions/linux-general-1/using-udev-to-connect-to-android-device-4175611859/)

rng 08-13-2017 01:36 AM

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.

ferrari 08-13-2017 03:56 AM

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.

aus9 08-13-2017 04:29 AM

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

rng 08-13-2017 06:57 AM

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.

ferrari 08-13-2017 02:46 PM

Thanks for the update.

watchingu 10-29-2017 03:32 AM

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


All times are GMT -5. The time now is 05:41 AM.