Enabling usb mass storage gadget in kernel 3.1

1,074 views
Skip to first unread message

Vishveshwar Bhat

unread,
Dec 7, 2011, 2:12:30 AM12/7/11
to android...@googlegroups.com
Hi All,

I enable Android mass storage gadget by doing the following settings


# echo 0 > /sys/class/android_usb/android0/enable
# echo adb,mass_storage > /sys/class/android_usb/android0/functions
# echo 1 > /sys/class/android_usb/android0/enable


After I attach the adb cable I expect /mnt/sdcard to auto mount on my
host pc.
But that is not happening and there is no notice on Android UI too. I
checked the dmesg on host and I see this..

[530775.376052] usb 1-6: new high speed USB device using ehci_hcd and
address 74
[530775.509063] usb 1-6: configuration #1 chosen from 1 choice
[530775.537197] scsi9 : SCSI emulation for USB Mass Storage devices
[530775.551438] usb-storage: device found at 74
[530775.551443] usb-storage: waiting for device to settle before
scanning
[530780.548338] usb-storage: device scan complete
[530780.548922] scsi 9:0:0:0: Direct-Access Linux File-CD Gadget
0000 PQ: 0 ANSI: 2
[530780.560560] sd 9:0:0:0: Attached scsi generic sg4 type 0
[530780.572419] sd 9:0:0:0: [sdd] Attached SCSI removable disk

What is going on here? Am I missing some settings in kernel?

BTW, adb is working correctly.

-Vishveshwar

Nicu Pavel

unread,
Dec 9, 2011, 4:48:52 AM12/9/11
to vishves...@aim.com, android...@googlegroups.com
Hi,

On Wed, Dec 7, 2011 at 9:12 AM, Vishveshwar Bhat
<vishves...@aim.com> wrote:
[..]


> [530780.560560] sd 9:0:0:0: Attached scsi generic sg4 type 0
> [530780.572419] sd 9:0:0:0: [sdd] Attached SCSI removable disk
>
> What is going on here? Am I missing some settings in kernel?
>
> BTW, adb is working correctly.

I'm not seeing any partition detected, not sure if this all the dmesg
log or they aren't. If no partitions are showing on fdisk -l /dev/sdd
then
f_mass_storage is not correctly configured.

Nicu

Vishveshwar Bhat

unread,
Dec 9, 2011, 6:23:35 AM12/9/11
to npa...@ituner.com, android...@googlegroups.com
Looking at system/vold/VolumeManager.cpp... I think this needs to be
updated to use the newer sysfs paths from kernel 3.1. The paths used in
my sources (GB-2.3.4) do not exist in kernel 3.1.

I will try this out and let you know.

Thanks,
Vishveshwar


-----Original Message-----
From: Nicu Pavel <npa...@ituner.com>
To: vishveshwarbhat <vishves...@aim.com>
Cc: android-porting <android...@googlegroups.com>
Sent: Fri, Dec 9, 2011 10:18 am
Subject: Re: [android-porting] Enabling usb mass storage gadget in
kernel 3.1


Hi,On Wed, Dec 7, 2011 at 9:12 AM, Vishveshwar

Bhat<vishves...@aim.com> wrote:[..]> [530780.560560] sd 9:0:0:0:
Attached scsi generic sg4 type 0> [530780.572419] sd 9:0:0:0: [sdd]
Attached SCSI removable disk>> What is going on here? Am I missing some

settings in kernel?>> BTW, adb is working correctly.I'm not seeing any
partition detected, not sure if this all the dmesglog or they aren't.

Pankaj Dubey

unread,
Dec 9, 2011, 10:49:44 AM12/9/11
to android...@googlegroups.com, npa...@ituner.com
which platform you are using GB or ICS?

pankaj

Vishveshwar

unread,
Dec 12, 2011, 1:04:21 AM12/12/11
to android-porting
I am using GB2.3.4 sources. But the hardware which I am working on has
only kernel 3.1 sources available.

Moving to ICS is not feasible currently.

The android gadget framework changed in kernel-3.0. I'm guessing, I
have to backport the ICS vold changes to get it to work with GB.

-Vishveshwar

Pankaj Dubey

unread,
Dec 12, 2011, 4:06:19 AM12/12/11
to android...@googlegroups.com
Correct.. either you modify vold which will be a little difficult I guess...
or use older Android gadget (previous to 3.0 based kernel) files with GB...

Pankaj

Reply all
Reply to author
Forward
0 new messages