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
Peter Hutterer
7965e8f4df
libei: plug a memleak if we get more than one message
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 16:17:51 +10:00
Peter Hutterer
515b67c6da
tools: use a cleanup function for unlinking the socket
...
This way we can't forget to remove the file.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 16:17:51 +10:00
Peter Hutterer
39b5ba74a4
Switch the various coordinates to doubles
...
Original idea of 1/1000 of a pixel was to allow subpixels while sending fixed
width down the wire. Let's not care about that and use doubles instead.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 16:17:51 +10:00
Peter Hutterer
7d58a76254
libei: rework the wire message parsing for slightly better readability
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 16:17:51 +10:00
Peter Hutterer
09f6ef8d7a
libei: use a macro to define the tests
...
Having to define a separate name and test function for each test is annoying.
The unit-tests can leak the tests names anyway, so let's shortcut this with a
macro.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 16:17:51 +10:00
Peter Hutterer
f35b591b9c
libei: ei_get_user_data() is a public API
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 16:17:51 +10:00
Peter Hutterer
b309ebcc66
libei: define a cleanup helper for the internal message
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 16:17:51 +10:00
Peter Hutterer
f149a93743
libei: unify the wire message logging in one place
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 16:17:51 +10:00
Peter Hutterer
81cb24124d
libei: drop the nested event types
...
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.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 16:17:51 +10:00
Peter Hutterer
b547fdc529
Improve naming for the DeviceAdded message
...
DeviceAdded is more self-explanatory than just "Added"
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 16:17:51 +10:00
Peter Hutterer
325622ed7c
libeis: unify the wire message logging in one place
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 16:17:51 +10:00
Peter Hutterer
6c823b1308
libeis: keep a ref of the client during dispatch
...
On error, we call eis_client_disconnect() which unrefs the client. Since we're
using it afterwards for debugging logs, we need to keep at least one ref
going.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 16:17:51 +10:00
Peter Hutterer
fb7bbbd4ce
libeis: plug a memory leak if we get more than one message per dispatch
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 16:17:51 +10:00
Peter Hutterer
2e944450a0
tools: change the default socket to $XDG_RUNTIME_DIR/eis-0
...
This matches the future portal implementation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 16:17:51 +10:00
Peter Hutterer
ce91763683
util: add a errno wrapper
...
Converts into a negative errno or the respective value
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 16:15:09 +10:00
Peter Hutterer
8cdbcda7a7
test: add EIS integration tests
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-12 14:42:09 +10:00
Peter Hutterer
dd426757fb
test: fix the suite name for the EI integration tests
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-12 14:36:10 +10:00
Peter Hutterer
efa01ffc38
test: move the with_server/with_client helper macros to eierpecken.h
...
We want to re-use those.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-12 14:35:41 +10:00
Peter Hutterer
d38f9c82ce
meson.build: rename the test binary eitest
...
Faster to type, no other reason.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-12 14:35:19 +10:00
Peter Hutterer
c0ced9f234
meson.build: eierpecken helper lib must link against ei and eis
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-12 14:34:46 +10:00
Peter Hutterer
d7bc93cb4f
libei: send the name in the original connect message
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-12 14:17:36 +10:00
Peter Hutterer
bfee550834
More log messages for debugging
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-12 14:16:09 +10:00
Peter Hutterer
017260798b
README: update the blurb about batched processing
...
Short story, we can't do it but it's simple enough to work around in the
caller so let them do it.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-12 14:16:09 +10:00
Peter Hutterer
78b0b99883
README: add a blurb about libreis
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-12 14:16:09 +10:00
Peter Hutterer
7d75b3eb8c
test: use drop caps, not reject caps as terminology
...
And add a test that tests for dropped caps
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-11 13:01:36 +10:00
Peter Hutterer
7ae661a029
test: add a test for a device dropped to zero caps and refused
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-11 13:01:36 +10:00
Peter Hutterer
a95d2bdd8b
test: fix the accept/reject behaviour for peck eis contexts
...
Rejecting means disabling the accept and vice versa
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-11 13:01:36 +10:00
Peter Hutterer
21d6b6a5ca
test: fix the default behaviour of the peck EI context
...
This is a flag, not a value.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-11 13:01:36 +10:00
Peter Hutterer
3db476930b
Add a bunch of log_debug messages
...
We can remove those when we have a working implementation, for now it's too
painful to debug when an exchange doesn't work for some reason.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-11 13:01:36 +10:00
Peter Hutterer
57a9892f5d
eis: send the removed deviceid down the wire
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-11 11:13:14 +10:00
Peter Hutterer
2a98906b32
util: add name lookup to tristate handling
...
And make it more obvious that _val isn't something you should access directly.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-11 11:06:34 +10:00
Peter Hutterer
b717837b14
Downgrade the ECANCELED warning to a mere info
...
ECANCELED is used for any time the other end disconnects, so it's not really
an error.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-11 11:06:07 +10:00
Peter Hutterer
ce51392241
test: fix the device add test
...
Check that we're actually adding the device and getting the message back
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-11 10:51:30 +10:00
Peter Hutterer
55246512f0
Add capabilities to the Added event
...
This makes it possible for the server to limit capabilities.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-10 19:32:34 +10:00
Peter Hutterer
fb707a3395
Add a prefix to the logger
...
Makes it easier to distinguish between ei and eis when everything in the tests
is just printed to stderr anyway.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-10 13:50:13 +10:00
Peter Hutterer
6f75463261
Rename "accepted" to "added" for consistency with the public API
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-10 08:49:22 +10:00
Peter Hutterer
2631854dbb
libreis: update the API docs a bit
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-10 08:42:25 +10:00
Peter Hutterer
12a04fa657
libei: update the API docs a bit
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-10 08:40:53 +10:00
Peter Hutterer
fe22b9b5a5
proto: specify that the protocol isn't batch-compatible after all
...
The protocol itself could work like originally described here but there's a
stumbling block: the decision on whether to accept a device is made by the
caller through EIS_EVENT_DEVICE_ADDED and the following eis_device_connect()
call. We cannot process any events from that device until that call is
complete and that effectively disallows batch submission of requests.
To allow batching we'd have to pause the protocol but that means missing out
on other devices (and their events) and disconnect events. The alternative to
that would be for libeis to peek at incoming requests and sort them by device
ID so we only pause one device's stream but now we're also mangling the device
event order and potentially triggering all sorts of side-effects.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-10 08:04:05 +10:00