lvgl / lv_port_linux

LVGL configured to work with a standard Linux framebuffer
MIT License
260 stars 160 forks source link

lv_image_set_src failed on master #59

Closed dengxinfa closed 2 months ago

dengxinfa commented 2 months ago

it work on the commit e06fb5b196497fd931447cbe8eacfbe07b136d1d

it failed on the commit 7c89de28937a626de6c1e7bfdf359a1d129202ef

lv_obj_t *label1 = lv_image_create(tile1);
lv_image_set_src(label1, "/1.png");
lv_obj_center(label1);

lv_conf.h

/*FFmpeg library for image decoding and playing videos
 *Supports all major image formats so do not enable other image decoder with it*/
#define LV_USE_FFMPEG 1
#if LV_USE_FFMPEG
    /*Dump input information to stderr*/
    #define LV_FFMPEG_DUMP_FORMAT 0
#endif

/*Setting a default driver letter allows skipping the driver prefix in filepaths*/
#define LV_FS_DEFAULT_DRIVE_LETTER '\0'

/*API for fopen, fread, etc*/
#define LV_USE_FS_STDIO 1
#if LV_USE_FS_STDIO
    #define LV_FS_STDIO_LETTER 'A'     /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
    #define LV_FS_STDIO_PATH ""         /*Set the working directory. File/directory paths will be appended to it.*/
    #define LV_FS_STDIO_CACHE_SIZE 0    /*>0 to cache this number of bytes in lv_fs_read()*/
#endif

log:

[Warn]  (0.000, +0)      lv_init: Memory integrity checks are enabled[14852.938988] test1 0
 via LV_USE_ASSERT_MEM_INTEGRITY which makes LVGL much slower lv_init.c:255
[Warn]  (0.000, +0)      lv_init: Object sanity checks are enabled via LV_USE_ASSERT_OBJ which makes LVGL much slower lv_init.c:259
[Warn]  (0.000, +0)      lv_init: Style sanity checks are enabled that uses more RAM lv_init.c:263
[Warn]  (14852.899, +14852899)   lv_fs_open: Can't open file (1.png): unknown driver letter lv_fs.c:88
[Error] (14852.899, +0)  image_decoder_get_info: File open failed: 3 lv_image_decoder.c:332
[Warn]  (14852.899, +0)  lv_image_set_src: failed to get image info: 1.png lv_image.c:189
[Warn]  (14852.899, +0)  lv_fs_open: Can't open file (2.png): unknown driver letter lv_fs.c:88
[Error] (14852.899, +0)  image_decoder_get_info: File open failed: 3 lv_image_decoder.c:332
[Warn]  (14852.900, +1)  lv_image_set_src: failed to get image info: 2.png lv_image.c:189
dengxinfa commented 2 months ago

Just fix LV_FS_STDIO_LETTER to '/', it works

/*API for fopen, fread, etc*/
#define LV_USE_FS_STDIO 1
#if LV_USE_FS_STDIO
    #define LV_FS_STDIO_LETTER '/'     /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
    #define LV_FS_STDIO_PATH ""         /*Set the working directory. File/directory paths will be appended to it.*/
    #define LV_FS_STDIO_CACHE_SIZE 0    /*>0 to cache this number of bytes in lv_fs_read()*/
#endif
kisvegabor commented 2 months ago

I think what you need is LV_FS_DEFAULT_DRIVE_LETTER.