This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Export SD card to PC through USB

Dear TI,

When I connect USB cable to PC and AM335x, I can use adb function without problem. And vold also mounts sd card correctly.

But now, how can I export sd card to PC as a USB disk ?

I tried to 'echo "/dev/block/mmcblk0p3" > /sys/class/android_usb/android0/f_mass_storage/lun/file'  on serial console and instantly I can see a USB disk appears on PC, but this is not Android's way.

So how can I get the "USB connected" notification when USB cable connected and use Android's USB storage UI to mount to PC side?

My Android SDK is v2.1.1, release in 2011/12/12

Thanks and Regards

Max

  • AM335x kernel uses the newer android patches from android-kernel-3.0 (meant for use with ICS) hence the android composite gadget driver is not working correctly with GingerBread release.

  • OK, I'm afraid you would say that.  :-)

    Anyway, I managed to port part of rowboat ICS vold to GB, and now Android can receive "USB connected" notification.

    But now, when I drag down the status list, and touch "USB connected" message, it doesn't switch to USB mount UI/activity screen. 

    So, is it a feature switch I should enable in BoardConfig.mk or anywhere I should try to fix ?

    Thanks and Regards

    Max

  • Something weird that, I trace into SystemUI package, the notification does send intent out to UsbStorageActivity. The onCreate() and onResume() interfaces are all invoked successfully. But the screen just flashes once and nothing happens

    Hope that you may have some clue about this.

    Thanks and Regards

    Max

  • OK, I got some progress, in case some people might have same issue as I do.

    I modified SystemUI's UsbStorageActivity.java's handleUsbStateChanged() interface, to discard the if (! connected) block of codes:

    private void handleUsbStateChanged(Intent intent) {
            boolean connected = intent.getExtras().getBoolean(UsbManager.USB_CONNECTED);
            /*
            if (!connected) {
                // It was disconnected from the plug, so finish
    finish();

            }*/
        }

    just for testing, and it can display "USB Mass Storage" screen now and let me "Turn On USB storage" and PC can mount sdcard from AM335x through USB cable. 

    Though I'm not sure why intent.getExtras().getBoolean(UsbManager.USB_CONNECTED); returns false, but other parts of system seems working fine, once you get vold working properly:

    1. handle hotplug events from android_usb and response to USB_STATE (CONFIGURED and DISCONNECTED)

    2. shareVolume by setting /dev/block/vold/%d:%d  to /sys/class/android_usb/f_mass_storage/lun/file

    Regards

    Max

  • Max,

    Thanks for the update and posting your results.