lvgl / lv_port_linux

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

Add support for keyboard/mouse #16

Open septatrix opened 3 years ago

septatrix commented 3 years ago

Is it possible to use the keyboard/mouse when running this demo? Currently this does not seem to be the case.

Adding rudimentary keyboard support might not be too hard as one can just read from stdin (or use termios to not wait for Enter). Mouse support might be harder but should also be possible using /dev/input/mouse or similar.

kisvegabor commented 3 years ago

Hi,

We have drivers for libinput and evdev. See here.

septatrix commented 3 years ago

Would you accept a PR for adding them to this example or is that out of scope for this repo?

kisvegabor commented 3 years ago

Would you accept a PR for adding them to this example

Sure!

The libinput driver got support for handling touch, mouse and keyboard too via

libinput_find_devs();
libinput_init_state();
libinput_read_state();

These updates were added by @Johennes, so there are any questions probably he can help. :slightly_smiling_face:

sukesh-ak commented 2 years ago

@kisvegabor
Any reason why this sample repo is not updated with latest drivers which supports SDL including touch?

I have a RPI 3B with Waveshare 2.8" 480x640 TFT with capacitive touch. Demo shows up on the display but now trying to get touch working.

What all changes are required to make it work?

By just switching drivers to master and copying drv_conf to local gives this error. Trying to avoid spending time troubleshooting for now.

/usr/bin/ld: ./main.o: in function `main':
main.c:(.text.startup+0x10): undefined reference to `fbdev_init'
/usr/bin/ld: main.c:(.text.startup+0x40): undefined reference to `fbdev_flush'
/usr/bin/ld: main.c:(.text.startup+0x50): undefined reference to `fbdev_flush'
collect2: error: ld returned 1 exit status
make: *** [Makefile:38: default] Error 1
kisvegabor commented 2 years ago

Just updated, see https://github.com/lvgl/lv_port_linux_frame_buffer/issues/20#issuecomment-1079006480

Basically, it's just the lack of manpower that we can't keep all the ports up to date. :slightly_frowning_face:

sukesh-ak commented 2 years ago

@kisvegabor I am trying to create samples with documentation which just works. Already did with WT32-SC01 + Arduino & ESP-IDF versions.

After I shared LVGL+WT32-SC01 on FB groups, several people bought WT32-SC01 as well. Trying to do what I can to support LVGL 😊

kisvegabor commented 2 years ago

Sounds great, thank you! :slightly_smiling_face:

stale[bot] commented 2 years ago

This issue or pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

septatrix commented 2 years ago

Still a relevant feature proposal

kisvegabor commented 2 years ago

Have you tried the libinput drivers mentioned here?

stale[bot] commented 1 year ago

This issue or pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

michaesc commented 4 days ago

I assume that setting the libinput definitions in lv_port_linux/lvconf.h are enough. Please note that there is no #define LIBINPUTNAME nor _#define EVDEVNAME in this file.

When I did this (#define LV_USE_LIBINPUT 1) it did not solve the lack of mouse input. In my case I'm only modifying:

lv_conf.h

-#define LV_USE_SDL              0
+#define LV_USE_SDL              1

-#define LV_USE_LINUX_FBDEV      1
+#define LV_USE_LINUX_FBDEV      0

-#define LV_USE_LIBINPUT    0
+#define LV_USE_LIBINPUT    1

main.c

-/*Create a Demo*/
-lv_demo_widgets();
-lv_demo_widgets_start_slideshow();

+lv_example_get_started_4(); // Slider that should receive mouse pointer and mouse left button input

...and the bug described by this report of lack of mouse input is still not solved.

michaesc commented 4 days ago

Have you tried the libinput drivers mentioned here?

I assume that you mean:

    lv_libinput_find_devs();
    lv_libinput_init_state();
    lv_libinput_read_state();

...and that there are missing arguments to the functions that we should find on our own.

It would be great to have an example source file where these functions are coded and working properly.