Commit graph

600 commits

Author SHA1 Message Date
Peter Hutterer
fe337d9866 CI: the check-commit and check-merge-request should use the ci-fairy image 2023-02-15 09:09:20 +10:00
Peter Hutterer
1153368946 CI: move the package list to the config.yml file
Using templates for our CI is a bit of overkill but while we have it,
let's make use of it.
2023-02-15 08:23:56 +10:00
Peter Hutterer
5db1085e09 test: drop a bunch of unused imports 2023-02-15 08:20:01 +10:00
Peter Hutterer
0541668443 eis: don't send stop_emulating for a sender device
The check is currently missing from a number of libeis APIs but in most
cases we can blame the EIS implementation and say "don't do this".
Device removal is an exception since that is still required.
2023-02-13 16:18:08 +10:00
Peter Hutterer
b6a901e690 eis: divide the headers up across multiple files
libeis-private.h was getting unwieldly, so let's split this up so
(most) anything eis_foo goes into libeis-foo.h.
2023-02-13 14:01:08 +10:00
Peter Hutterer
8973101313 ei: divide the headers up across multiple files
libei-private.h was getting unwieldly, so let's split this up so
(most) anything ei_foo goes into libei-foo.h.
2023-02-13 14:01:08 +10:00
Peter Hutterer
d1282b3681 Add some extra getters for the context and the eis_client
These are all noops but this way we can ensure that get_context() and
get_client works on all objects - useful for (upcoming) generated code.
2023-02-13 14:00:19 +10:00
Peter Hutterer
56c992f4c6 Remove the public API to query the client version number
With the planned switch to a protocol supporting multiple interfaces
(a la wayland), a single version number is no longer useful. Remove this
API, we can add something more specific later if we need to.
2023-02-13 13:55:44 +10:00
Peter Hutterer
674a7c6915 meson.build: alphabetical sort of the source files
And drop the header files, meson does not require those for dependency
tracking.
2023-02-13 13:46:00 +10:00
Peter Hutterer
aea4138da5 util: undo accidental rename from source->is_active to is_sender
Runaway sed in f35be22d "Rename ei active/passive to sender/receive"
2023-02-13 13:28:31 +10:00
Peter Hutterer
e5b0dfc1a9 util: add macros to declare getters and setters
Reduces the amount of boilerplate that needs to get written.
2023-02-13 13:27:57 +10:00
Peter Hutterer
34ebddf528 util: add a object getter helper for fields as refs
Same as the existing macro, but returns &field instead of field.
2023-02-13 13:27:39 +10:00
Peter Hutterer
1925218e15 tools: whitespace fix in the demo server 2023-02-13 13:24:37 +10:00
Peter Hutterer
92f92bc3a5 tools: cleanup our clients in the eis demo server
Where we're interrupted before a disconnect event from the client, we
would leave the demo client hanging. This upsets valgrind.
2023-02-13 13:24:37 +10:00
Peter Hutterer
129eabcd29 tools: add a comment to the demo server
Might save some other poor soul having to debug this ...
2023-02-13 13:24:37 +10:00
Peter Hutterer
c9b6898afd test: fix pytest loading liboeffis.so
Apparently this test doesn't run in the CI...
2023-02-09 13:04:59 +10:00
Peter Hutterer
ff9830c122 Add a sequence number to START_EMULATING
This makes it easier to correlate a particular input transaction
(whether there are events or not) with out-of-band information like the
planned portal InputCapture::Activated signal's "activation-id".
2023-02-09 11:48:29 +10:00
Peter Hutterer
a5cc87c837 Purge the properties from the protocol
The primary use-case for these properties in libei itself was to send
some fixed information (pid, cmdline and conection type). In the portal
case, these can be obtained out-of-band via the portal. In the
non-portal case these can be obtained from the socket itself (fetch pid,
look up /proc/pid/cmdline) which is just as reliable as trusting
whatever libei sends.

The only other use-case for the properties was the activation id in the
InputCapture::Activated portal signal. This can be achieved with a
serial in the START_EMULATING event.
2023-02-09 11:48:29 +10:00
Peter Hutterer
479bda259a Purge libreis from the repo
libreis was intended for an intermediary to set some information that
the libei client cannot be entrusted with. In particular this was the
application name, the allowed capabilities, and some properties that -
once set - the client could no longer change (appid as probably the only
really useful one). The price for this was a rather complicated version
negotiation dance before the initial CONNECT request.

Now that we have a clear view of what's going to happen -
RemoteDesktop.ConnectToEIS and the InputCapture portal - there is no
longer any need for libreis. The extra information that libreis would've
sent is communicated out-of-band in both portals and are known to the
compositor at the time the connection is being established.

So we can simply drop this, it's no longer required and dropping it
makes the protocol significantly simpler anyway.
2023-02-09 11:48:28 +10:00
Peter Hutterer
8d7d6ca8b7 proto: drop the Packet message, replace with 4 byte prefix
We need some sort of length field to be able to know how long the next
message is. But for simplicity, we might as well just write that
explicitly on the wire instead of wrapping our messages into yet another
message. This makes the wire format slightly simpler since the first 4
bytes are now always the length, without the previous 0x0d prefix
caused by the protobuf encoding.

0x0d == (field number << 3) | wire_type == 1 << 3 | 5
(see https://protobuf.dev/programming-guides/encoding/#structure)
2023-02-09 11:47:45 +10:00
Peter Hutterer
3bcb6fe7f7 proto: drop the varint values, replace with fixed size ones
uint32 in protobuf is encoded as VARINT (roughly similar to UTF-8 but
for numbers). Thats useful when you're sending lots of messages over the
net but in our case having a simple fixed-size protocol message format
is better.
2023-02-09 11:47:45 +10:00
Peter Hutterer
cb46522425 meson.build: move tests to test/meson.build
This requires that we add the top-level directory to includes so the
tests can find the config.h file.
2023-02-09 11:42:11 +10:00
Peter Hutterer
dd32adb319 brei: drop the explicit src in a #include statement 2023-02-09 11:42:03 +10:00
Peter Hutterer
520c20904e meson.build: use proper include handling for the proto dir 2023-02-09 11:42:03 +10:00
Peter Hutterer
5ea229d261 meson.build: switch the src include dir to the proper meson way 2023-02-09 11:42:03 +10:00
Peter Hutterer
85dff28743 meson.build: switch the source file lists to use files() 2023-02-09 11:42:03 +10:00
Peter Hutterer
a8961420db test: fix compiler warning about possible loss of precision
Let's make this a float division then to keep the compiler happy
2023-02-07 13:34:29 +10:00
Peter Hutterer
f9d691e98b eis: don't allow connecting a disconnected client 2023-02-02 15:17:24 +10:00
Peter Hutterer
8bdfc8cf18 test: fix a test case's behavior
The default behaviour of a peck context is to handle the CONNECT event.
Let's disable that.

No effect on the test, the client cannot receive the connect event until
it's been accepted, but it's better form anyway.
2023-02-02 15:17:09 +10:00
Peter Hutterer
19c85e7ee1 ei: fix a typo 2023-02-02 15:16:56 +10:00
Peter Hutterer
f0aceb7a88 Add a gitignore file for the subprojects directory 2023-02-02 15:16:55 +10:00
Peter Hutterer
e515edafa5 ei: re-order a few arguments to match the order in the protocol
No functional changes
2023-02-01 12:52:34 +10:00
Peter Hutterer
affc464caa util-time: fix the us2ms function
Turns out this was converting in the wrong direction and the only call
site we had didn't notice/care.
2023-02-01 12:52:34 +10:00
Peter Hutterer
642e258ecb Format python files with black
And set up a gitlab ci job to check that
2023-02-01 11:48:53 +10:00
Peter Hutterer
857735fe7f gitlab-ci: add one more explanatory comment
Just so the CI is a bit easier to understand
2023-01-06 10:23:51 +10:00
Peter Hutterer
e02cb8a015 gitlab CI: replace meson-build.sh with a more generic one
Copied from libinput, also used by libevdev these days.
2023-01-06 10:04:01 +10:00
Peter Hutterer
fde1424a42 gitlab CI: move default_artefacts to the default build template
No point having this as a separate template when the default build
template controls how things are built...
2023-01-06 10:04:01 +10:00
Peter Hutterer
19b4320594 gitlab CI: switch the ci-fairy job to the fdo ci-fairy image 2023-01-06 10:04:01 +10:00
Peter Hutterer
c3b250ba2e gitlab CI: compress the file inclusion a bit
Just make it a bunch of files from a single project, rather than one
project each per file.
2023-01-06 09:56:12 +10:00
Peter Hutterer
42dbcf59c9 gitlab CI: drop the container clean stage
We don't have scheduled rebuilds so the containers build need to hang
around since they're almost certainly in use. Container expiry is
handled site-wide now anyway.
2023-01-06 09:56:12 +10:00
Peter Hutterer
528f6d4d4b gitlab CI: drop the reference to the forced container rebuild
Copy/paste from libinput where most of this came from, we've never had
forced container rebuilds in libei.
2023-01-06 09:17:50 +10:00
Peter Hutterer
c29b65eaf6 meson.build: add override_dependencies for all our libraries
This makes it easier to use libei as a subproject.
2022-12-12 09:07:24 +10:00
Peter Hutterer
7e058b3fa8 libei 0.4.1 2022-12-09 20:08:01 +10:00
Peter Hutterer
ddd704d6e8 libei 0.4 2022-12-09 13:32:29 +10:00
Olivier Fourdan
39f3ec007b liboeffis: protect from interrupted system calls
In various places, including the DBUS calls which can take some time, if
a SIGALRM triggers, the call will fail.

To prevent this from happening, use the wrappers when possible and make
sure to block the SIGALRM signal when issuing DBUS calls.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2022-12-08 12:37:46 +10:00
Olivier Fourdan
8bcbc53c0f ei: Use the signal protected wrappers
To prevent against unexpected interrupted system calls.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2022-12-08 12:37:46 +10:00
Peter Hutterer
1991b8f52d util: change the signal handler to a context-manager like macro
Change the signal-blocking helper to take a vararg list of signals to
block and provide a magic macro that works like python's context
manager, using  attribute(cleanup).

In our for loop we create a new struct with the old sigmask and a
boolean that's always true. We enter the body of the loop once and
set that boolean to false on the second run, i.e. we never do more than
one run. On loop exit, the destroy function for our struct restores the
previous signal mask.
2022-12-08 12:37:46 +10:00
Olivier Fourdan
0d3a398fee util: Add a wrapper for dup() and pipe2()
The wrappers take care of blocking the SIGALRM signal.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2022-12-08 12:37:46 +10:00
Olivier Fourdan
0ac9b1b02d util: Protect system calls against signals
Most system calls will fail if interrupted by a SIGALRM. Make sure we
block SIGALRM prior to do the syscall, and restore the set of signals
afterwards.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2022-12-08 12:37:46 +10:00
Olivier Fourdan
085f96c3bb util: Add block/release signals API
Add a couple of simple helper functions to block and releaset he SIGALRM
signal.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2022-12-08 12:37:46 +10:00