Commit graph

207 commits

Author SHA1 Message Date
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
Peter Hutterer
b00fe9ed99 util: move the ansi color escape sequences into a separate header
Make the default set an enum with an array to access the codes. Additionally
provide a true RBG escape sequence, all modern terminals support that anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
91c4bc2a93 libei: handle a late device connect correctly
Where the server connects a device after the client has already removed it, we
need to ignore that message silently.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
689e5c4ed9 util: remove a libinput leftover
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
c4601b7196 Implement device suspend/resume with starting state of "suspended"
This was already spelled out in the documentation but just not yet
implemented. New starting state for any device added by EIS is "suspended",
the server needs to explicitly resume it before events are accepted.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
f8fa944262 test: add helper functions for checking for no events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
b7ddbf0a53 libeis: make the device ref/unref public
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
629f3043ad libeis: rename get_x/get_y to get_dx/get_dy
These are deltas, let's name them as such

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
2b29b6e1b9 libei: add ei_device_get/set_user_data
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
d7831fe81a libei: some more documentation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
5811ee7306 libei: drop two unimplemented example init functions
These were added originally to illustrate how the diffent backends could work
but they're not going to be implemented this way anyway. So let's just drop
them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
8bddc3008f test: expand the ei tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
76e5b30451 libei: change the behavior of the REMOVED message
If a client calls ei_device_remove(), it should consider that as the last
interaction with this device (short of unref). There is no need for the server
to confirm this, no further events must reach the client for this device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
451875e287 libei: if we get disconnected after ei_device_add(), queue a removed event
If we get disconnected after calling ei_device_add() but before EIS saw and
processed the event, we need to emulate a removed event ourselves.

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