Page 1 of 1

How to use g_mass_storage/usb_f_mass_storage on luckfox pico?

Posted: 2024-08-11 3:35
by harsha-0110
I want to make luckfox pico to emulate usb mass storage, I have added g_mass_storage and usb_f_mass_storage in the ubuntu kernel configuration but unable load them using modbrobe.

Re: How to use g_mass_storage/usb_f_mass_storage on luckfox pico?

Posted: 2024-08-12 3:55
by Crocodile
Hello, I haven't tested simulating a UMS device on the Luckfox Pico under Ubuntu, but I have successfully implemented it under Buildroot. After configuring g_mass_storage and usb_f_mass_storage in the kernel (make sure they are not compiled as modules), modify /etc/init.d/S0usbdevice to set UMS_EN=on, and then restart the system

Re: How to use g_mass_storage/usb_f_mass_storage on luckfox pico?

Posted: 2024-08-12 6:50
by harsha-0110
Thanks for the reply and can you provide an example on to emulate UMS on luckfox pico pro?

Re: How to use g_mass_storage/usb_f_mass_storage on luckfox pico?

Posted: 2024-08-12 9:58
by Crocodile
I have only performed some basic tests, using the Buildroot system on the Luckfox Pico Ultra platform (using SPI flash might cause file system compatibility issues). The kernel is already configured by default, and I mainly modified /etc/init.d/S50usbdevice. The configuration is as follows, with other configurations using the defaults:

Code: Select all

UMS_EN=on
UMS_BLOCK_SIZE=10
UMS_BLOCK_TYPE=ext4 # You can also use fat, provided that mkfs.fat is added in Buildroot
After restarting the Windows computer, the Luckfox USB device will be recognized as a USB drive. At this point, you still need to mount /userdata/ums_shared.img to the root file system in order to see the contents of UMS on the Luckfox Pico. The UMS_BLOCK_AUTO_MOUNT in S50usbdevice does not work successfully.

Code: Select all

losetup /dev/loop1 /userdata/ums_shared.img
mount /dev/loop1 /mnt/ums
The current problem is that changes to the files on the USB drive are not updated in real-time. After making changes, you need to remount the drive to sync the changes.

Re: How to use g_mass_storage/usb_f_mass_storage on luckfox pico?

Posted: 2024-08-12 11:40
by harsha-0110
Thanks for the reply, its working. It would have been nice if the mounting was real-time. For the project im working on it needs to be in real time.

Re: How to use g_mass_storage/usb_f_mass_storage on luckfox pico?

Posted: 2024-09-21 10:13
by zhenglx7388
Crocodile wrote: 2024-08-12 9:58 I have only performed some basic tests, using the Buildroot system on the Luckfox Pico Ultra platform (using SPI flash might cause file system compatibility issues). The kernel is already configured by default, and I mainly modified /etc/init.d/S50usbdevice. The configuration is as follows, with other configurations using the defaults:

Code: Select all

UMS_EN=on
UMS_BLOCK_SIZE=10
UMS_BLOCK_TYPE=ext4 # You can also use fat, provided that mkfs.fat is added in Buildroot
After restarting the Windows computer, the Luckfox USB device will be recognized as a USB drive. At this point, you still need to mount /userdata/ums_shared.img to the root file system in order to see the contents of UMS on the Luckfox Pico. The UMS_BLOCK_AUTO_MOUNT in S50usbdevice does not work successfully.

Code: Select all

losetup /dev/loop1 /userdata/ums_shared.img
mount /dev/loop1 /mnt/ums
The current problem is that changes to the files on the USB drive are not updated in real-time. After making changes, you need to remount the drive to sync the changes.
After modifying a file in /mnt/ums, the Windows side cannot synchronize the update.How can I fix it?