Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

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).

share|improve this question

3 Answers 3

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

share|improve this answer
    
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. Oct 23 '12 at 16:43

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.

share|improve this answer
1  
"Above" has no context, since answers can be sorted in different ways. To which answer are you referring? –  Al E. Apr 9 '13 at 17:54

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).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.