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
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