Skip to content
Permalink
Browse files

gui: Corrected paths in Zephyr to LVGL FS mapping

Corrected path handling between zephyr and LVGL FS API

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
  • Loading branch information...
vanwinkeljan authored and MaureenHelm committed Aug 1, 2019
1 parent 1e23f79 commit 55c3585f185dc0b6b0526bcd4e51268aef5507fc
Showing with 27 additions and 0 deletions.
  1. +27 −0 lib/gui/lvgl/lvgl_fs.c
@@ -53,6 +53,11 @@ static lv_fs_res_t lvgl_fs_open(struct _lv_fs_drv_t *drv, void *file,
{
int err;

/* LVGL is passing absolute paths without the root slash add it back
* by decrementing the path pointer.
*/
path--;

err = fs_open((struct fs_file_t *)file, path);
return errno_to_lv_fs_res(err);
}
@@ -69,6 +74,11 @@ static lv_fs_res_t lvgl_fs_remove(struct _lv_fs_drv_t *drv, const char *path)
{
int err;

/* LVGL is passing absolute paths without the root slash add it back
* by decrementing the path pointer.
*/
path--;

err = fs_unlink(path);
return errno_to_lv_fs_res(err);
}
@@ -171,6 +181,12 @@ static lv_fs_res_t lvgl_fs_rename(struct _lv_fs_drv_t *drv, const char *from,
{
int err;

/* LVGL is passing absolute paths without the root slash add it back
* by decrementing the path pointer.
*/
from--;
to--;

err = fs_rename(from, to);
return errno_to_lv_fs_res(err);
}
@@ -189,6 +205,11 @@ static lv_fs_res_t lvgl_fs_dir_open(struct _lv_fs_drv_t *drv, void *dir,
{
int err;

/* LVGL is passing absolute paths without the root slash add it back
* by decrementing the path pointer.
*/
path--;

err = fs_opendir((struct fs_dir_t *)dir, path);
return errno_to_lv_fs_res(err);
}
@@ -217,6 +238,12 @@ void lvgl_fs_init(void)

fs_drv.file_size = sizeof(struct fs_file_t);
fs_drv.rddir_size = sizeof(struct fs_dir_t);
/* LVGL uses letter based mount points, just pass the root slash as a
* letter. Note that LVGL will remove the drive letter, or in this case
* the root slash, from the path passed via the FS callbacks.
* Zephyr FS API assumes this slash is present so we will need to add
* it back.
*/
fs_drv.letter = '/';
fs_drv.ready_cb = lvgl_fs_ready;

0 comments on commit 55c3585

Please sign in to comment.
You can’t perform that action at this time.