Original idea of 1/1000 of a pixel was to allow subpixels while sending fixed
width down the wire. Let's not care about that and use doubles instead.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Having to define a separate name and test function for each test is annoying.
The unit-tests can leak the tests names anyway, so let's shortcut this with a
macro.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
There's relatively little benefit here since we won't have a lot of different
events and any caller will do the switch based on the event type anyway.
So let's just export a single event type and have everything contained in
that.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
On error, we call eis_client_disconnect() which unrefs the client. Since we're
using it afterwards for debugging logs, we need to keep at least one ref
going.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Short story, we can't do it but it's simple enough to work around in the
caller so let them do it.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
We can remove those when we have a working implementation, for now it's too
painful to debug when an exchange doesn't work for some reason.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Makes it easier to distinguish between ei and eis when everything in the tests
is just printed to stderr anyway.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
The protocol itself could work like originally described here but there's a
stumbling block: the decision on whether to accept a device is made by the
caller through EIS_EVENT_DEVICE_ADDED and the following eis_device_connect()
call. We cannot process any events from that device until that call is
complete and that effectively disallows batch submission of requests.
To allow batching we'd have to pause the protocol but that means missing out
on other devices (and their events) and disconnect events. The alternative to
that would be for libeis to peek at incoming requests and sort them by device
ID so we only pause one device's stream but now we're also mangling the device
event order and potentially triggering all sorts of side-effects.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
SOCK_DGRAM gives us free message framing but the sockets we'll likely deal
with (or at least *have* to handle) are stream. This was a leftover anyway
from some debug testing.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
For the Portal case, we'll have the portal open the sockets for us and then
(depending on policy) restrict what the client can do. Then the socket can be
passed to the client with e.g. keyboards disabled and the client is none the
wiser (other than that the server will reject any keyboard caps).
Since the portal doesn't need a EI context, the configuration is a separate
small library.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
NEW means "client has sent request" which means we have a ref to it internally
and we have to disconnect it accordingly.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
The main purpose of that was for (plain-text protocol) debugging. With the
current intentions to "preload" a connection with restrictions, having the
server initiate a connection is not useful.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This is a more explicit API that makes it more obvious where the ref/unref
calls need to go. The sink now has two refs to the sources as well (epoll data
pointer and the list) which means a caller cannot just source_unref() anymore
without removing a source. Since this is how we've been using it anyway - meh.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Avoid valgrind complaining about memleaks - disconnecting the clients on the
final unref queues emulated events so let's make sure we get rid of those.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
We don't want valgrind to complain about leaks when we only handle a portion
of the events on the socket.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>