4

I've got an HTC Incredible that I sync to my Linux box. I'd like the Linux box to automatically detect that the phone is attached (I can do that via adb wait-for-device), and then automatically put the device in "disk drive mode" (I've no idea how to do this part), and then mount the phone as storage, and run my sync script (I've got this covered), and then unmount the phone and return it to "charge only" mode.

I can manually put the device in "disk drive mode" by pulling down the shade and changing the "USB connection type", but I'm not sure how to trigger this remotely from the PC. Ideally, some adb command would be great, but I'm open to installing an app, or other hacks (the Linux box can usually reach the phone via WiFi ...)

"Disk drive mode" is also known as "USB Mass Storage" (UMS) mode.

In newer (ICS and later), UMS support is being deprecated for MTP (slightly different USB-based transfer protocol).

1

3 Answers 3

1

This app is designed to mount your phone as soon as it is plugged in. It seems to do your missing step.

Alternatively, this command (found from this forum) can be run on the phone (ex. adb shell) to turn on disk mode.

echo /dev/block/mmcblk0 > /sys/devices/platform/usb_mass_storage/lun0/file
Edit: This only appears to work in recovery.

App - Auto Mount Your SD Card
Auto Mount App

1
  • Good to know this is possible, but having the phone go into "disk drive mode" every time the phone is plugged in won't work for me (and there is no way to revert back "charge only").
    – P.T.
    Commented Oct 23, 2012 at 16:43
1

Look, I got tired of searching how to mount the drive automaticaly in UMS mode, and the solution above is right.

echo /dev/block/mmcblk0 > /sys/devices/lm-2/gadget/lun0/file

Search for the correct file /sys/device in your system. This way I can use Tasker to auto-mount my device whe a USB connection is detected.

1
  • 2
    "Above" has no context, since answers can be sorted in different ways. To which answer are you referring?
    – ale
    Commented Apr 9, 2013 at 17:54
0

According to this Android Forum post the sdutil app on the phone can be used enable "USB Mass Storage" mode on the device. This can be run through adb as:

adb shell sdutil ums enable

However, it seems like this only works on older version of Android (circa 2010?), on my device (which is not rooted), sdutil is not available (or is hidden somewhere I cannot see like /sbin or /system/sbin).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .