Hi again,
I’m using a SD card on a WP8548 SDIO pins. The code i’m executing says it managed to create a file and write in it, but I don’t know where this file is!
Is there a common path for SD card on SDIO pins? How can I specify this path?
C code:
#include “legato.h”
COMPONENT_INIT
{
LE_INFO(“Hello, Vincent.”);
LE_INFO(“Test File Creation.”);
uint8_t write_buffer_tx ={0x54, 0x45, 0x53, 0x54, 0x32};
le_result_t res;
le_fs_FileRef_t fp;
size_t filesize;
res = le_fs_Open(“/test2.txt”, LE_FS_CREAT|LE_FS_RDWR|LE_FS_APPEND|LE_FS_SYNC , &fp);
if(res == LE_OK)
{
LE_INFO(“File Created Successfully.”);
}
else
{
LE_INFO(“File Creation Failed %d.”, res);
}
res = le_fs_Write(fp, write_buffer_tx, NUM_ARRAY_MEMBERS(write_buffer_tx));
if(res == LE_OK)
{
LE_INFO(“File Write Successful.”);
}
else
{
LE_INFO(“File Write Failed %d.”, res);
}
le_fs_Close(fp);
res = le_fs_GetSize(“/test2.txt”, &filesize);
if(res == LE_OK)
{
LE_INFO("File Get Size Successful. size=%d", filesize);
}
else
{
LE_INFO("File Get Size Failed %d.", res);
}
}
adef file:
sandboxed: true
version: 1.0.0
maxFileSystemBytes: 512K
start: manual
executables:
{
hellovincent = ( HelloVincentComponent )
}
processes:
{
envVars:
{
LE_LOG_LEVEL = DEBUG
}
run:
{
( hellovincent )
}
faultAction: restart
}
requires:
{
device:
{
// Request read and write access to the SD card.
[rw] /dev/mmcblk0p1 /dev/mmcblk0p1
}
dir:
{
/mnt/userrw/sdcard /
}
}
Console output
Feb 25 13:22:39 | hellovincent[3083]/hellovincent_exe T=main | _main.c main() 60 | == Starting Event Processing Loop ==
Feb 25 13:22:39 | hellovincent[3083]/HelloVincentComponent T=main | HelloVincentComponent.c _HelloVincentComponent_COMPONENT_INIT() 5 | Hello, Vincent.
Feb 25 13:22:39 | hellovincent[3083]/HelloVincentComponent T=main | HelloVincentComponent.c _HelloVincentComponent_COMPONENT_INIT() 6 | Test File Creation.
Feb 25 13:22:39 | hellovincent[3083]/HelloVincentComponent T=main | HelloVincentComponent.c _HelloVincentComponent_COMPONENT_INIT() 14 | File Created Successfully.
Feb 25 13:22:39 | hellovincent[3083]/HelloVincentComponent T=main | HelloVincentComponent.c _HelloVincentComponent_COMPONENT_INIT() 23 | File Write Successful.
Feb 25 13:22:39 | hellovincent[3083]/HelloVincentComponent T=main | HelloVincentComponent.c _HelloVincentComponent_COMPONENT_INIT() 34 | File Get Size Successful. size=5