Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

TI Android DevKit MTP

From Texas Instruments Wiki
Jump to: navigation, search

About MTP

  • MTP - Media Transfer Protocol (originally described by Microsoft), is designed to transfer of music files on digital audio players and media files on portable media players, as well as personal information on personal digital assistants. MTP also supports a Digital Rights Management (DRM) service for the Windows Media platform.
  • Why MTP over USB Mass Storage device Class (MSC) ?
    • USB mass-storage device class (MSC) operates at the granularity of a mass storage device block rather than at the logical file level. In practice, therefore, when a USB host computer has mounted an MSC partition, it assumes absolute control of the storage, which then may not be safely modified by the device until the host computer has severed the connection. Furthermore, because the host computer has full control over the connected storage device, there is a risk that the host computer may corrupt the file system, reformat it to a file system not supported by the USB device, or otherwise modify it in such a way that the USB device cannot completely understand it.
    • While device is connected as USB mass storage, only host computer can access/modify contents on mounted data. Device will not have any control to access the data.
    • MTP specifically overcome this issue by making the unit of managed storage a local file rather than an entire (possibly very large) unit of mass storage at the block level. In this way, MTP works like a transactional file system - either the entire file is written/read or nothing. The storage media is not affected by failed transfers.
  • Support
    • As opposed to USB Mass Storage, a number of operating systems do not support MTP out of the box. Some even require third-party software. Windows and MAC OS has inbuilt supports MTP while Ubuntu and other Linux distributions requires addition packages to be installed for the same.

Android ICS support on device mode

When a Micro-B type plug is plugged into the OTG port, it will act as a Device.

In device mode, Android ICS supports the following different types of Android gadgets:

  • MTP/PTP (Media Transfer Protocol/ Picture Transfer Protocol)
  • ADB (Android Debugger)
  • RNDIS (USB Tethering)

Note: TI Android DevKit release - "TI-Android-ICS-4.0.3-DevKit-3.0.1" only supports ADB at present. Mentioned wiki will provide detailed guideline on how to integrate MTP support to TI android DevKit release.

MTP patches for DevKit release - "TI-Android-ICS-4.0.3-DevKit-3.0.1"

Download the MTP patches

  • Download patch files from HERE
/* go to user directory */
$cd <MY_DIR>
/* extract downloader patch files */
$tar -xzvf Patch_TI_Android_DevKit_MTP.tar.gz

Apply Kernel Patch

  • Patch will resolve MTP detection issue in android kernel 3.2.
/* go to kernel directory */
$cd <android-src>/kernel

/* apply below patch to kernel */
$git am <MY_DIR>/0001-Enable-MTP-functionality-in-android-kernel-3.2.patch
  • Note : Patch is applicable to kernel 3.2 only. Also if patch does not apply automatically (in case of kernel has more patches since release),kindly integrate manually.

Apply Android Related Patch

  • Patch will add MTP related configuration for the device. Also it will create "init.am335x.usb.rc" file to write android gadget related configurations
/* go to device directory */
$cd <android-src>/device/ti/am335xevm

/* optional :checkout mentioned commit id */
/* if one has integrated after release changes, then 
* patch should be merged manually
*/
$git checkout 3877feff76be0642b1e9913d4e4f47cf9b07b3f1

/* apply below patch to device directory */
$git am <MY_DIR>/0001-Added-MTP-support-to-the-device.patch
  • Note : If patch does not apply automatically (in case of device directory has more patches since release),kindly integrate manually.

Android Build

  • After applying above patches, kindly do full build of android & linux kernel.
  • For the build procedure click here

MTP Configuration on host machine

Linux

MTP access using Rhythmbox Music Player (UBUNTU)

  • Add MTP device entry to host system
/* open file */
$vim /etc/udev/rules.d/51-android.rules 

/* add following entry. 
* One can refer this entry details in device/ti/am335xevm/init.am335x.usb.rc ( d109 is for MTP)
*/
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="d109", MODE="0666"

-- save and exit --
/* restart udev service */
$ /etc/init.d/udev restart
  • Open the application->sound & video -> Rhythmbox Music Player
  • Go to edit-> plugin and make sure that Portatble Players – MTP is installed. If not then installed it by clicking on MTP plugin
  • Boot the am335xevm and connect the device to Linux system
  • On device go to settings-> storage-> press menu key (sw1)
  • Click on USB computer connection and enable MTP device if it is not enable

Now one can see device in the player as below.
Am335x-mtp-linux.png

MTP access using console

  • Install mtp tools and mtpfs on linux machine
$sudo apt-get install mtp-tools mtpfs
  • Add MTP device entry to host system. Ignore if it is already added
/* open file */
$vim /etc/udev/rules.d/51-android.rules 

/* add following entry. 
* One can refer this entry details in device/ti/am335xevm/init.am335x.usb.rc ( d109 is for MTP)
*/
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="d109", MODE="0666"

-- save and exit --
/* restart udev service */
$ /etc/init.d/udev restart
  • Boot the am335xevm and connect the device to Linux system
  • On device go to settings-> storage-> press menu key (sw1)
  • Click on USB computer connection and enable MTP device if it is not enable
  • Detection check using mtp tools
/* detect the device on host linux system */
$mtp-detect

/* check vendor and product id */
$mtp-detec | grep idvendor
$mtp-detec | grep idproduct
  • create a dir for mounting mtpfs:
$ mkdir ~/Desktop/mtp
  • Mount the mtpfs now:
$ mtpfs ~/Desktop/mtp/
$ cd ~/Desktop/mtp/
  • Un-mount the mtp drive once done
$ cd ..
$ fusermount -u ~/Desktop/mtp/

-- ready to disconnect cable --

Windows

  • On Microsoft Windows, MTP is supported in Windows XP if Windows Media Player 10 or later versions are installed. Windows Vista, Windows 7 and later versions have in built MTP support.
  • For older versions of Windows, specifically, Windows 2000, Windows 98 and Windows Me, Microsoft has released the MTP Porting Kit,which contains a MTP device driver for these legacy Windows operating systems.
  • On device connection Windows Media Player will show device as following

Am335x-mtp-windows.png

References

http://software-dl.ti.com/dsps/dsps_public_sw/sdo_tii/TI_Android_DevKit/TI_Android_ICS_4_0_3_DevKit_3_0_1/index_FDS.html
http://en.wikipedia.org/wiki/Media_Transfer_Protocol
http://www.microsoft.com/en-us/download/details.aspx?id=19153

Technical Support and Product Updates

For further information or to report any problems, contact http://e2e.ti.com/android or http://support.ti.com.
For community support join http://groups.google.com/group/rowboat
For IRC #rowboat on irc.freenode.net
To raise any defect for this release please use http://code.google.com/p/rowboat/issues/list