Commit graph

989 commits

Author SHA1 Message Date
Peter Hutterer
3f768ecbfc CI: add missing dependencies line 2023-10-11 13:31:47 +10:00
Peter Hutterer
5909717700 doc: use a specific revision of the hugo template
Upstream commit 1250bf30a8c2e3c1bfac285489bc63f2c395b641 somehow breaks
things. Doesn't affect hugo v0.111 (F39) but it does break on F38 on
v0.101.

Let's not waste more time debugging this, hardcode the template and in a
few weeks time we can switch to F39 as the build host.
2023-10-11 13:09:31 +10:00
Peter Hutterer
43b383ebdb doc/protocol: fix some hugo warnings
WARN 2023/10/11 12:41:19 "_index.md": WARNING you must call the ref /
relref shortcode with '% %' instead of '< >' to work correctly for the
anchor target attribute
2023-10-11 12:42:47 +10:00
Peter Hutterer
b8884770f1 CI: add a separate job for the documentation build
The pages job is only run once we push to main, so any issues with the
documentation build won't be picked up until it's too late. Split those
up and build the doc in a separate job, the pages job simply takes the
artifacts from that job and publishes them.
2023-10-11 12:25:53 +10:00
Peter Hutterer
d4bf8840a4 util: block SIGALRM during posix_fallocate
posix_fallocate() may be interrupted (EINTR), e.g. by SIGALRM in the X
server's smart scheduler.  On slow systems and for large allocations
this means we cannot ever succeed so let's block SIGALRM like everyone
else does.

See e.g.
4cfee39872
and the same code is in libwayland, libdecor, etc.
2023-10-11 00:58:23 +00:00
Peter Hutterer
fd2999ffdb tools: add a --interval option to the demo server and client
Makes testing a few things easier.
2023-10-11 00:49:25 +00:00
Peter Hutterer
cefef7b1a5 Add a static assertion that EAGAIN == EWOULDBLOCK
Not sure what platforms this isn't the case on and I'm even less sure we
need to care so let's fail the build where this is the case and work it
out if someone complains.
2023-10-11 00:41:13 +00:00
Peter Hutterer
69e973e6b3 ei: queue unsent messages for later delivery if our buffer is full
If our write buffer is full, enqueue the events instead and try to flush
them out later when we can write again.

Fixes #46
2023-10-11 00:41:13 +00:00
Peter Hutterer
95d1107cea util: allow sources to have write notifications
In case our outbound buffers are full we need we need to be able to have a
notification when we're able to write again.

There are two approaches to do this: one is to duplicate the source
(and dup() the fd) and use that for write notifications only. The other
approach is to toggle the source's EPOLLOUT flag on demand, thus
sharing the source dispatch. I picked the latter for simplicity.
2023-10-11 00:41:13 +00:00
Peter Hutterer
8f6c355805 util: fix clobbered errno in sink_add_source 2023-10-11 00:41:13 +00:00
Peter Hutterer
381c6bea1f ei: improve a debug message, the number we print is the serial 2023-10-05 23:00:20 +00:00
Alban Browaeys
4929aeae61 Fix duplicate negation in log message
The test is meant for "not emulating", not "not not emulating".
2023-09-14 02:01:04 +02:00
Peter Hutterer
82cdbc9129 libei 1.1.0 2023-09-07 15:07:54 +10:00
Jason Gerecke
0820e29bd5 Correct documentation for ei_touch_(get|set)_user_data 2023-09-06 21:16:08 +00:00
Peter Hutterer
d9d4630567 tools/debug-events: print the region mapping id
This changes the region print format from a string to a dict
2023-09-01 12:18:20 +10:00
Peter Hutterer
c179b3dac1 tools: fix an indentation issue 2023-09-01 12:18:20 +10:00
Peter Hutterer
ac16ba77ff tools: start ei-debug-events for the fd we get from the oeffis demo tool
Once we get the fd, fork off ei-debug-events for that fd so we can debug
what the EIS implementation actually sends us.
2023-09-01 12:06:38 +10:00
Peter Hutterer
8713ef2d63 libei 1.1.0rc1 2023-08-31 14:06:49 +10:00
Peter Hutterer
16c7b1570b test: fix 64-bit pointer access for the object ids
memcpy this out so we can compare them.
2023-08-31 13:42:25 +10:00
Peter Hutterer
931632effd test: use munit_assert_uint64 for 64-bit values
Otherwise we only take the first 4 bytes which can fail on BE if we're
comparing an array directly (like we do for the string test).
2023-08-31 13:37:13 +10:00
Peter Hutterer
f9c6ea30fc brei: copy protocol strings out of the protocol buffers
With our strings being a 4-byte header followed by the string itself,
they're virtually guaranteed not to be 8-byte aligned. This causes an
issue on some architectures so we need to copy the string out before we
access it.

Since strings are the only protocol type with that extra buffer, let's
hack this in with the minimum effort approach - a null-terminated
char * pointer array that's filled with the strings as they appear in
on the wire. The brei_arg->s points to one of those strings as needed.

This means we can drop the brei_string struct, thanks to pointer alignment
issues this struct doesn't work on s390x, so let's drop it, it no longer
serves any meaningful value.

Fixes #41
2023-08-31 13:37:13 +10:00
Peter Hutterer
a223ce86da util: switch iobuf to uint8_t to avoid sign issues
char is signed or unsigned, so let's avoid this by using uint8_t.
2023-08-31 13:37:13 +10:00
Peter Hutterer
397ee6d79c brei: avoid pointer casts for 32/64 bit values
Copy those onto the buffer with a memcpy rather than via a
(const char *) cast to make sure we work on s390x too.
2023-08-31 13:37:13 +10:00
Peter Hutterer
90040096dd test: rename a variable to avoid clashes
Future changes will use slen further below because it's the best name,
so let's rename this one since it's less impactful.
2023-08-31 13:37:13 +10:00
Peter Hutterer
1bac0c28b4 CI: update the commit for the last ABI break
abe85e051 stopped the symbol leaks which will look like an ABI break.
2023-08-31 13:30:36 +10:00
Peter Hutterer
abe85e051e meson: build libutil with hidden symbols visibility
We were leaking some of the utility functions, let's not do that.

This is technically an ABI break but if you're relying on libei to
export those functions...well, don't.
2023-08-31 13:20:05 +10:00
Peter Hutterer
f235052f81 test: ensure munit debug messages are visible on failure 2023-08-31 12:41:13 +10:00
Peter Hutterer
8f911d5e41 test: log the buffers after reading from them
Should help debug some issues with the encoding
2023-08-31 12:41:13 +10:00
Peter Hutterer
8e95c7d8a5 util: add a strv_from_mem() helper function
Generates a strv with the buffer as hex string.
2023-08-31 12:41:13 +10:00
Peter Hutterer
4f2fd16186 test: close the sockets on exit 2023-08-31 12:41:13 +10:00
Peter Hutterer
7115e9c4c8 test: rework the oeffis dbus tests to be pytest-compatible
DBusMock is unittest based and the documentation points users to that
approach. That approach is limiting however because we can't use all
pytest features (see [1]). Luckily, the parent class in dbusmock doesn't
really do much so we can emulate the functionality ourselves - all we
need to do is call the same setUp/tearDowns and be done with it.

This means we can move the dbus-monitor and mainloop handling into
fixtures too which makes the code a fair bit nicer to read.

[1] https://docs.pytest.org/en/7.1.x/how-to/unittest.html#pytest-features-in-unittest-testcase-subclasses
2023-08-30 09:46:36 +10:00
Peter Hutterer
e03c047b5d proto: require Python 3.9
ei-scanner relies on some 3.9 features and since that has been out for
almost 3 years now, let's make it a requirement.

Fixes #39
2023-08-30 09:36:40 +10:00
Peter Hutterer
76652350cc Add a mapping_id to the regions
This allows a caller to match up a region with other data, e.g. in the
remote desktop case the same mapping_id can be assigned to the pipewire
stream that represents that output.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-08-30 09:18:26 +10:00
Peter Hutterer
2fbd22984f util: fix iobuf_append_fd OOB when we have too many fds
Cannot happen in deploymentts since we never have more than one anyway.

Fixes #43
2023-08-30 09:11:08 +10:00
Peter Hutterer
b7ab63c386 util: fix iobuf_take_fd invalid memmove for multiple fds
Wrong calculation resulted in memmoving only the first 32 bytes (i.e. 8
fds) instead of the first 32 fds, resulting in an infinite loop when
cleaning up an iobuf with more than 8 fds.
2023-08-30 09:11:08 +10:00
Peter Hutterer
7ddd70e9d8 Add ei_device_get_region_at() to obtain a region for a point
Helper function so clients don't need to loop through the regions to
find the matching one.
2023-08-29 11:39:20 +10:00
Peter Hutterer
36f1641125 meson.build: bump to use gnu11 over gnu99
static asserts require C11
2023-06-09 10:27:55 +10:00
Peter Hutterer
661f7665d7 libei 1.0.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-08 09:23:45 +10:00
Peter Hutterer
39e6c93c8b test: ensure all returned interface versions are 1
Even where our client pretends to have higher interface versions, we
always send back version 1 from the EIS implementation.

This test probably won't really trigger anything useful until we switch to
version 2 somewhere, so let's hope the code works...
2023-06-07 23:08:16 +00:00
Peter Hutterer
97a5538258 test: add test for correct ei_device_close behavior 2023-06-07 23:08:16 +00:00
Peter Hutterer
1f51c05897 test: don't over-ref the button/scroll devices
If we create a pointer and an absolute pointer in a test, we end up with
two devices that both have button and scroll capabilities.
Overwriting those results in a dangling ref to the device.
2023-06-07 23:08:16 +00:00
Peter Hutterer
b14405d3cd ei: fix a whitespace error 2023-06-07 23:08:16 +00:00
Peter Hutterer
22079d62dc test: add a unit test for ei_region_convert_point 2023-06-07 23:08:16 +00:00
Peter Hutterer
059d3e11b6 eis: send all our interface versions to the client
The protocol requires this only for interfaces that create client-side
objects but let's do it here anyway to ensure the code is tested.
2023-06-07 23:08:16 +00:00
Peter Hutterer
e0d60b062c ei: removed unused ei_callback_new_for_id
Leftover from an earlier version before callback and pingpong were split
into separate interfaces.
2023-06-07 23:08:16 +00:00
Peter Hutterer
befab06ea2 tests: add tests for button events
Those were missing, luckily the code works
2023-06-07 23:08:16 +00:00
Peter Hutterer
aa3c2eb763 ei: remove unused ei_pingpong_new()
Copy/paste from the callback interface I think, so let's remove it.
2023-06-07 23:08:16 +00:00
Peter Hutterer
6caf69a73c test: check that the width/height are set for physical devices 2023-06-07 23:08:16 +00:00
Peter Hutterer
a9edea65ca ci: add a check that our event values cannot diverge
See commit 168de89a "eis: sync event codes with libei", this script
should've prevented that issue.
2023-06-07 14:36:00 +10:00
Peter Hutterer
2d6b11833b CI: remove a copy/pasted MESON_ARGS from the abicheck job 2023-06-07 14:28:04 +10:00