Commit graph

185 commits

Author SHA1 Message Date
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
Peter Hutterer
a41a025b65 test: add some documentation for the test helpers
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
8a8c72b24e test: rename a helper function
This function dispatches until a stable state is reached - that could be no
event waiting or some event waiting to be processed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
1fdbba2ec9 test: rename two tests to reflect current nomenclature
"reject" isn't a thing, "disconnect" is

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
1fe93ae8be Factor out munit test handling into a set of helpers
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
451f863894 brei: add a dispatch helper function for protocol messages
This de-duplicates a bunch of things that we don't need to duplicate,
specifically the protocol part that splits the data up into parseable chunks.
That we have Frames in between messages is an implementation detail, this way
neither libei nor libeis have to care about it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
d26ab60b1f test: fix the naming of some unit tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
a20d09c049 libeis: use the shared next_message helper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
4daab4de92 Move the next message helper into a shared function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
b973e04cee libeis: move the protocol parsing into a separate file
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
6de95310e1 libei: move the protocol parsing into a separate file
The goal here is to separate any state checking and other processing from the
actual bits writing onto the wire so we can test those separately.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 14:44:38 +10:00
Peter Hutterer
2b9d5d960a libeis: two coding style fixes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-18 16:06:40 +10:00
Peter Hutterer
d4e274ee6f libeis: flatten the event hierarchy
Same as already done for libei. There's relatively little benefit here since
we won't have a lot of different events and any caller will do the switch
based on the event type anyway. So let's just export a single event type and
have everything contained in that.

Since this required rewriting all getters, let's move the lot to a new file
and streamline things a bit that way.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-18 16:05:52 +10:00
Peter Hutterer
4565fb6851 libei: add the hooks for pointer/touch ranges
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-18 14:42:23 +10:00
Peter Hutterer
4b0976c36c test: add helpers for the next event
Makes debugging easier since we can get the string event type that way.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-18 14:42:23 +10:00
Peter Hutterer
81d37cfde5 test: fix behavior handling for accepting/rejecting clients
Either of those should not modify the behavior for accepting or rejecting
devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-18 14:42:23 +10:00
Peter Hutterer
d65c678239 test: add a helper to wait until a stable state
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-18 14:42:23 +10:00
Peter Hutterer
a5ea7a6dd0 test: better event type logging
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-18 14:42:23 +10:00
Peter Hutterer
c39dc360d4 test: terminate the test list with NULL
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-18 14:42:23 +10:00
Peter Hutterer
14d6c87974 libei: use a #define for cleaning up a device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-18 14:42:23 +10:00
Peter Hutterer
fd9035dfe6 libei: some more API documentation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-18 14:42:23 +10:00
Peter Hutterer
537fdfde85 Drop ei_next_event_type() and eis_next_event_type()
Replaced by ei_peek_event() and eis_next_event_type()

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-18 14:42:23 +10:00
Peter Hutterer
b052d30978 test: fix an unused variable complaint
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 16:34:36 +10:00