[Galaxy S III Q&A, Help & Troubleshooting] WhiskeyCobra:
d4fseeker, first of all, I'd like to thank you for your awesome work! Your code is pretty much what everyone else use for their UMS apps and scripts.

Now, I realize that it's been 3 years since you posted this and in this time most folks have come to terms with the fact that UMS is not possible but I just retired a Gingerbread device that I kept going because of a specific need. Now I am on a one-man-crusade to get UMS working on a Note 3. See here: http://xdaforums.com/galaxy-note-3/general/note-3-usb-mass-storage-t3020854

At this point I'm halfway there though I could use some help.

setprop persist.sys.usb.config mass_storage,adb
# umount /mnt/extSdCard
echo /dev/block/vold/179:33 > /sys/devices/virtual/android_usb/android0/f_mass_storage/lun0/file

This works. I have no lun_ex folder though. And I commented out umount because it failed every time claiming the device is busy. Dunno why. Obviously this isn't perfect since the card is then mounted both on the phone and the PC.

echo "" > /sys/devices/virtual/android_usb/android0/f_mass_storage/lun0/file
vold
setprop persist.sys.usb.config mtp,adb

This works too.

mount | grep /mnt/extSdCard | cut -f 1 -d " " > /sys/devices/virtual/android_usb/android0/f_mass_storage/lun0/file

I haven't been able to make this line work.

At this point, I'd expect it to be obvious that my scripting and android system knowledge is the equivalent of trying to communicate with foreigner who doesn't speak the language thorugh hand signals.

But what I understand thus far is that I can designate the SD card as a mass storage device by first telling android with setprop that it is a mass storage device and then assigning the card itself to it through port, adress or whatever those numbers are.

The unmounting and re mounting part is where I failed miserably.

Sooo I went shopping some more and found myself this guy:

His scripts are based on yours though he's passing all the arguments into files with echo. Dunno if this is better or worse than using setprop and umount commands but the fact is I've gotten a little further this way.

echo 0 > /sys/devices/virtual/android_usb/android0/enable
umount /mnt/extSdCard/
echo "mass_storage,adb" > /sys/class/android_usb/android0/functions
echo "/dev/block/vold/179:33" > /sys/devices/virtual/android_usb/android0/f_mass_storage/lun0/file
echo 1 > /sys/devices/virtual/android_usb/android0/enable

This works. It even unmounts the card from the phone no problem.

echo "" > /sys/devices/virtual/android_usb/android0/f_mass_storage/lun0/file
echo 0 > /sys/devices/virtual/android_usb/android0/enable
echo "mtp,adb" > /sys/class/android_usb/android0/functions
echo 1 > /sys/devices/virtual/android_usb/android0/enable
vold

Disappointingly, this doesn't work. Note: I removed acm, from the third line since it crashed my phone and rebooted. No idea why or what acm does.

Now, the script finishes successfuly but two things happen. Or don't happen depending on the point of view. =D

The card mounting cycles because "the sd card can now be removed" and "sd card can now be used" or whatever appears on the notification bar quickly and disappears. Barely readable. But then, the SD card is still not mounted back on the system and the phone is not picked up as a MTP device by the PC again so it's safe to conclude that that didn't work either.

Soooo, the reason I'm coming to you is you're the only one who seems to understand what each command does (not just trial and error like me) and who's still online. Bazald was last seen in October and Kopfgeldjaeger in May.

Thanks in advance.