Skip to content

Commit

Permalink
modules: lvgl: Handle errors on fs_tell
Browse files Browse the repository at this point in the history
Changes the lvgl filesystem `tell()` wrapper to check for errors returned
by zephyr filesystem subsystem.

Signed-off-by: Fabian Blatz <[email protected]>
  • Loading branch information
faxe1008 authored and carlescufi committed Aug 22, 2023
1 parent ab6d99f commit 63bb74c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion modules/lvgl/lvgl_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ static lv_fs_res_t errno_to_lv_fs_res(int err)
case -EINVAL:
/*Invalid parameter among arguments*/
return LV_FS_RES_INV_PARAM;
case -ENOTSUP:
/*Not supported by the filesystem*/
return LV_FS_RES_NOT_IMP;
default:
return LV_FS_RES_UNKNOWN;
}
Expand Down Expand Up @@ -153,7 +156,14 @@ static lv_fs_res_t lvgl_fs_seek(struct _lv_fs_drv_t *drv, void *file, uint32_t p

static lv_fs_res_t lvgl_fs_tell(struct _lv_fs_drv_t *drv, void *file, uint32_t *pos_p)
{
*pos_p = fs_tell((struct fs_file_t *)file);
off_t pos;

pos = fs_tell((struct fs_file_t *)file);
if (pos < 0) {
return errno_to_lv_fs_res(pos);
}

*pos_p = pos;
return LV_FS_RES_OK;
}

Expand Down

0 comments on commit 63bb74c

Please sign in to comment.