Commit graph

802 commits

Author SHA1 Message Date
Peter Hutterer
960bb6db26 util: add a strlen0 helper function
Same as strlen() + 1, but handles NULL and avoids typos by forgetting
the +1 in all the sites we need to call it.
2023-03-03 11:27:01 +10:00
Peter Hutterer
0ef1bb95d4 ei: remove obsolete device->id 2023-03-03 11:27:01 +10:00
Peter Hutterer
c998bae33f Remove obsolete declaration 2023-03-03 11:27:01 +10:00
Peter Hutterer
1e0796f432 Remove now-obsolete proto files 2023-03-03 11:27:01 +10:00
Peter Hutterer
b309798bf1 Switch object ids to use the object_id_t typedef 2023-03-03 11:27:01 +10:00
Peter Hutterer
2e1babbb84 test: simplify results handling in the python tests
No point appending the message header components to the results when we
just ignore them later anyway.
2023-03-03 11:27:01 +10:00
Peter Hutterer
8ea6b81f40 Change the ei_device_capability values to match the protocol
In the protocol this is a bitmask, let's make it the same in the
interface to avoid confusion in the implementation.
2023-03-03 11:27:01 +10:00
Peter Hutterer
2338e19aab ei: correct arguments to the invalid object log message 2023-03-03 11:27:01 +10:00
Peter Hutterer
c832ce3ddc protocol: split the handshake version negotiation from the other interfaces
Previously, we'd send one interface_version event for "ei_handshake"
immediately but all others after the client requests handshake.finish.
This was too confusing to document and not clear how it would work, so
let's make this simpler by splitting it up.

There is now a handshake_version event from the server, sent immediately
on connection that denotes the maximum version number for the interface.
And a handshake_version request from the client which must be the first
one by the client.
2023-03-03 11:27:01 +10:00
Peter Hutterer
8b484c8dc2 editorconfig: add XML 2023-03-03 11:27:01 +10:00
Peter Hutterer
5d7f6ab188 protocol: more clarifications 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
f9446e8c02 test: strip all trailing zeroes from the protocol strings
This code worked because the only string we compared against was
"ei_connection_setup" which is 19 actual bytes.
2023-03-03 11:27:01 +10:00
Peter Hutterer
2aaf7acdfc test: fix a ruff warning - f-string without placeholder 2023-03-03 11:27:01 +10:00
Peter Hutterer
705c5d79ac test: remove unused python import 2023-03-03 11:27:01 +10:00
Peter Hutterer
38dc5dc72f proto: shift the capabilities down by one
These were previously (1 << cap) for convenience but that results in the
capability mask on the wire starting at 2 - which is a bit awkward.

Lets shift them down by one so we start the mask at 1.
2023-03-03 11:27:01 +10:00
Peter Hutterer
ae8faa9fbb proto: improve the documentation
After some feedback from Jonas Ådahl and Julan Orth.
2023-03-03 11:27:01 +10:00
Peter Hutterer
11fb722e63 proto: fix wrong references to ei_callback in the pingpong interface 2023-03-03 11:27:01 +10:00
Peter Hutterer
47467bfe0e proto: rename connection_setup.done to .finish
Avoids ambiguity with the .done events from e.g. the seat or the device.
2023-03-03 11:27:01 +10:00
Peter Hutterer
0897722493 proto: drop the seat caps and cross-reference device caps instead 2023-03-03 11:27:01 +10:00
Peter Hutterer
1db37c33d5 scanner: allow for cross-referencing enums
Add another run to the XML parser so we parse enums before Arguments
that cross-reference enums from other interfaces.

This also fixes a type bug - the enum name string was passed to
Argument.create() as Enum and no-one noticed.
2023-03-03 11:27:01 +10:00
Jonas Ådahl
eecf69af48 protocol: Make timestamps a single 64 bit argument
With 64 bit integers on the wire, we don't need to split timestamps in
milliseconds and microsecond parts.
2023-03-03 11:27:01 +10:00
Jonas Ådahl
03c0ab73dd protocol: Add support for 64 bit integers on the wire
This is useful for e.g. not having to split timestamps.
2023-03-03 11:27:01 +10:00
Jonas Ådahl
e4f23f69fc demos: Print timestamp 2023-03-03 11:27:01 +10:00
Jonas Ådahl
cad5bc81bb protocol: Make integer explicitly sized
This means 'int' is explicitly 'int32' and 'uint' is explicitly
'uint32' in the protocol XML files.
2023-03-03 11:27:01 +10:00
Peter Hutterer
312ce6723b CI: run pytest as separate job
Because we currently only run the test suite in valgrind, we skip the
python test suite there (we don't want to valgrind python itself, too
messy).

Fix this by specifically excluding the python test suite and having a
separate job that just runs that suite instead.

And because the protocol test suite needs the directory to the
eis-demo-server and isn't smart enough to split spaces correctly, let's
change the builddir to just that.
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
d319c3a725 protocol: rename "type" arguments and events
Type is a reserved keyword in many languages, let's make this easier for
those.
2023-03-03 11:27:01 +10:00
Peter Hutterer
658a861c2a proto: add a serial number to the modifiers event 2023-03-03 11:27:01 +10:00
Peter Hutterer
36a3fd0166 meson: hook up a dtd check via xmllint 2023-03-03 11:27:01 +10:00
Peter Hutterer
b7ac763241 protocol: change type=bitmask to use the wayland protocol's bitfield=true 2023-03-03 11:27:01 +10:00
Peter Hutterer
5c860507e5 protocol: more explanations 2023-03-03 11:27:01 +10:00
Peter Hutterer
2227690287 scanner: parse the copyright tag 2023-03-03 11:27:01 +10:00
Peter Hutterer
8692e2592a scanner: use the proper SAXException class
The one we get is an internal subclass, let's not do that.
2023-03-03 11:27:01 +10:00
Peter Hutterer
7ad74b9886 scanner: fix mypy errors 2023-03-03 11:27:01 +10:00
Peter Hutterer
5f69ee2417 proto: switch to use the Wayland message header
No real functional changes, this just changes the message header to be
header = [object_id, msglen << 16 | opcode].

The only difference to the wayland protocol is now the fixed vs float
but otherwise tools that can print/debug/mangle the wayland protocol
should be easily adjustable for this protocol too..
2023-03-03 11:27:01 +10:00
Peter Hutterer
30b9fec787 util: add iobuf_prepend() 2023-03-03 11:27:01 +10:00
Peter Hutterer
b5805c3e8a protocol: improve a comment 2023-03-03 11:27:01 +10:00
Peter Hutterer
e5948856bf CI: explicitly add the ei-scanner to the Python Black run
Without the file ending in .py, it won't be checked anymore.
2023-03-03 11:27:01 +10:00
Peter Hutterer
e592a3d85a scanner: fix a few black complaints 2023-03-03 11:27:01 +10:00
Peter Hutterer
c8986b88ba scanner: parse the descriptions as well 2023-03-03 11:27:01 +10:00
Peter Hutterer
164b2c0c00 doc: add generated BREI documentation 2023-03-03 11:27:01 +10:00
Peter Hutterer
e5b37dedc8 protocol: add serial numbers to the various destroy events
This should allow EIS to track whether events that were sent before or
after a destruction of a resource.
2023-03-03 11:27:01 +10:00
Peter Hutterer
cebf4ce048 protocol: correct some comments 2023-03-03 11:27:01 +10:00
Peter Hutterer
cc0a06aed6 scanner: rename to as_c_arg and c_type for the c-specific functions 2023-03-03 11:27:01 +10:00
Peter Hutterer
4293f2f040 scanner: factor out the protocol type mapping to be global 2023-03-03 11:27:01 +10:00
Peter Hutterer
5e6e4d8fc9 scanner: separate the parser from the actual protocol
Let's not leak anything related to XML parsing into the class
we use as the actual protocol description.
2023-03-03 11:27:01 +10:00
Peter Hutterer
4414c91fca scanner: rename run to run_counter 2023-03-03 11:27:01 +10:00
Peter Hutterer
3499d26300 scanner: slightly clean up the XML error handling
Slight improvement in the code, nothing more.
2023-03-03 11:27:01 +10:00
Peter Hutterer
381bc9222a scanner: don't allow incoming/outgoing for modes other than ei/eis
We support mode "brei" now but that doesn't have a definition of incoming or
outgoing.
2023-03-03 11:27:01 +10:00