Commit graph

122 commits

Author SHA1 Message Date
Peter Hutterer
d55da9466c meson.build: apply consistent indentation
Mostly whitespace changes, the non-whitespace ones are adding trailing
commas on last arguments and moving the closing ) into a separate line
for multiline function calls.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/364>
2025-11-06 10:56:01 +10:00
Peter Hutterer
19b6453540 libei 1.5.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-08-26 11:25:18 +10:00
Peter Hutterer
9e0413cbc7 libei 1.4.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-04-01 13:52:48 +10:00
Peter Hutterer
5d6d8e6590 libei 1.4.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-02-12 13:05:24 +10:00
Peter Hutterer
d25ceaff98 libei 1.4 RC1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-02-03 13:33:25 +10:00
Peter Hutterer
247b6acd3c meson.build: allow disabling libei and libeis
This is primarily a development feature because it makes it easier to
develop a new feature for just one library without having to worry
about build errors in the other library (e.g. when new protocol parts
are added).

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/310>
2024-12-02 00:23:14 +00:00
Peter Hutterer
0770fec433 Drop black, switch to ruff format 2024-10-17 16:18:51 +10:00
Peter Hutterer
997b7c0f37 libei 1.3.0 2024-08-08 10:18:24 +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
Peter Hutterer
08f1d41085 libei 1.2.1 2024-02-05 13:33:04 +10:00
Peter Hutterer
4936316884 libei 1.2.0 2023-12-06 08:19:00 +10:00
Peter Hutterer
82cdbc9129 libei 1.1.0 2023-09-07 15:07:54 +10:00
Peter Hutterer
8713ef2d63 libei 1.1.0rc1 2023-08-31 14:06:49 +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
a75828aee0 meson.build: drop requirements back to 0.56
The bump to 0.60 was required for 2a2c4cdd but is no longer required
after 27ff400b.
2023-05-24 08:16:29 +10:00
Peter Hutterer
93fd69cdf3 libei 1.0.0rc2 2023-05-23 14:50:33 +10:00
Jan Beich
27ff400bc2 meson: allow selecting sd-bus library via option
Roughly based on https://github.com/swaywm/sway/commit/fdbe98512a71

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-05-18 22:55:18 +00:00
Jan Beich
2a2c4cdd49 meson: depend on elogind or basu if systemd is missing
systemd isn't portable to non-Linux. However, sd-bus API was extracted
into a standalone library that works on BSDs.
2023-05-18 04:25:44 +00:00
Jan Beich
35e7ad9717 meson: depend on epoll-shim for BSDs
src/util-sources.c:29:10: fatal error: 'sys/epoll.h' file not found
 #include <sys/epoll.h>
          ^~~~~~~~~~~~~

ld: error: undefined symbol: epoll_ctl
>>> referenced by util-sources.c:76 (src/util-sources.c:76)
>>>               libutil.a.p/util-sources.c.o:(source_remove) in archive src/libutil.a
>>> referenced by util-sources.c:200 (src/util-sources.c:200)
>>>               libutil.a.p/util-sources.c.o:(sink_add_source) in archive src/libutil.a

ld: error: undefined symbol: epoll_create1
>>> referenced by util-sources.c:152 (src/util-sources.c:152)
>>>               libutil.a.p/util-sources.c.o:(sink_new) in archive src/libutil.a

ld: error: undefined symbol: epoll_wait
>>> referenced by util-sources.c:169 (src/util-sources.c:169)
>>>               libutil.a.p/util-sources.c.o:(sink_dispatch) in archive src/libutil.a
2023-05-18 04:15:36 +00:00
Jan Beich
53482faa57 meson: depend on math library for BSDs
ld: error: undefined symbol: __isnormal
>>> referenced by util-strings.h:243 (src/util-strings.h:243)
>>>               test/unit-tests-utils.p/.._src_util-strings.c.o:(xatod)
2023-05-18 04:15:36 +00:00
Peter Hutterer
df268d618a libei 1.0.0rc1 2023-05-17 12:28:12 +10:00
Peter Hutterer
e130c9aeb1 meson.build: add soname versions to the generated libraries
Our soname tracks the library version, even though on Linux only the
first number is actually being used. The rest is just to make it easier
for tools to find the right version. So let's do that.

And until the 1.0 version is out and our library ABI is stable, hardcode
to 1.0.0

This commit also moves the header define up for better grouping.
2023-05-09 00:52:43 +00:00
Peter Hutterer
40ba30da82 meson.build: install our headers into a versioned subfolder
This makes it possible to have multiple (incompatible) versions
installed simultaneously.

Any incompatible version requires us bumping the major version, so our
headers are simply installed into the hardcoded libei-1.0 subdir.

This also changes the pkgconfig names to include the API version, so
it's now `pkgconfig --cflags libei-1.0`.
2023-05-08 14:33:50 +10:00
Peter Hutterer
1a4764d99b libei 0.5 2023-04-06 14:19:22 +10:00
Salman Malik
a438e46e18 config: Make memfd_create optional
`memfd_create` doesn't seem to be supported on
all platforms (e.g. ubuntu 18 has trouble with it).
Even though, I was able to substitute `memfd_create`
with a direct system call, I was not able to get
the `MFD_CLOXEC` flag (from fcntl.h) working cleanly
(there were redefinitions/conflicts for other
structures when trying to use <linux/*> headers).
Making it optional for time being till we have
figured out how to make it work broadly.
2023-03-28 11:24:06 +00:00
Peter Hutterer
a95c9e1799 meson: drop version requirement to 0.56 so we can build on Bullseye
Looks like the only more recent meson feature we use is for
'exclude_suites' in the valgrind test setup. We can just skip that.
2023-03-19 07:56:09 +00:00
Peter Hutterer
8954d96227 Remove empty trailing newlines from all files 2023-03-13 08:52:08 +10:00
Peter Hutterer
30aab5179e Merge branch 'main' into wip/drop-protobuf 2023-03-07 12:55:18 +10:00
Peter Hutterer
367fa6384f test: fix the LD_LIBRARY_PATH to liboeffis
Make this dependent on liboeffis directly instead of hardcoding where it
should be.
2023-03-07 11:54:10 +10:00
Peter Hutterer
a2e60be0e6 meson: fix a typo 2023-03-07 11:50:09 +10:00
Peter Hutterer
25e36eb24e meson: move the "build this?" checks into the subdirs
Let's decide on what to build in the doc/ and test/ directory rather
than in the main file.
2023-03-07 11:10:06 +10:00
Peter Hutterer
7810be8a80 meson: split into separate meson.build files for src/tools 2023-03-07 11:10:06 +10:00
Peter Hutterer
c350ac2ee3 src: pass the headerfile as jinja extra data
This removes another special handling of the C bindings from the
scanner.
2023-03-03 11:38:40 +10:00
Peter Hutterer
ba8bead183 meson.build: add black and ruff checks to the test suite
We still have the separate CI jobs for those (for better visibility) but
also optionally incorporate those into the meson test run.

Both calls only check the files, they do not modify anything.
2023-03-03 11:27:01 +10:00
Peter Hutterer
35f5fa102c proto: rename ei_connection_setup to ei_handshake
This is a better name for the initial handshake and easier to
distinguish from the ei_connection this way too.

Suggested by Jonas Ådahl.
2023-03-03 11:27:01 +10:00
Peter Hutterer
3fa396c012 test: add a framework for doing protocol tests directly
This tests the protocol layer which is hard to test using libei/libeis.
Similar to the generated C bindings we compile a eiproto.py file that is
then used in the test to talk protocol directly to the eis-demo-server
that we start up.

By sending the specific messages and checking things happen as we expect
on the socket we can verify that the EIS implementation is correct (and
robust enough).

In theory this could also be used to test some other binary with an EIS
implementation and the scaffolding is there to set LIBEI_TEST_SERVER to
that binary. Wether this works is untested though...
2023-03-03 11:27:01 +10:00
Peter Hutterer
579f0d07d2 Add a brei-proto.h generated header file
This will be needed to have access to the various disconnect reasons in
brei-shared.c.
2023-03-03 11:21:26 +10:00
Peter Hutterer
7a2629fe42 meson.build: drop the protocol version
This is no longer applicable now that we have interfaces of varying
versions.
2023-03-03 11:21:26 +10:00
Peter Hutterer
273eda39ca Move the C proto templates to the src directory
These are very specific to libei/libeis, so let's not leave them
somewhere where they look like official bindings or something.
2023-03-03 11:21:26 +10:00
Peter Hutterer
6ed610e30e Split the ping/pong request into its own interface
Leave the ei_callback as-is and instead add ei_pingpong for the same
thing initiated by the server. The interface is otherwise identical but
for the direction it is supposed to flow.

This reduces the possibility of a client accidentally sending a
request when it is supposed to handle an event or vice versa.
2023-03-03 11:21:26 +10:00
Peter Hutterer
4d9ca1796d protocol: move pointer/keyboard/touch into separate interfaces
This allows us to have a device support multiple interfaces and evolve
those interfaces individually, e.g. add things to the keyboard interface
without having to bump the touchscreen interface.

Note that due to a name clash with the existing struct ei_touch public
API the protocol interface is named touchscreen.
2023-03-03 11:21:26 +10:00
Peter Hutterer
db786c7822 protocol: add a ei_connection_setup interface
This replaces the connect/connect_done and version/get_version requests.
Immediately after connecting, the server sends an ei_protocol_setup
event to the client with the ID of the object and the server's highest
supported version number (of this object).

This is a one-shot object that the client can use to configure its name
and whether it is a sender or receiver context. Once .done is sent, the
object is discarded.

The server version is sent along to the client to allow for requests to
be added to this object in the future.

As a fixme left: the client now assumes to be connected as soon as the
.done request is sent and the following sync event is received. The
EIS implementation will not have actually eis_client_connect()ed the
client yet, but it's good enough for now.

Arguably, the CONNECTED event is superfluous anyway since *any* event
other than DISCONNECTED indicates connected status. CONNECTED is a
leftover from when the client created devices and needed to know if it's
worth doing so.
2023-03-03 11:20:42 +10:00
Peter Hutterer
9cbce95326 protocol: add a sync request and the ei_callback interface
Directly copied from wayland. Note that while the wayland protocol
specifies the data is the last event serial in our case here it's just
0 since we don't have any event serials (yet).

The sync request is currently triggered after connection, merely to
ensure it works, it's not actually needed.
2023-03-03 11:20:42 +10:00
Peter Hutterer
d0e6c251b6 protocol: rename the ei core interface to ei_connection
In the protocol this is a simple rename but in the implementation we can
now separate the protocol object out from the ei/ei-client context
itself by having the ei_connection objects.
2023-03-03 11:20:42 +10:00
Peter Hutterer
b02b4f0901 Drop protobuf in favour of a custom protocol
This protocol is wayland-like though it uses a slightly different
message format. The XML file uses the same structure, except for the
"fixed" type which is "float" here.

The scanner uses a jinja template to generate source and header files
for ei and eis which are now used instead of the protobuf-generated
objects. Note that the scanner is a minimal working version, some
features like enum value checks are not yet implemented.

Unlike wayland we do not need to generate the libwayland-like library,
we only need the wire protocol parser - some shortcuts can thus be taken.

To keep the changes simple, the protocol currently is a flat protocol
with only one interface and all messages copied over from the previous
ei.proto file. In future commits, this will be moved to the respective
interfaces instead.
2023-03-03 11:20:42 +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
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
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