Commit graph

220 commits

Author SHA1 Message Date
Peter Hutterer
5d85ea4c8f tools/demo-server: use _cleanup_foo_ functions for eis and eis_event
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-27 11:49:20 +10:00
Peter Hutterer
22930d0d2b tools/demo-client, demo-server: use the new color print functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-27 11:49:20 +10:00
Peter Hutterer
c169e10af7 util: move the colorprint to util-color
And extend it a bit to be more flexible.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-27 11:49:20 +10:00
Peter Hutterer
4ae108fbff libeis: implement eis_device user_data getters/setters
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-27 11:49:20 +10:00
Peter Hutterer
ac42578811 replace the fallthrough comments with __attribute__((fallthrough))
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-26 11:00:50 +10:00
Peter Hutterer
f8a2729d7f README: add a graphic to illustrate how XWayland looks like
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 14:30:17 +10:00
Peter Hutterer
6b3d9255cf libei: implement org.freedesktop.portal.EmulatedInput support
The current implementation of that portal has two methods: EmulateInput to
authenticate and Connect to get the fd to the EIS implementation. The portal
implementation is in charge of finding EIS and restricting it if need be.

This uses libsystemd because we can integrate that with epoll and our
libei_dispatch() method. GDBus requires a glib mainloop, so it's not really
suitable here. Given how simple this is anyway, it's easy to just do the DBus
bits in the caller and then hand the fd to ei_setup_backend_fd().

A eis-fake-portal is provided for testing, this "portal" can use the custom
portal bus name and connect the eis-demo-client to the eis-demo-server.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 13:35:18 +10:00
Peter Hutterer
f6c2f24a22 util: add xconnect to connect to a socket
Makes this re-usable.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:47:07 +10:00
Peter Hutterer
b49e4a48c9 test: move the sources and io tests to the util unit tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
b064d435ec test: make a separate binary for the utils tests
And add the tests for the list and string helpers as a first use-case, copied
from the libinput tests.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
f06095e0c8 libeis: fix the client-side keymap assignment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
31988e056d tools/demo-client: print a server-side keymap if there was one
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
ee1935b8c5 tools/demo-server: add support for keymap overrides
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
bc2bd3c09a libeis: correct the name of the set_keymap function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
04dab83115 tools/demo-client: make the XKB layout a commandline argument
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
901235af5c tools/demo-server: add option parsing
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
55d92c8f61 tools/demo-client: hook up --verbose
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
c4f1a9107e tools: rename the socket server tool to eis-demo-server
Conveys more of it's meaning

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-25 11:37:18 +10:00
Peter Hutterer
c063ec023c tools/ei-demo: add hooks for choosing a backend
None exist other than the socket one but hey, the infrastructure is there.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-24 20:45:37 +10:00
Peter Hutterer
8cf7b3573e tools: rename the ei-socket-client to ei-demo-client
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-24 20:00:49 +10:00
Peter Hutterer
a01476f4af tools: don't re-add devices on removed
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-24 19:58:39 +10:00
Peter Hutterer
bde5b37acf Include stddef.h for size_t
And add the minimal build tests to make sure we build and link

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-24 13:01:37 +10:00
Peter Hutterer
b913e7e609 brei: fix a compiler warning in release mode
Re-ordering commands in buildtype=release means recvfd may not be set by the
time _cleanup_ is called (due to the goto outs). Replace those with return
statements, it's more logical here anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-24 12:30:25 +10:00
Peter Hutterer
e238a5d049 util: fix receiving of multiple fds
Initial implementation only handled this correctly if the fds were over
multiple message headers, not multiple fds in the same message header.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-24 11:01:01 +10:00
Peter Hutterer
65c069e6a0 util: fix a valgrind warning in xsend_with_fd
valgrind complains about uninitialized bytes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-24 08:53:49 +10:00
Peter Hutterer
17d396aaf1 Add size handling for the keymap
Just sending the fd isn't good enough, to mmap those we need the size argument
too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-21 18:57:25 +10:00
Peter Hutterer
4af29d930a tools: add keymap handling to the socket demos
Client sets layout fr, server accepts it and prints azerty for the keys
pressed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-21 18:57:25 +10:00
Peter Hutterer
2a619fd4b4 utils: basic helper for creating a file in memory
Needed by the tools for keymap handling.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-21 16:03:34 +10:00
Peter Hutterer
575943e744 test: add another dispatch for the suspend test
In case the RESUMED isn't written on the wire yet (or it's written with
sendmsg and thus a separate message on its own) we don't have the RESUMED
ready for us yet. Let's call another dispatch to make sure it's processed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-21 15:25:27 +10:00
Peter Hutterer
d160f6c7af test: enable debug logging again
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-21 15:25:27 +10:00
Peter Hutterer
819b1e86b1 libei: integration of keymap fd parsing
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-21 15:25:27 +10:00
Peter Hutterer
fef9580319 libeis: push the new brei_message one level up into eisproto
This is the proto parser and it'll know when we need an fd on the message, so
let's make sure we have everything in place to fetch the fd.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-21 15:25:27 +10:00
Peter Hutterer
397bb3f19d brei: hook up the brei message so we can retrieve an fd
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-21 15:25:27 +10:00
Peter Hutterer
38c50d0d3d libei: push the new brei_message one level up into eiproto
This is the proto parser and it'll know when we need an fd on the message, so
let's make sure we have everything in place to fetch the fd.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-21 14:51:53 +10:00
Peter Hutterer
d4fedc1a4b brei: abstract the message type away
Once we start passing fds within messages, we need something more abstract.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-21 14:51:53 +10:00
Peter Hutterer
dabd48c028 util: add fd passing to the iobufs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-21 14:51:53 +10:00
Peter Hutterer
56ca4b4ac7 util: add sending and receiving fds to the io utilities
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-21 11:49:53 +10:00
Peter Hutterer
9e42b579d9 util: typo fix in comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-21 10:04:43 +10:00
Peter Hutterer
ab453cd1f4 libei: hook up the API for keymap assignments
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-21 09:08:45 +10:00
Peter Hutterer
5749f3ec27 brei: fix use of uninitialized data
This was intentional here but valgrind doesn't like it, so let's just set it
to something that should look odd.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-21 08:45:05 +10:00
Peter Hutterer
eb8e204f27 util: fix use of uninitialized variable
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 16:07:54 +10:00
Peter Hutterer
f3a60ca6b3 Fix maybe-uninitialized warnings
Building with a releaes build reshuffles things so this ends causing potential
issues. Initialize to NULL to avoid around this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 16:07:54 +10:00
Peter Hutterer
a835093321 Add gitlab CI
Mostly copied from libinput and simplified so we only test on Fedora for now.
Good enough that it should catch accidental breakages.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 16:07:54 +10:00
Peter Hutterer
ae5ef9ce2f tools: pretty colors for the demos
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
355093cc1b libeis: replace the logger utility with a custom logger handling
The logger utilities are useful for quick prototyping, but we've reached the
point where we need the "proper" implementation of a log handler.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
14ee9f6e31 libei: replace the logger utility with a custom logger handling
The logger utilities are useful for quick prototyping, but we've reached the
point where we need the "proper" implementation of a log handler.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
7d7e7fc5e0 libeis: set the user data we passed to libeis_new()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
5b1d74cf19 libeis: use get/set user_data, not userdata
For consistency with libei.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
3b5316a7b7 meson: hook up unit tests for eis as well
None defined for now, this is the build system setup only.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
741425b803 util: add a wrapper macro for running code only once
Macro around the usual static bool stuff, let's see if this is more readable.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00