Friday 6 September 2013

Implementing MTP on Ubuntu Touch

Some of the fun parts of working at Canonical is how you get to work on so many different things.

I've spent the last few days working on an implementation of the MTP protocol for Ubuntu Touch, based on some amazing initial work from Thomas Voß to port the Android MTP libraries to C++.

I hadn't touched C++ in just about ten years. Last time was for school stuff, and it seems like things have changed a fair amount since, so I first had to get back in touch with the quirks of C++, learning Qt (which I used for my initial work), and learning Boost; in particular Boost::Filesystem, and some of the most fun pieces of Boost like BOOST_FOREACH, range adaptors, etc.

But MTP has been progressing very nicely, with code surely ready to land pretty soon in the Touch images. It was initially only exposing image files in /home/phablet/Pictures, but the latest code (still at lp:~mathieu-tl/mtp/images) now exposes all files in /home/phablet.

Not everything is implemented yet: for instance, you won't really have access to see or change permissions, copy or move files around the exposed filesystem, or delete files, but you can already browse and retrieve files, just like you can use the current MTP code to push files to an Ubuntu Touch device.


I'm thrilled at what's to come on that front, this is going to be a lot of fun.
If you're interested in testing this, feel free to take a copy of my bzr branch and experiment. You can build mtp simply:

cd mtp/
sudo apt-get install bzr bzr-builddeb debhelper build-essential cmake libboost-dev libboost-filesystem-dev
bzr bd

Let's keep working on making Ubuntu and the Touch images rock!

4 comments:

Israel said...

Thank you so much!! I am looking forward to one day having a real phone

Unknown said...

Hello,
Thank you for this work!

Sorry for my english I'm french.

When I compile I have the following message:

"Now signing changes and any dsc files...
signfile mtp_0.0.4-0ubuntu1.dsc Mathieu Trudel-Lapierre
gpg: « Mathieu Trudel-Lapierre  » was ignored: the secret key is not available
gpg: /tmp/debsign.YlL39rZw/mtp_0.0.4-0ubuntu1.dsc: clearsign failed: the secret key is not available
debsign: gpg error occurred! Aborting....
debuild: fatal error at line 1278:
running debsign failed
bzr: ERROR: The build failed.
"

Unknown said...

Thanks!
Now just thinking to install UTouch now!

Matt Trudel said...

Jimmy,

This is because I wrote the changes in changelog, and builddeb tries to sign the package it builds with GPG.

You can simply ignore that, the files will be in build-area.

Otherwise, you'll need your own GPG key and use bzr bd -- -k,

Or you can do
bzr bd -- -us -uc
To not sign the files at all.