What do you do when your Android phone is not recognised by Ubuntu?

Panic!

Well maybe not – after you’ve finished cursing and threatening to go back to Windows – I would recommend you dig deep, rollup your sleeves and get creative…

TLDR; skip to the bottom and add my PPA to get the latest version of libmtp

My wife gave me a Vodafone Smart Turbo Android phone running Kitkat (v4.4) for Christmas and I’ve just got around to looking at its music capabilities.  First things first – adding some music to the phone.  Except my favourite music player – Rhythmbox nor Nautilus – refused to see the phone.

Rhythmbox, Nautilus – and many other music players in Linux use the underlying MTP library – libmtp to talk to modern Android phones & tablets.

In Trusty this is v1.1.6 – upstream the latest is v1.1.8 (at the time of writing)

Thus I took the vivid sources and rebuilt this on trusty.

However, this still did not work. Next visit was to the libmtp project. The key recommendation is to file a bug-report on their source tracker. They need the vendor ID and device ID of your phone. You get this by:

running lsusb
then plugin your phone and re-run lsusb

You should now see a new entry being listed:

for example:

foss@emachine:~$ lsusb
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0402:9665 ALi Corp. Gateway Webcam
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
foss@emachine:~$ lsusb
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 006: ID 1ebf:7f29
Bus 001 Device 003: ID 0402:9665 ALi Corp. Gateway Webcam
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

The new entry was 1ebf:7f29 – the vendor ID is the first part (1ebf) and the device ID is 7f29

That’s all well and good – but you’ll need to wait until someone does something with your bug report … and then you’ll need to wait until the next version of libmtp appears in some future version of Ubuntu.

Lets not wait…

On the project website it mentions that you can edit one of the source files – src/music-players.h

So lets create our own debian package. The easiest way to take someone elses pre-made package … mine for example


sudo add-apt-repository ppa:fossfreedom/libmtp
sudo apt-get update
apt-get source libmtp

Edit the music-players.h file


cd libmtp-1.1.8*/src
gedit music-players.h

Scroll to the end and add your new phone entry remembering to suffix a “,” to the end of the last line i.e.

{ “Isabella”, 0x0b20, “Her Prototype”, 0xddee, DEVICE_FLAG_NONE }

change to

{ “Isabella”, 0x0b20, “Her Prototype”, 0xddee, DEVICE_FLAG_NONE },
{ “YU Yureka”, 0x1ebf, “Vodafone smart turbo 4”, 0x7f29, DEVICE_FLAGS_ANDROID_BUGS }

where “YU Yureka” is the Vendor Name, 0x1ebf is your Vendor ID (prefixed with “0x”), “Vodafone smart turbo 4” is the Device description, 0x7f29 is the Device ID (prefixed with “0x”) and DEVICE_FLAGS_ANDROID_BUGS is the common flag because Android MTP is just full of bugs…

Save. Install the prerequisite packages:

sudo apt-get build-dep libmtp
sudo apt-get install devscripts build-essential libtool

Create your own patch for the package and compile:
dpkg-source --commit
debuild -us -uc

Note – if you see the following error:

configure.ac:14: error: required file ‘./ltmain.sh’ not found
configure.ac:5: installing ‘./missing’

Then copy the missing file and repeat the compilation:

cp /usr/share/libtool/config/ltmain.sh ./
debuild -us -uc

This will eventually create a series of Debian packages in the folder above libmtp-1.1.8*

Install the following packages – libmtp-common, libmtp-runtime & libmtp9, with the format sudo dpkg -i libmtp<packagename>

Too complicated? Maybe – but its worth learning the basics of compiling to understand what really goes into producing your favourite software.

Alternatively, find a friendly developer, beg/buy them a coffee and maybe they’ll add your phone to their package 😉


If you’ve skipped this far, install v1.1.8 of libmtp for Trusty (14.04) or Utopic (14.10) and cross your fingers that your phone is in this release:

sudo add-apt-repository ppa:fossfreedom/libmtp
sudo apt-get update && sudo apt-get upgrade

What was interesting examining the vivid package was that Canonical has added the new BQ Aquarius 4.5 Ubuntu Edition to this package. So I’ve included that also in my PPA.

Also, Canonical has added a new phone/phone like device to the vivid package

Description: Adding Arale device id (mtp and mtp+adb)
Forwarded: not-needed
Author: Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>

This is the temporary id used by this device, once the final
one is in place, it’ll be forwarded to upstream.

I wonder what that is??

Advertisements

9 thoughts on “What do you do when your Android phone is not recognised by Ubuntu?

  1. hi! great post! i have a question, what file do i have to edit in order to modify the device info for rhythmbox? i want to do it because i want my phone to appear that it can only play ogg files. Hope you can help me.

    • not sure I follow the gist of your question. LIBMTP is software to allow an android phone to be seen by Linux computers. If you can see your phone in – for example – Nautilus – rhythmbox will similarly see your phone as the same device. Remember in Rhythmbox you need also to enable the MTP plugin.

  2. It’s not working for me :

    dpkg-source -b libmtp-1.1.8.2
    dpkg-source: info: using source format `3.0 (quilt)’
    dpkg-source: info: building libmtp using existing ./libmtp_1.1.8.2.orig.tar.xz
    dpkg-source: info: local changes detected, the modified files are:
    libmtp-1.1.8.2/src/music-players.h
    dpkg-source: error: aborting due to unexpected upstream changes, see /tmp/libmtp_1.1.8.2-1+ppafossfreedomubuntu2.diff.SNa3AD
    dpkg-source: info: you can integrate the local changes with dpkg-source –commit
    dpkg-buildpackage: error: dpkg-source -b libmtp-1.1.8.2 gave error exit status 2
    debuild: fatal error at line 1364:
    dpkg-buildpackage -rfakeroot -D -us -uc failed

      • so now I did :

        # cd ../
        # dpkg-source –commit

        And I have the following error :

        libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4′.
        libtoolize: copying file `m4/libtool.m4′
        libtoolize: copying file `m4/ltoptions.m4′
        libtoolize: copying file `m4/ltsugar.m4′
        libtoolize: copying file `m4/ltversion.m4′
        libtoolize: copying file `m4/lt~obsolete.m4′
        configure.ac:10: installing ‘./compile’
        configure.ac:13: installing ‘./config.guess’
        configure.ac:13: installing ‘./config.sub’
        configure.ac:5: installing ‘./install-sh’
        configure.ac:14: error: required file ‘./ltmain.sh’ not found
        configure.ac:5: installing ‘./missing’
        examples/Makefile.am: installing ‘./depcomp’
        autoreconf: automake failed with exit status: 1
        dh_autoreconf: autoreconf -f -i returned exit code 1
        debian/rules:35: recipe for target ‘build’ failed
        make: *** [build] Error 2
        dpkg-buildpackage: error: debian/rules build gave error exit status 2
        debuild: fatal error at line 1364:
        dpkg-buildpackage -rfakeroot -D -us -uc failed

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s