Making WP7607 appear as mass storage device

Hi,

For a usecase I want my WP7607 to appear as a mass storage device when I plug it into a host PC (or any device that supports USB mass storage). I found an article that does this on a RPI: MAKE A PI ZERO W SMART USB FLASH DRIVE

I understand that I need to do modprobe g_mass_storage. But modules.dep is empty so that command returns an error. I checked Legato KConfig options but this doesn’t mention the option to customize any USB options.

Is it possible to add mass storage support to Legato? If yes, how?

seems no such option in AT!USBCOMP=?

at!usbcomp=?
!USBCOMP:
AT!USBCOMP=,,
- configuration index to which the composition applies, should be 1

- 1:Generic

- DIAG - 0x00000001,
NMEA - 0x00000004,
MODEM - 0x00000008,
RAWDAT - 0x00000040,
RMNET0 - 0x00000100,
RMNET1 - 0x00000400,
RMNET2 - 0x00000800,
AUDIO - 0x00010000,
ECM - 0x00080000,
NCM - 0x00400000,
e.g.
9 - diag,modem interfaces enabled
10D - diag,nmea,modem,rmnet0 interfaces enabled

OK

I know. But you can add it through KConfig, like this post: https://forum.mangoh.io/t/build-linux-for-wp76/1084/3

I was hoping the same could be achieved for mass storage. Maybe @dfrey knows?

@langestefan,

So this is possible as per the below (not generated by me).

Create an empty 32MB FAT image (in /tmp/fat.fs) using mkdosfs command:

dd if=/dev/zero of=/tmp/fat.fs bs=1024 count=32768
mkdosfs /tmp/fat.fs

Then mount this image in “/tmp/mass_storage” in order to add some files.

mount -o loop /tmp/fat.fs /tmp/mass_storage
echo "Hello World!" > /tmp/mass_storage/README.TXT

After that add/configure “mass_storage” in the USB functions:

echo 0 > /sys/class/android_usb/android0/enable
echo diag,serial,rmnet,ecm, **mass_storage** > /sys/class/android_usb/android0/functions
echo /tmp/fat.fs > /sys/class/android_usb/android0/f_mass_storage/lun/file
echo 1 > /sys/class/android_usb/android0/enable

After that, a new USB flash drive is visible on the host side (a PC in this case) with the expected content.

Regards

Matt

1 Like

it works!
BTW, you can use the busybox here for mkdosfs command on WP76
busybox-armv5l_1.26 (1.1 MB)

root@swi-mdm9x28-wp:~# chmod 777 busybox-armv5l_1.26
root@swi-mdm9x28-wp:~# ./busybox-armv5l_1.26 mkdosfs /tmp/fat.fs