blob: 73c01cb5906abf4d34f95f5cf1d80ac540a63145 [file] [log] [blame]
Patrick Williams03514f12024-04-05 07:04:11 -05001From 85d90749a10b5f91741d37b75825935bf7cc4fb3 Mon Sep 17 00:00:00 2001
2From: Marek Vasut <marex@denx.de>
3Date: Tue, 12 Mar 2024 03:00:37 +0100
4Subject: [PATCH 3/6] Make fbdev device node runtime configurable via
5 environment variable
6
7Test whether $LV_VIDEO_CARD environment variable is non-NULL and in
8case it is, use it as the video card file in lv_linux_fbdev_set_file().
9Otherwise fall back to /dev/fb0, i.e. the current behavior. This way,
10it is possible to test LVGL on systems with multiple fbdev devices.
11
12Upstream-Status: Submitted [https://github.com/lvgl/lv_port_linux_frame_buffer/pull/47]
13Signed-off-by: Marek Vasut <marex@denx.de>
14---
15 main.c | 8 +++++++-
16 1 file changed, 7 insertions(+), 1 deletion(-)
17
18diff --git a/main.c b/main.c
19index 9775b9c..b64a098 100644
20--- a/main.c
21+++ b/main.c
22@@ -4,13 +4,19 @@
23 #include <pthread.h>
24 #include <time.h>
25
26+static const char *lv_linux_get_video_card_node(const char *videocard_default)
27+{
28+ return getenv("LV_VIDEO_CARD") ? : videocard_default;
29+}
30+
31 int main(void)
32 {
33+ const char *videocard = lv_linux_get_video_card_node("/dev/fb0");
34 lv_init();
35
36 /*Linux frame buffer device init*/
37 lv_display_t * disp = lv_linux_fbdev_create();
38- lv_linux_fbdev_set_file(disp, "/dev/fb0");
39+ lv_linux_fbdev_set_file(disp, videocard);
40
41 /*Create a Demo*/
42 lv_demo_widgets();
43--
442.43.0
45