Unable to make new directories within Legato app

Hi,

My application reads/writes data on an SD card with multiple subdirectories.

This works if I (pre)make the directories manually, I.E. outside of a Legato application from the command line, but not when using le_dir_MakePath, le_dir_Make or even mkdir.

Note that the application is currently running un-sandboxed. The SD card has been mounted at /mnt/userrw/sd - the /sd dir was also premade, manually.

Ultimately, the system (modem) should be capable of mounting and setting up the directory structure from within a Legato application.

Legato version is 16.10.1

Any help would be greatly appreciated.

Cheers,
Raf

Hello Raf,

I can help you if you wish because in my product I have an “SD card monitoring service” and applications that read and write data on SD with Legato.

Can you show me your adef file ?

Best regards,
Sylvain

Hi Sylvain,

Thanks for the assistance.

I think I’ve sorted it out by adding the following to my .adef file:

requires:
{
    dir:
    {
        // The SD card is mounted at '/mnt/userrw'
        /mnt/userrw     /
    }
}

Note that this particular app doesn’t do the mounting - only reading and writing. In another app’s .adef I have:

requires:
{
    device:
    {
        // Request read and write access to the SD card.
        [rw]    /dev/mmcblk0p1   /dev/mmcblk0p1
    }
    ...
}

Did you have issues running your app(s) sandboxed?
I get the following error when running the app as sandboxed.
LE_FILENAME dir_MakeSmack() 42 | Could not create directory '/mnt/userrw'. Permission denied

Also, do you mind sharing where you mounted your SD card? Is there perhaps a ‘better’ directory?

Cheers,
Raf