Commit graph

673 commits

Author SHA1 Message Date
Peter Hutterer
0dba8769d4 ei: remove unused server_version and client_version fields 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
29cf354de6 scanner: drop the Target class, push to templates
The Target was specific to libei/libeis, it resolved to "ei" or
"eis_client" depending on which component we were building. But that's
specific to our C implementation here, so let's push it into our C
implementation templates.
2023-03-03 11:21:26 +10:00
Peter Hutterer
e0d0c1af61 eis: require ei_seat and ei_devices
A client that skips on announcing those will get connected and
immediately disconnected again. There's no point to libei if you support
neither of those (at least for now).
2023-03-03 11:21:26 +10:00
Peter Hutterer
df99fc923b proto: if the target object no longer exists, don't send events/requests 2023-03-03 11:21:26 +10:00
Peter Hutterer
86dced2c40 eis: make ei_connection/callback/pingpong required interfaces
v1 of ei_connection requires callback and pingpong, so let's make all
three required and disconnect a client that doesn't support those.
2023-03-03 11:21:26 +10:00
Peter Hutterer
a80b19bb2c eis: immediately disconnect a client without the ei_connection interface
No point going through the setup here, just disconnect immediately.
2023-03-03 11:21:26 +10:00
Peter Hutterer
619b83220d eis: drop the device->id now that it's all protocol-wrapped 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
f41cc91599 proto: add a ping/pong request
This is effectively the same as connection.sync, but goes the other way.
This adds the ei_callback.done request.

In libeis this is (currently) enforced immediately after sending the
connection object. Not required there and makes the code a bit messier
but this way we can ensure that any client library handles that part of
the code.
2023-03-03 11:21:26 +10:00
Peter Hutterer
50013b4b3c protocol: fix a typo 2023-03-03 11:21:26 +10:00
Peter Hutterer
e84ddd1471 eis: drop the seat when the client requests it 2023-03-03 11:21:26 +10:00
Peter Hutterer
b481eff34c eis: only allow the available caps to bind to a seat
A client binding with caps >= the seat's current version will get
disconnected now.
2023-03-03 11:21:26 +10:00
Peter Hutterer
ea8df6402a scanner: handle since tags in enum values 2023-03-03 11:21:26 +10:00
Peter Hutterer
8c85b8fc1f protocol: add ei_connection.invalid_object
This event is to notify the client that an object used in a request was
unknown. This allows the client to work around race conditions like
binding to a seat that was removed.

This is currently the server-side only which is probably enough for now.
The only client-side created objects we have are the callbacks.
2023-03-03 11:21:26 +10:00
Peter Hutterer
f6cfe9803c scanner: make the invalid type message a bit easier to identify 2023-03-03 11:21:26 +10:00
Peter Hutterer
34889d4803 scanner: pass the component through as well
For the cases where we have to add "ei" or "eis" in a random place in
the template.
2023-03-03 11:21:26 +10:00
Peter Hutterer
d84ddd51e5 protocol: complete documentation for the protocol XML file 2023-03-03 11:21:26 +10:00
Peter Hutterer
a590537c8a protocol: mark the various destroyed events as destructors 2023-03-03 11:21:26 +10:00
Peter Hutterer
0a8501d882 protocol: mark the disconnected event as destructor 2023-03-03 11:21:26 +10:00
Peter Hutterer
cfbb906358 protocol: rename type to context_type
type is a reserved keyword in many languages, let's not make this harder
to use than necessary
2023-03-03 11:21:26 +10:00
Peter Hutterer
bf77479c6a protocol: rename the interface request to interface_version
More descriptive this way
2023-03-03 11:21:26 +10:00
Peter Hutterer
9e731ddf04 scanner: parse the type="destructor" attribute on requests/events 2023-03-03 11:21:26 +10:00
Peter Hutterer
2e4d984819 eis: don't send seat events unless the client supports ei_seat 2023-03-03 11:21:26 +10:00
Peter Hutterer
20e425a48d scanner: add the camel_name property to our messages
This allows for templating into EiConnectionSetup and the like
2023-03-03 11:21:26 +10:00
Peter Hutterer
58b430039a eis: destroy the eis_connection immediately after sending disconnect
Requests the client sent on the connection after disconnect
will thus be ignored.
2023-03-03 11:21:26 +10:00
Peter Hutterer
a0b2cfffa9 scanner: switch to a two-run parsing of the XML file
On the first run we extract the interfaces only, on the second run all
the rest. This allows us to pass the interface to the Argument where
appropriate.
2023-03-03 11:21:26 +10:00
Peter Hutterer
21df02e499 protocol: add the "bitmask" enum type and check for it
Plus check for duplicate values in enums
2023-03-03 11:21:26 +10:00
Peter Hutterer
bde838fd1d protocol: rename the touch capability to touchscreen
This matches the interface name now, even though the public API right
now still uses TOUCH
2023-03-03 11:21:26 +10:00
Peter Hutterer
da51bc095f brei: add a brei context object
Having debugging in the brei code is useful, the only way we can do this
is by passing the log handler down.
2023-03-03 11:21:26 +10:00
Peter Hutterer
6721802059 protocol: require the "since" attribute for all messages
And generally improve the error message handling
2023-03-03 11:21:26 +10:00
Peter Hutterer
91ec792d74 scanner: add enum verification checks 2023-03-03 11:21:26 +10:00
Peter Hutterer
8d2da0d857 brei: remove some obsolete functions 2023-03-03 11:21:26 +10:00
Peter Hutterer
df673b140d ei: remove now-unused function 2023-03-03 11:21:26 +10:00
Peter Hutterer
ebefdf903c protocol: document the protocol better 2023-03-03 11:21:26 +10:00
Peter Hutterer
0a347f433f protocol: make the connection setup the zero object with a proper handover
This changes the initial connection negotiation to have the
ei_connection_setup as the pre-existing object id 0. Once the client has
sent all the data to set up the connection, the EIS implementation
replies with a new object ID that is the ei_connection protocol object,
i.e. the main object.

This allows for version negotiation of our main protocol object.
2023-03-03 11:21:26 +10:00
Peter Hutterer
23433d3aff protocol: move the keymap into the keyboard interface 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
e2a45dad38 eis: switch to a goto out approach
Makes the code a bit easier to follow
2023-03-03 11:21:26 +10:00
Peter Hutterer
964bb76c60 protocol: move the frame event into the device interface 2023-03-03 11:21:26 +10:00
Peter Hutterer
3fc1bdf07a protocol: move start/stop emulating into the device 2023-03-03 11:21:26 +10:00
Peter Hutterer
fadc1853c9 protocol: add the ei_device interface
Sitting nested below the ei_seat, the client gets a notification for a
device through the ei_seat.device event.
2023-03-03 11:21:26 +10:00
Peter Hutterer
01a2ff2d72 brei: pass the proto object through to send_message
Makes for easier debugging since we can print names instead of just
ids/opcodes.
2023-03-03 11:21:26 +10:00
Peter Hutterer
2a8661f7ad protocol: move the seat bind to the seat object
Needs documentation but we can do this when we're done with everything.
2023-03-03 11:21:26 +10:00
Peter Hutterer
b9037ed4ff protocol: check any incoming/outgoing messages for versions
Don't let a interface version 2 send version 3 request or receive those
events.
2023-03-03 11:21:26 +10:00
Peter Hutterer
c98a9fc7d7 eis: update libeis-client to use the declare macros 2023-03-03 11:21:24 +10:00
Peter Hutterer
bcece3d3c1 eis: make sure our connection setup has the right version too 2023-03-03 11:20:42 +10:00
Peter Hutterer
aaf72f9263 protocol: add a seat interface
Incomplete, only supports the initial seat setup but binding to a seat
is still outside this interface.
2023-03-03 11:20:42 +10:00
Peter Hutterer
d95236aa3e Add the ei_callback interface versions
We can now bump ei_callback to a higher version if the client supports
it.
2023-03-03 11:20:42 +10:00