Skip to content

Android setup

September 29, 2023
January 13, 2015

Connecting to Android devices on Linux.

Get vendorID

$ lsusb
...
Bus 008 Device 042: ID 18d1:0003 Google Inc.
Bus 007 Device 053: ID 2207:0010
...

The first part of ID is vendorID (18d1 and 2207 in the above example)

Update adb_usb.ini

# with android-sdk properly setup
android update adb

~/.android/ is created, append vendor id to ~/.android/adb_usb.ini

# ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.
0x18d1
0x2207

Restart adb server

adb kill-server
adb devices
# use `sudo` to start server if you see "permissions denied"
sudo $(which adb) devices

Add udev rule

Newer system should not need this.

Using Hardware Devices | Android Developers
android-udev-rules/51-android.rules at master · M0Rf30/android-udev-rules

Add 51-adb.rules to /etc/udev/rules.d:

# allwinner board
#SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1",ATTR{idProduct}=="0003",SYMLINK+="android_adb"
# rockchip board
#SUBSYSTEM=="usb", SYSFS{idVendor}=="2207", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="2207", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="2207",ATTR{idProduct}=="0010",SYMLINK+="android_adb"

make sure your user is in group plugdev

# restart udev
sudo udevadm control --reload-rules
sudo service udev restart

Reference

http://www.slatedroid.com/topic/41219-connecting-to-a-rk3066-based-board-via-adb-on-linux/
https://wiki.archlinux.org/title/android
http://community.linuxmint.com/tutorial/view/888
http://stackoverflow.com/questions/14460656/android-debug-bridge-adb-device-no-permissions

MTP

http://open-rotorman.blogspot.com/2013/07/samsung-galaxy-s2-usb.html > http://www.omgubuntu.co.uk/2011/12/how-to-connect-your-android-ice-cream-sandwich-phone-to-ubuntu-for-file-access
see /etc/udev/rules.d/ and /lib/udev/rules.d/

Add 51-android-mtp.rule to /etc/udev/rules.d: (not working)

this get rids of "Unable to open MTP device '[usb:007,038]'" pop-up, but the device listed is empty

# samsung note3
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666", OWNER="[username]"

HOWTO: Linux and MTP - xda-developers
Intro to MTP, PTP, and UMS | Linux.org
Samsung Galaxy Devices and Linux Mint
Android USB Connections Explained: MTP, PTP, and USB Mass Storage
MTP - ArchWiki
MTPfs « Dual Elephants
Mount MTP device on Debian 7 wheezy | Roger Steneteg
[GUIDE] How-To Automount Your Note 10.1 to Linux with MTP - xda-developers
Getting MTP enabled devices to work with Ubuntu? - Ask Ubuntu
The easy way: share data between Nexus 7 and Debian | Legen ... d(i)ary!
The hard way: make MTP work with Nexus 7 on Debian | Legen ... d(i)ary!

issues

http://sourceforge.net/p/libmtp/bugs/574/
https://bugs.launchpad.net/ubuntu/+source/libmtp/+bug/1015010