Skip to content

feat(drivers): Add libinput/xkb driver#5486

Merged
kisvegabor merged 1 commit intolvgl:masterfrom
Johennes:feature/libinput
Jan 29, 2024
Merged

feat(drivers): Add libinput/xkb driver#5486
kisvegabor merged 1 commit intolvgl:masterfrom
Johennes:feature/libinput

Conversation

@Johennes
Copy link
Copy Markdown
Contributor

@Johennes Johennes commented Jan 25, 2024

Description of the feature or fix

This adds the libinput / xkb driver from lv_drivers together with the buffering / multi-touch extensions from lvgl/lv_drivers#280. It's quite a lot of code, sadly. I've tried to massage the interfaces into the style used for other drivers in LVGL without having to rewrite everything from scratch.

Notes

bool "Enable full keyboard support via XKB"
depends on LV_USE_LIBINPUT
default n

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure if and how to add LV_LIBINPUT_XKB_KEY_MAP. Similar macros like LV_CALENDAR_DEFAULT_DAY_NAMES are also absent here. Is this intentional?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As Kconfig cannot support complex types, some options are just omitted.

@Johennes Johennes marked this pull request as ready for review January 25, 2024 13:51
@kcxt
Copy link
Copy Markdown

kcxt commented Jan 25, 2024

Just to note, this code has been shipping in the unl0kr project in postmarketOS for several months now, and it's known to work well on all the wonderful and weird touchscreen devices it's been tested on so far.

Copy link
Copy Markdown
Collaborator

@XuNeo XuNeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's warning about LV_LIBINPUT_XKB because it's only defined when LV_USE_LIBINPUT is enabled.

@Johennes
Copy link
Copy Markdown
Contributor Author

There's warning about LV_LIBINPUT_XKB because it's only defined when LV_USE_LIBINPUT is enabled.

Ah thanks, I missed that. Should be fixed now.

@XuNeo
Copy link
Copy Markdown
Collaborator

XuNeo commented Jan 25, 2024

Similar issue has happened before. I think the easiest solution is in lv_conf_template.h

#if LV_USE_LIBINPUT
    #define LV_LIBINPUT_BSD    0

    /*Full keyboard support*/
    #define LV_LIBINPUT_XKB             0
    #if LV_LIBINPUT_XKB
        /*"setxkbmap -query" can help find the right values for your keyboard*/
        #define LV_LIBINPUT_XKB_KEY_MAP { .rules = NULL, .model = "pc101", .layout = "us", .variant = NULL, .options = NULL }
    #endif
#else
    #define LV_LIBINPUT_XKB             0
#endif

Copy link
Copy Markdown
Member

@kisvegabor kisvegabor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing!

Could you add some documentation too?

I wonder if we can at least compile the Linux related drivers in our CI. To do this we just need to

  1. install the required libs here
  2. add the libs to the test CMakeList
  3. Enable these driver in lv_test_conf_full.h

bool "Enable full keyboard support via XKB"
depends on LV_USE_LIBINPUT
default n

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As Kconfig cannot support complex types, some options are just omitted.

@Johennes
Copy link
Copy Markdown
Contributor Author

Johennes commented Jan 26, 2024

Could you add some documentation too?

Yes, have added some.

I wonder if we can at least compile the Linux related drivers in our CI. To do this we just need to

Good idea. I've made these changes. It looks like libxkbcommon cannot be found though. I tried stealing from https://github.com/WebPlatformForEmbedded/WPEBackend-mesa/blob/master/CMakeLists.txt#L16 but for some reason this doesn't work. 🤔

@kisvegabor
Copy link
Copy Markdown
Member

I couldn't find anything useful for it in Google either. 🙁

Let's disable LV_LIBINPUT_XKB for now. Testing only libinput is already useful.

@Johennes Johennes force-pushed the feature/libinput branch 9 times, most recently from 5731324 to 00cdf89 Compare January 29, 2024 10:40
@kisvegabor
Copy link
Copy Markdown
Member

It seems this did the trick! Well done!

@Johennes
Copy link
Copy Markdown
Contributor Author

It seems this did the trick! Well done!

Yes, I stole it from lv_drivers. 🙈 😅

@kisvegabor kisvegabor merged commit b45ef5c into lvgl:master Jan 29, 2024
@kisvegabor
Copy link
Copy Markdown
Member

Cool, thanks for all!

HongChao6 pushed a commit to HongChao6/lvgl that referenced this pull request Oct 18, 2024
HongChao6 pushed a commit to HongChao6/lvgl that referenced this pull request Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants