Commit graph

1024 commits

Author SHA1 Message Date
Peter Hutterer
9ee399c8be CI: Lock hugo to v0.111 to allow for distro updates
F40 now ships v0.121 which again breaks something in the relearn theme
so let's lock our version here to one we know works and move on with
life. I can't be bothered to relearn hugo and themes every few months
just for a single static website.
2024-07-24 17:39:04 +10:00
Peter Hutterer
da1fa204d5 meson.build: bump the meson version by one
This allows us to drop one version check
2024-07-24 12:29:48 +10:00
David Redondo
23f056433d Fix API docs for EIS_EVENT_CLIENT_CONNECT
The functions with event in their name don't exist.
2024-04-09 06:39:13 +00:00
Matt Turner
33b4a61995 test: Raise SIGALRM interval to 50µs
On some platforms, an interval of 5µs is short enough that the test
spends its time almost exclusively processing SIGALRMs and never
progresses otherwise. Raising the interval to 50µs allows the test to
pass in a fraction of a second.

Bug: https://bugs.gentoo.org/916777
Closes: https://gitlab.freedesktop.org/libinput/libei/-/issues/50
2024-04-08 12:21:09 -04:00
Peter Hutterer
54ca521d0a proto: highlight the region 'hight' typo in the documentation
Changing this would be an API-breaking change (depending on how
bindings are generated) so we'll have to live with this typo for the
foreseeable future.

Closes #53
2024-03-12 04:25:33 +00:00
David Redondo
93efd3d14e eis-demo-server: Send a sensible discrete scroll value
So it can be a good example for people and doesn't log about
server bugs.
2024-03-05 22:47:05 +00:00
Peter Hutterer
08f1d41085 libei 1.2.1 2024-02-05 13:33:04 +10:00
Peter Hutterer
d29778658a oeffis: OEFFIS_DEVICE_ALL_DEVICES should translate to "all"
As the portal documentation [1] says:
  Bitmask of what device types to request remote controlling of. Default is all.

The default is only triggered if we do not submit the types at all, the
current behavior of sending a value of 0 means "none". Fix this by
skipping the "types" key if we try to select for all devices.

[1] https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.impl.portal.RemoteDesktop.html
2023-12-14 00:58:18 +00:00
Peter Hutterer
6ce695db3b test: yield the proxy, not the subprocess for the liboeffis fixtures
There's virtually no use for the process, so let's yield the proxy
object instead because we can make use of that.
2023-12-14 00:58:18 +00:00
Peter Hutterer
870123f54b CI: move the minium meson version job to debian
See 55e5deedd8 where this job was removed.
2023-12-14 10:44:54 +10:00
Peter Hutterer
eaed3883d8 CI: fix a hardcoded fedora and replace it with the jinja var 2023-12-14 10:44:54 +10:00
Peter Hutterer
97d66604fb CI: drop the git depth for the ABI check job
We need to make sure that we can checkout whichever sha was the last ABI
break.
2023-12-14 10:41:19 +10:00
Peter Hutterer
55e5deedd8 ci: bump to use F39
And drop the job to test the minimum meson version in the process. F39
ships with python 3.12 which causes this error with meson 0.56.0

proto/meson.build:17:0: ERROR: <ExternalProgram 'python3' -> ['/usr/bin/python3']> is not a valid python or it is missing setuptools

We could put the effort into setting up the CI to fix this, but we
won't.
2023-12-13 17:55:16 +10:00
Peter Hutterer
4936316884 libei 1.2.0 2023-12-06 08:19:00 +10:00
Peter Hutterer
9697aa9c74 pre-commit: autoupdate and add two more useful checkers
We don't have symlinks but let's check for them anyway. And check for
merge conflict leftoers too.
2023-12-05 14:25:10 +10:00
Peter Hutterer
38132d6fc5 ei: improve debug messages for keymap failures
Let's be more informative about what failed.

Fixes #48
2023-11-09 12:55:56 +10:00
Peter Hutterer
924341e174 ei: keep a cache of defunct objects to avoid spamming the log
Because of the asynchronous protocol, we may get this interaction

   server sends A->destroyed()
       client sends A->foo()
       client receives A->destroyed()
   server receives A->foo()
   server sends invalid_object_id(A)
       client receives invalid_object_id(A)

Previously we dropped the object after destroyed() and were thus
guaranteed to warn about the invalid object id for that same object
later.

Fix this by keeping a cache of defunct object IDs that we know about and
ignoring errors for recently dropped objects.

Every 20 ei_dispatch() calls we drop any defunct objects that were
unregistered more than 5 seconds ago.

Fixes #49
2023-11-09 12:47:06 +10:00
Peter Hutterer
4e634aa76c test: add the ability to add offsets to ei_now()
Build a separate libei-eierpecken.so that is identical to libei.so but
allows adding an offset to ei_now() for the eierpecken tests. That
offset is added to the return value of ei_now(), removing the real-time
dependency of the tests.

In other words, we can call peck_ei_add_time_offset(peck, s2us(5)) to
add 5 seconds to the time and continue the test as if that time has
elapsed.
2023-11-09 12:47:06 +10:00
Peter Hutterer
7999483a34 test: make bug logs fatal by default
We don't want to paper over bugs in the implementation, so let's make
any ei/eis error message with a bug in it fatal by default.

This needs to be disabled where we test for known-buggy client/EIS
behavior.
2023-11-09 10:15:38 +10:00
Peter Hutterer
fae41aac08 test: hack a peck_debug() function
To make it easier to print something debuggy from a test.

This is the MVP, it always requires an argument after the format string
but it'll do for now.
2023-11-08 23:24:45 +00:00
Peter Hutterer
34c83370be eis: fix a typo 2023-11-08 23:24:45 +00:00
Peter Hutterer
d31b5a1ccf eis: only queue a seat bind event if the caps change
This triggered an internal bug message in test_ei_seat_bind_unbind_immediately.

If a client unbinds all capabilities this triggers an EIS_SEAT_BIND with
zero caps. peck would call eis_seat_remove() which calls eis_seat_drop().
That queued another EIS_EVENT_SEAT_BIND with zero capabilities, leading
peck to call eis_seat_remove() again on an already removed seat.
2023-11-08 23:24:45 +00:00
Peter Hutterer
44e7f2cbc4 test: fix a test missing frame events 2023-11-08 23:24:45 +00:00
Peter Hutterer
35832d9fe1 test: make peck_dispatch_until_stable() print more useful debug info 2023-11-08 23:24:45 +00:00
Peter Hutterer
f9c83ed9a6 test: expand log messages to accommodate for 4-digit line numbers 2023-11-08 23:24:45 +00:00
Peter Hutterer
57e7cd7972 doc: drop the git depth from the hugo theme
We need a specific SHA so let's not risk that one being outside that
depth that we clone to.
2023-11-08 16:04:33 +10:00
Peter Hutterer
05d79f6e58 test: set up a timer to trigger SIGALRM
Xwayland uses a timer for the scheduler which means any of our syscalls
can trigger EINTR. Let's make sure we may catch bugs related to that by
setting up our test suite to hammer us with timers.

Can't guarantee this will trigger all bugs but over time it may help or
at least ensure that the low-hanging fruit are all fixed.
2023-10-24 18:25:25 +10:00
Peter Hutterer
f558eedae2 util: add a global setup option to our munit wrapper
This allows us to handle/manipulate argv and/or pass a userdata to the
tests. Same ELF section approach as we already have with the MUNIT_TEST
macro but this time it's for a global setup.

Note that for the generated __start and __stop section variables we have
to have at least one entry in that section which we do with one
hardcoded (and ignored) one.
2023-10-24 18:25:25 +10:00
Peter Hutterer
6758b9970d util: add helper macros for the ELF section handling 2023-10-24 18:25:25 +10:00
Peter Hutterer
19c949a46b util: retry posix_fallocate() if it fails
We block SIGALRM since d4bf8840a4 so any
remaining EINTR is something we should probably retry with.
2023-10-24 18:25:25 +10:00
Peter Hutterer
a3c801097d util: don't check for EINTR on close()
See https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/261#note_2131802
2023-10-24 18:25:25 +10:00
Peter Hutterer
cdbd1d9eaf util: replace most of SIGALRM blocks with EINTR checks
SIGALRM *should* not really be an issue for us, most of our IO shouldn't
take long (posix_fallocate is the exception) so we can just retry it
instead of blocking someone's use of SIGALRM.

Doing it here mostly means that the rest of libei doesn't have to care
about EINTR, it'll just be handled transparently (just like before with
the SIGALRM blocks).
2023-10-24 18:25:25 +10:00
Peter Hutterer
2df570b203 tools: add an --iterations argument to ei-demo-client
Limits the number of poll() iterations before triggering a shutdown.
This allows us to use this tool for shutdown testing too - previously
it would just get killed and never performed a proper unwind.
2023-10-24 18:22:48 +10:00
Peter Hutterer
5dcdc696fb ei: remove the source if we get disconnected
If we get disconnected there's no point sending anything anymore, the
server may have already closed the connection.

Otherwise this produces a confusing warning  in the log:

 18:37:31 | INFO | Disconnected by EIS
      ... | WARN | failed to send message: Broken pipe

See https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/262#note_2132619
2023-10-19 14:18:57 +10:00
Peter Hutterer
38244b8c66 ei: if sending a message fails, don't send any more
Any error will cause ei_disconnect() which in turn unwinds our context.
Each object removed will cause an ei_send_message() to notify the server
but that will only cause error messages - our socket is already gone.

Fix this by removing the source and checking if the fd is still valid
before we write to it.

Fixes #47
2023-10-18 09:44:01 +10:00
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