Commit graph

652 commits

Author SHA1 Message Date
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
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
Peter Hutterer
49c329e0de util-io: add a few helper functions to iobuf
Currently unused, but will be in the future
2023-03-03 11:20:42 +10:00
Peter Hutterer
f5e3177f27 ei-device: use the setter declaration macros 2023-03-03 11:20:42 +10:00
Peter Hutterer
ba55bef917 Add ei/eis getters for the device id 2023-03-03 11:20:42 +10:00
Peter Hutterer
e3c34830db ei: rename ei_set_connection to ei_set_socket
Current plans are to use the "connection" term for the ei_connection
interface in the (future) protocol, so let's rename this to avoid
clashes.
2023-03-03 11:20:42 +10:00
Peter Hutterer
1ddf8058e6 util: mmap with MAP_PRIVATE instead of MAP_SHARED
Our only use-case where we use this utility is for keymaps. Those have
to be MAP_PRIVATE in wayland's wl_seat version 8 so let's do the same to make
make sure we're compatible.
2023-03-03 11:16:48 +10:00
Peter Hutterer
d95c1d30f8 util: add some mask helpers 2023-03-03 11:16:48 +10:00
Peter Hutterer
e74e0d1c18 eis: use eis_client_get_context instead of parent 2023-03-03 11:16:48 +10:00
Peter Hutterer
7509ee257f libeis: make eis_client_get_context() part of the public API
So we don't need to carry two pointers around in the caller.
2023-03-03 11:16:48 +10:00
Peter Hutterer
c5ebd345fd tools: copy the default log handler to the eis demo server
The default log handler logs to stderr, but we want stdout here to have
it intermixed with our real log messages (easier to debug this way).
Would probably be better to have this somewhere shared but for now this
will do.
2023-03-03 11:16:48 +10:00
Peter Hutterer
f300a4919a util: add msleep() 2023-03-03 11:16:48 +10:00
Peter Hutterer
1748ddaf3d eis: don't EINVAL if a coordinate is outside the region
From the documentation:
"The x/y coordinate must be within the device's regions or the event is
silently discarded."

libei discards it but if it somehow makes it through anyway, let's
discard it again.
2023-02-23 16:01:47 +10:00
Peter Hutterer
e93ad6925c test: set the minimum bits for our test devices
size is required for phys devices and in the future libei will reject
devices with no useful capabilities.
2023-02-20 15:43:22 +10:00
Peter Hutterer
866a754223 ei: implement ei_device_get_width/height 2023-02-20 15:42:56 +10:00
Peter Hutterer
17dfb4580d util: rename xvasprintf to xvaprintf
This doesn't printf into a buffer, so let's rename it
2023-02-16 15:29:18 +10:00
Peter Hutterer
6096a20964 CI: fix typo in the package list
Fixes 1153368946
2023-02-15 16:14:59 +10:00