[Galaxy Tab 2 7" Android Development] Setialpha:
So, I'm currently investigating UMS on Galaxy Tab 2 and I got it somewhat working (for extSdCard).

If you feel brave enough, here's how I did it (ONLY tested on GNU/Linux!):

Q: What prerequisites do I need?

A: You need:

human brain

CWM

root access (aka 'su')

some knowledge about Linux in general won't hurt

After you sucessfully booted into your newly rooted, init.d ready P3110, do this:

adb root
adb shell
su
mount -o rw,remount /
mount -o rw,remount /system
chmod 0777 /¹

¹ = only if you're on stock rom. on cyanogen this is not needed.

locally, create a file called 'ums', with the following content:

STOCK ROM

#!/system/bin/busybox sh

if [ "$1" = "enable" ]; then

/system/bin/setprop sys.usb.config mass_storage,adb
/system/bin/setprop persist.sys.usb.config mass_storage,adb
/system/bin/setprop sys.usb.state mass_storage,adb

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:25" > /sys/devices/virtual/android_usb/android0/f_mass_storage/lun1/file
echo 1 > /sys/devices/virtual/android_usb/android0/enable

fi

if [ "$1" = "disable" ]; then

/system/bin/setprop sys.usb.config mtp,adb
/system/bin/setprop persist.sys.usb.config mtp,adb
/system/bin/setprop sys.usb.state mtp,adb

echo "" > /sys/devices/virtual/android_usb/android0/f_mass_storage/lun1/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

fi

adb push ums /ums
adb shell
su
busybox mv /ums /system/bin/ums
chmod 0777 /system/bin/ums

CYANOGEN MOD 10

May work with CM9 aswell, but I didn't test it.

#!/system/xbin/busybox sh

if [ "$1" = "enable" ]; then

/system/bin/setprop sys.usb.config mass_storage,adb
/system/bin/setprop persist.sys.usb.config mass_storage,adb
/system/bin/setprop sys.usb.state mass_storage,adb

umount /storage/sdcard1

echo 0 > /sys/devices/virtual/android_usb/android0/enable
echo "mass_storage,adb" > /sys/class/android_usb/android0/functions
echo "/dev/block/vold/179:25" > /sys/devices/virtual/android_usb/android0/f_mass_storage/lun/file
echo 1 > /sys/devices/virtual/android_usb/android0/enable

fi

if [ "$1" = "disable" ]; then

/system/bin/setprop sys.usb.config mtp,adb
/system/bin/setprop persist.sys.usb.config mtp,adb
/system/bin/setprop sys.usb.state mtp,adb

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

vold

fi

adb push ums /system/bin/ums
adb shell
su
chmod 0777 /system/bin/ums

STEP B

Install some terminal emulator from Market. Open that app and issue

su (when SuperUser asks, give it permission).

next, to enable UMS:

ums enable

to disable UMS

ums disable

NOTE: there are two different options: calling 'ums enable' prior to connecting with USB or while connected. Different ROMs behave differently, try what works best for you.

If everyhing is fine (and you're running Linux), dmesg should show something like:

[ 1680.264023] usb 1-6: new high-speed USB device number 29 using ehci_hcd
[ 1680.356086] hub 1-0:1.0: unable to enumerate USB device on port 6
[ 1680.636060] usb 1-6: new high-speed USB device number 30 using ehci_hcd
[ 1680.769829] usb 1-6: New USB device found, idVendor=04e8, idProduct=685e
[ 1680.769832] usb 1-6: New USB device strings: Mfr=2, Product=3, SerialNumber=4
[ 1680.769835] usb 1-6: Product: GT-P3110
[ 1680.769837] usb 1-6: Manufacturer: samsung
[ 1680.769838] usb 1-6: SerialNumber: c1607c00051963f
[ 1680.771433] scsi26 : usb-storage 1-6:1.0
[ 1681.769047] scsi 26:0:0:0: Direct-Access SAMSUNG File-Stor Gadget 0001 PQ: 0 ANSI: 2
[ 1681.770784] scsi 26:0:0:1: Direct-Access SAMSUNG File-Stor Gadget 0001 PQ: 0 ANSI: 2
[ 1681.779155] sd 26:0:0:0: [sdc] 8052736 512-byte logical blocks: (4.12 GB/3.83 GiB)
[ 1681.782898] sd 26:0:0:0: [sdc] Write Protect is off
[ 1681.782901] sd 26:0:0:0: [sdc] Mode Sense: 0f 00 00 00
[ 1681.787146] sd 26:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 1681.794399] sd 26:0:0:1: [sdd] Attached SCSI removable disk
[ 1681.804415] sdc:
[ 1681.809590] sd 26:0:0:0: [sdc] Attached SCSI removable disk

And now you can access extSdCard as ordinary UMS.

TODO:

some button/widget to easily en/disable UMS

make it work with internal storage, too

Suggestions welcome :]

Credits:

Commands for ums derived from: http://xdaforums.com/showthread.php?t=1785243