Patrick Williams | 03514f1 | 2024-04-05 07:04:11 -0500 | [diff] [blame] | 1 | From 85d90749a10b5f91741d37b75825935bf7cc4fb3 Mon Sep 17 00:00:00 2001 |
| 2 | From: Marek Vasut <marex@denx.de> |
| 3 | Date: Tue, 12 Mar 2024 03:00:37 +0100 |
| 4 | Subject: [PATCH 3/6] Make fbdev device node runtime configurable via |
| 5 | environment variable |
| 6 | |
| 7 | Test whether $LV_VIDEO_CARD environment variable is non-NULL and in |
| 8 | case it is, use it as the video card file in lv_linux_fbdev_set_file(). |
| 9 | Otherwise fall back to /dev/fb0, i.e. the current behavior. This way, |
| 10 | it is possible to test LVGL on systems with multiple fbdev devices. |
| 11 | |
| 12 | Upstream-Status: Submitted [https://github.com/lvgl/lv_port_linux_frame_buffer/pull/47] |
| 13 | Signed-off-by: Marek Vasut <marex@denx.de> |
| 14 | --- |
| 15 | main.c | 8 +++++++- |
| 16 | 1 file changed, 7 insertions(+), 1 deletion(-) |
| 17 | |
| 18 | diff --git a/main.c b/main.c |
| 19 | index 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 | -- |
| 44 | 2.43.0 |
| 45 | |