Yesterday afternoon/evening Linus Walleij gave an enjoyable talk entitled "Fear and Loathing in the Media Transfer Protocol" at the Linux Foundation's Embedded Linux Conference (ELC) 2014 in San Jose. Linus is a very good speaker and appears quite comfortable in front of a crowd; his talk was highly informative and often sprinkled with humerous anecdotes.
For me the best part of the talk was the fact I had never heard of the MTP, so it was a great opportunity to learn something new.
MTP is an extension to the Picture Transfer Protocol (PTP). You know when you're connecting your USB device to a Linux host and the first thing the instructions you're following says is "make sure you put the device in 'mass storage' mode and not 'PTP'"? This talk is about that other protocol.
The gist of the MTP (and PTP) was to design a transfer protocol which would be robust enough to survive someone ripping out the USB cable connection in the middle of transfer. Additionally the MTP was designed to handle not only the media data itself (for example the video or the music) but also all the metadata associated with a particular object back in a day when mobile electronics didn't support sophisticated (hierarchical) file systems. So given a flat file layout, describe an album with tracks and provide titles, composers, performers, cover art, and other metadata associated with an object such that it can all be presented coherently to the user. The MTP also contains provisions for other operations too: such as telling a host what capabilities it has or what storage areas it contains.
From the sounds of it, implementing the MTP is the fine act of navigating a mine field while driving a large, half-working vehicle with a broken GPS. This work has been mostly plagued by a standard which came out late, to which neither device implementors nor host operating systems have adhered either before or after the specifications were drawn. As such, the code has many tricks and special cases as it tries to do the right thing in all situations. This is often the case when a device manufacturer only cares to get their product minimally working with a specific version of a specific OS. As such, Linus warned that your best bet is to try to get an old device working with older software, and a newer device working with newer software; trying to do the converse will either not work so well, or will fail altogether.
With the advent of Android, the MTP has been given a new lease on life; it isn't an old protocol anymore. There is much to do yet with MTP and help is appreciated. Linus mentioned this is entirely a hobby project for him, and would welcome new apprentices and/or co-maintainers.
No comments:
New comments are not allowed.