Universal Serial Bus (USB) is a commonly used interface for transferring data between devices. To achieve that communication, USB connected devices use file system protocols. Embedded devices connected through USB have two different ways of revealing the stored contents of their media: USB Mass Storage (UMS), and the Media Transfer Protocol (MTP). Both of these protocols allow files to be copied to and from host computers, dragged and dropped through GUI interfaces, and enable control of the media. Put simply, the protocol is what allows devices to communicate by way of USB. What are the benefits and disadvantages of these two protocols?
A tale of two protocols
Before I go any further, a little bit of background. Back in 2013, I spoke about comparing two protocols for USB devices. Examples of these designs, sporting operating systems and storage, ran the gamut from MP3 players, to smart phones, to handheld scanners and peripherals. Bluetooth was around, but uncommon for embedded designs and data transfer. As the years have rolled by, USB technology has become faster and more powerful. How do the protocols used measure up now, seven years later? Let’s first look at a technical description, and then an update for where we are today.
USB Mass Storage class, also called UMS, is a protocol that reveals the media block device to the connected host computer. In order for the host to use this storage, a common file system format is required. In other words, if a device with UMS has media formatted with exFAT, the host computer needs to have an exFAT driver to access those files. Usually the host driver has exclusive access to the media, and this is the situation on Windows where a user sees an “eject” option that should be used before removing the device. By comparison, a USB stick or key and an SD card both operate in the same fashion.
The Media Transfer Protocol, also called MTP, is another option. This is an extension of the Picture Transfer Protocol originally developed for cameras. A host computer with an MTP driver is able to communicate with the device at a higher level than the block storage, using packet commands to access and copy files. This removes the requirement that a host computer have a file system driver to match the media format. The device no longer has exclusive access, and no “eject” requirement exists for media connected with this protocol.
Seven years later – is interoperability the deciding factor?
Time has shown connectivity and interoperability to be highly salient factors for USB protocols. According to recent research, more host computers today are running Linux than seven years ago, with both Linux and Mac workstations being more common in business environments. Each of these have stable MTP drivers. Similarly, Android smart phones use ext4 as their default file system, and these connect seamlessly over MTP with a Windows 10 desktop – which has no file system driver for ext4. So if Google moves Android to another default Linux file system in the future, no changes will be required to host system MTP drivers.
Removing the “eject” requirement is another benefit of this difference. As long as the device has its own power, no loss of data can be expected when a resting device is unplugged – data cached on the device end will be written as normal. Device manufacturers are free to choose a reliable file system to match their design goals, instead of being limited to a standard to be matched on all host computers.
Final thoughts
While both MTP and UMS have their uses, the improved connectivity and file system interoperability afforded by MTP is a considerable advantage. And when it comes to preventing the corruption of valuable data in USB connected devices, that advantage becomes even more notable.
If you have any questions about USB or file systems, don’t hesitate to reach out to us. Our global team of file system experts with a specific focus on customer success.