Search

OnePlus Two & OnePlus X - Enable ADB and MTP under Ubuntu 14.04 LTS

Contents[Hide]

dropcap oneplustwo ubuntu

If you plug your OnePlus Two or OnePlus X on a Ubuntu 14.04 LTS workstation while in MTP mode, you'll notice that you won't be able to access your phone filesystem.  You'll only get a read-only cd-rom emulation drive holding some windows and OSX drivers.  But if you connect in PTP mode, no problem, everything works fine.

This comes from the fact that OnePlus Two and OnePlus X are not known as a MTP device under Ubuntu 14.04 LTS.

You'll also realize that your OnePlus Two / OnpePlus X won't be recognized as an ADB device, even if ADB has been enabled on the phone. Thats again because vendor ID is not included in the default list.

This short article explains how to declare your OnePlus Two / OnePlus X as an ADB and a MTP device on your Ubuntu 14.04 LTS workstation to get a fully functional access to your device.

1. Main principle

When connected thru USB your OnePlus Two or OnePlus X are detected as an unknown manufacturer product :

Terminal
# lsusb
...
Bus 003 Device 075: ID 2a70:9011
...

It has following caracteristics :

  • Vendor ID : 2a70
  • Product ID : 9011 / f003 (MTP mode) & 904d / 904e (PTP mode)

This unknown vendor ID has two side effects :

  • it is not detected as an ADB device, even if you've enabled USB debugging on the phone
  • is is not detected as a MTP device, even if MTP mode is enabled on the phone

When you plug your OnePlus Two / OnePlus X in ADB mode, it is not detected.

Terminal
# adb devices
List of devices attached

In Nautilus you only only see an emulated CD-ROM drive with some OSX and WIndows drivers.

oneplustwo nautilus cdrom

 

To be fully accessible, any MTP device should have 2 rules declared to udev :

  1. First rule should allow Read/Write access to the device to any user belonging to plugdev group
  2. Second rule should force device handling thru libmtp

Once these 2 rules are properly declared, your OnePlus Two or OnePlus X will be detected as a standard MTP device.

2. Declare Vendor ID for ADB

To be detected as an ADB device, your OnePlus Two / OnePlus X vendor ID should be declared in ~/.android/adb_usb.ini

~/.android/adb_usb.ini
0x2a70

You just need to create or modify this file with OnePlus vendor ID declaration.

Terminal
# mkdir --parent ~/.android
# echo "0x2a70" >> ~/.android/adb_usb.ini

3. Declare Vendor ID for MTP

To allow Read/Write access to the device to any user belonging to plugdev group, new USB Vendor ID 2a70 should be declared under /etc/udev/rules.d/51-android.rules.

This is done by adding the following lines :

/etc/udev/rules.d/51-android.rules
...
# OnePlus Two (unknown vendor's name)
SUBSYSTEM=="usb", ATTR{idVendor}=="2a70", MODE="0666", GROUP="plugdev"
...

Easiest way to do it is to retrieve a complete declaration file from my GitHub account. This file includes declaration for both OnePlus Two and OnePlus X.

Terminal
# sudo wget --header='Accept-Encoding:none' -O /etc/udev/rules.d/51-android.rules https://raw.githubusercontent.com/NicolasBernaerts/ubuntu-scripts/master/android/51-android.rules
# sudo chmod a+r /etc/udev/rules.d/51-android.rules

4. Declare the phone as a MTP device

As we've seen previously, when you connect your OnePlus Two or your OnePlus X to your computer USB port, it is not detected as a MTP device.

To force detection, we need to add the following lines to /etc/udev/rules.d/69-mtp.rules. If this file doesn't exist, it should be created.

/etc/udev/rules.d/69-mtp.rules
...
# OnePlus Two (normal & ADB mode)
ATTR{idVendor}=="2a70", ATTR{idProduct}=="9011|f003", SYMLINK+="libmtp-%k", MODE="660", GROUP="audio", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"
...

Easiest way to declare this file is to retrieve it from my GitHub account. It includes OnePlus Two / OnePlus X and some other devices declaration.

Terminal
# sudo wget --header='Accept-Encoding:none' -O /etc/udev/rules.d/69-mtp.rules https://raw.githubusercontent.com/NicolasBernaerts/ubuntu-scripts/master/android/69-mtp.rules
# sudo chmod a+r /etc/udev/rules.d/69-mtp.rules

5. Test ADB & MTP connexion

Last step is to restart udev daemon  and adb server for the new rules to become operational.

Terminal
# sudo service udev restart
udev stop/waiting
udev start/running, process 18281
# adb kill-server
# adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *

You can now connect your OnePlus Two or OnePlus X with ADB debug on and in MTP mode.

Your phone should be detected as an ADB device when ADB debugging is enabled.

Terminal
# adb devices
List of devices attached
b0d361fe    device

In Nautilus, you should get a new Android device with your phone files :

oneplustwo nautilus mtp

 

Hope it helps !

Signature Technoblog

This article is published "as is", without any warranty that it will work for your specific need.
If you think this article needs some complement, or simply if you think it saved you lots of time & trouble,
just let me know at This email address is being protected from spambots. You need JavaScript enabled to view it.. Cheers !

icon linux icon debian icon apache icon mysql icon php icon piwik icon googleplus