Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,738,643 Members 39,718 Now Online
XDA Developers Android and Mobile Development Forum

MTP problem

Tip us?
 
sony11
Old
#1  
Junior Member - OP
Thanks Meter 0
Posts: 5
Join Date: Apr 2014
Default MTP problem

I have problems with connecting my mobile phone with other devices after introducing MTP connection - when I am pluging t989 into tv, there is a info about problems with recognizing the device, the same prompt is on other devices such like Satelite receiver, etc. Earlier when I had usb storage connection I didnt have such problems. Can sb help me with that ?
 
bmg002
Old
#2  
bmg002's Avatar
Senior Member
Thanks Meter 187
Posts: 458
Join Date: Aug 2012
Quote:
Originally Posted by sony11 View Post
I have problems with connecting my mobile phone with other devices after introducing MTP connection - when I am pluging t989 into tv, there is a info about problems with recognizing the device, the same prompt is on other devices such like Satelite receiver, etc. Earlier when I had usb storage connection I didnt have such problems. Can sb help me with that ?
This is possible to fix with some ROM/Kernel pairs, but not all.
you need to run a series of commands to prepare things for "mass storage" mode, and then run a different set of commands before removing it to prevent data corruption and data mismatch. I have found that if you add files while in this "pretend mass storage" mode, you sometimes need to reboot for them to sync up properly.
all of the commands need to be run as root.
first you need to put your phone into mass storage mode by running:
setprop sys.usb.config mass_storage

if you need adb access, run the command as:
setprop sys.usb.config mass_storage,adb

then you need to tell the system where to "look" for the mass storage devices. I will include the optional steps too (mounting the sd cards in RO mode to prevent both systems writing to the card at once which will likely cause corruption):
mount -o remount,ro /storage/sdcard0
mount -o remount,ro /storage/sdcard1
echo /dev/block/vold/179:97 > /sys/class/androd_usb/android0/f_mass_storage/lun/file
echo /dev/block/vold/179:28 > /sys/class/android_usb/android0/f_mass_storage/lun_ex/file

when you are done with your mass storage stuff, you will need to run the following to remove these shares:
echo "" > /sys/class/androd_usb/android0/f_mass_storage/lun/file
echo "" > /sys/class/android_usb/android0/f_mass_storage/lun_ex/file
mount -o remount,rw /storage/sdcard0
mount -o remount,rw /storage/sdcard1

I have not (yet) tested this on a KK ROM, but it works nicely on hellybean with Diablo or Uber kernels. Technically, I suppose you wouldn't need to run the remounts, but I recommend it as you don't want a corrupted filesystem. And technically I guess you don't need to blank out the "file" afterwards, but I do as I don't want android thinking I'm still connected when I'm not.

I personally don't like MTP as it doesn't play as nice with other older devices as mass_storage, but mass_storage doesn't allow both the android phone and windows/mac/linux/etc to preform RW operations at the same time without a high risk of data corruption.
-----------------------------------------------------------------------------------------------------------------------------
Three hams will fill him, three hams will thrill him, Why don't you feed him, three hams!
- Thundercleese (in Brak's head)
-----------------------------------------------------------------------------------------------------------------------------
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes