gui: Add open flags argument to fs_open invocation

Now fs_open supports open flags and the lvgl_fs code requires update.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This commit is contained in:
Dominik Ermel 2020-07-16 07:58:55 +00:00 committed by Carles Cufí
parent cac07629bf
commit 47ab70e34c
2 changed files with 6 additions and 2 deletions

View file

@ -52,13 +52,17 @@ static lv_fs_res_t lvgl_fs_open(struct _lv_fs_drv_t *drv, void *file,
const char *path, lv_fs_mode_t mode)
{
int err;
int zmode = FS_O_CREATE;
/* 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);
zmode |= (mode & LV_FS_MODE_WR) ? FS_O_WRITE : 0;
zmode |= (mode & LV_FS_MODE_RD) ? FS_O_READ : 0;
err = fs_open((struct fs_file_t *)file, path, zmode);
return errno_to_lv_fs_res(err);
}

View file

@ -91,7 +91,7 @@ void setup_fs(void)
return;
}
ret = fs_open(&img, IMG_FILE_PATH);
ret = fs_open(&img, IMG_FILE_PATH, FS_O_CREATE | FS_O_WRITE);
if (ret < 0) {
TC_PRINT("Failed to open image file: %d\n", ret);
ztest_test_fail();