Connect the OnePlus X or Two to ArchLinux over MTP

The brand new OnePlus Two and OnePlus X just arrived, and they are beautiful! But as many brand new things, there are some manual tweaks needed to make them cooperate with our beloved system, before the upstream manages to catch up. If the only thing you can access on your brand new OnePlus device is a fake “OnePlus Drivers” CD drive, this post is for you. Don’t worry, it’s dead simple.

With Android, phones are not directly accessible like any other USB storage device. It uses instead the MTP protocol. This is pretty well supported under Linux using libmtp, but in order for it to work properly, it needs to know that a particular Vendor and Product ID (kind of an identity card for USB devices) supports MTP. This is done through udev, and everything happens in the file /usr/lib/udev/rules.d/69-libmtp.rules, which unfortunately doesn’t contain the proper ruleset for our OnePlus at the moment. There are other blog posts and forum threads on the Net about the issue, but they are not entirely compatible with Arch, though very similar.

First, check which ProductID your device has. OnePlus uses the VendorID 2a70, and usually the OnePlus Two has a ProductID of 9011, and the OnePlus X has f003. You can use the lsusb command for this task.

$ lsusb
...
Bus 004 Device 010: ID 2a70:f003  
...

Let’s create the file /etc/udev/rules.d/51-oneplusx.rules and add a rule to set the proper permission.

SUBSYSTEM=="usb", ATTR{idVendor}=="2a70", ATTR{idProduct}=="f003", MODE="0666", GROUP="adbusers"

Replace the ATTR{idProduct} with the one that suits your configuration. The big change in comparison to other tutorials here, is the use of the group adbusers, which is the right one on Arch. Then, we need to instruct udev to later create a symbolic link and tell libmtp that it can use the device. This file must be named /etc/udev/rules.d/69-mtp.rules and it will probably fail if the name is different.

ATTR{idVendor}=="2a70", ATTR{idProduct}=="f003", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"

Again, replace the ProductID if necessary. Now, reload udev

systemctl restart systemd-udevd

and re-plug your OnePlus.

oneplusX-mtp-enabled

You should be able to access your device over MTP now.