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
Peter Hutterer
0e70d06706
scanner: comments and some more type annotations
2023-03-03 11:27:01 +10:00
Peter Hutterer
72c570e096
scanner: pass the Enum to the Entry class
...
So we can compose the fqdn (and possibly do value checks and whatnot)
2023-03-03 11:27:01 +10:00
Peter Hutterer
1c9ce9b680
Add serial numbers to the protocol
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-03 11:27:01 +10:00
Peter Hutterer
845f990883
protocol: change the context type enum to start at 1
...
This avoids future bugs for treating this as a boolean field.
2023-03-03 11:27:01 +10:00
Peter Hutterer
30c4b8d528
protocol: a few more minor comments
2023-03-03 11:27:01 +10:00
Peter Hutterer
403e40597d
Replace remaining errno-based errors to proper brei_results
2023-03-03 11:27:01 +10:00
Peter Hutterer
a6565fd86b
brei: change the various errors to PROTOCOL
2023-03-03 11:27:01 +10:00
Peter Hutterer
cc7a8cb95e
ei: make more ei_queue* functions semi-public for consistency
...
And drop the ei_add_seat() indirection.
2023-03-03 11:27:01 +10:00
Peter Hutterer
03d7f96ddd
eis: remove some indirection from the device event handling
...
Now that we only have one nice hook as entry point for those events,
let's move (and harden) the code there.
2023-03-03 11:26:51 +10:00
Peter Hutterer
876e4044ab
eis: error out if we're in the wrong state to start/stop emulating
2023-03-03 11:22:09 +10:00
Peter Hutterer
83b4902d9f
ei: error out if we're in the wrong device state for emulating
2023-03-03 11:22:09 +10:00
Peter Hutterer
d698ed2f75
ei: remove some indirection from device events
...
Now that we only have one nice hook as entry point for those events,
let's move (and harden) the code there.
2023-03-03 11:22:09 +10:00
Peter Hutterer
1846223991
eis: add eis_client_disconnect_with_reason
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-03 11:22:09 +10:00
Peter Hutterer
8a2dd03a3f
ei: reject a device with capabilities unknown to us
...
Untested because we cannot really trigger this code path with libeis.
2023-03-03 11:22:09 +10:00
Peter Hutterer
1a21c4854b
ei: better protocol checking for invalid messages
2023-03-03 11:22:09 +10:00
Peter Hutterer
dd5bc6b6e7
proto: add a bunch of error reasons for debugging
2023-03-03 11:22:09 +10:00
Peter Hutterer
55a12f5cae
Remove unused macro
2023-03-03 11:22:09 +10:00
Peter Hutterer
e67a0a7777
brei: add the brei_result object and bubble it up as error case
...
Add a new simple object "brei_result" that maps to the protocol-type
reason + explanation. That object is now returned instead of the errno,
giving us better debugging options.
This changes the dispatcher functions from returning an int to returning
a brei_result instead (default NULL for success). A helper function for
converting a neg errno to a result is provided for convenience for now,
eventually all these paths should deal with things correctly.
2023-03-03 11:22:08 +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
5631b54b96
eis: pass the disconnect reason around when disconnecting a client
...
No real functional changes right now, but allows for future multiple errors
2023-03-03 11:21:26 +10:00
Peter Hutterer
8a52cbbe10
scanner: detect duplicates in the XML file
2023-03-03 11:21:26 +10:00
Peter Hutterer
5ee9f738a8
proto: document what a "protocol violation" means
2023-03-03 11:21:26 +10:00
Peter Hutterer
e07d4638d5
scanner: drop the Argument.argtype in favour of DBus-type bindings
...
This was a brei-specifc implementation detail that is not really needed,
we can use the single-character dbus-style bindings.
2023-03-03 11:21:26 +10:00
Peter Hutterer
f500a1cd43
scanner: expand the help description
2023-03-03 11:21:26 +10:00
Peter Hutterer
1e4d273cd4
scanner: add the "camel" jinja filter
...
For conversion into CamelCase
2023-03-03 11:21:26 +10:00
Peter Hutterer
8979802893
scanner: rename to ei-scanner
2023-03-03 11:21:26 +10:00