Commit graph

29 commits

Author SHA1 Message Date
Peter Hutterer
5ee9f738a8 proto: document what a "protocol violation" means 2023-03-03 11:21:26 +10:00
Peter Hutterer
027f85e195 proto: switch connection_setup.version to mirror interface_version requests
For most interfaces, the client announcing its supported version is
sufficient - the objects are all created server-side. For some
interfaces (ei_connection_setup and ei_callback right now) the client
needs to know the server-supported version.

So let's switch the current ei_connection_setup.version event (used to
negotiate ei_connection_setup's version) to a generic
`interface_version` event. This way our EIS implementation can
eventually send a version for ei_callback as well.
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
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
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
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
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
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
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
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
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
a778a22e26 protocol: add an interface version announcement to the connection setup
The idea here is that the client announces the interfaces it can support
and their version (including the core ei_connection). The server can
then send the various bits based on those versions, where applicable.
2023-03-03 11:20:42 +10:00
Peter Hutterer
09826b8bd3 eis: add a reason to the disconnect message
Allows for slightly easier debugging in the case where we get
disconnected after some protocol error.
2023-03-03 11:20:42 +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