From e0d0c1af6192ecedf955a3df3e1ca2b58fac0727 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 14 Feb 2023 13:13:50 +1000 Subject: [PATCH] eis: require ei_seat and ei_devices A client that skips on announcing those will get connected and immediately disconnected again. There's no point to libei if you support neither of those (at least for now). --- src/libeis-connection-setup.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/libeis-connection-setup.c b/src/libeis-connection-setup.c index 3f09aab..60b9ca1 100644 --- a/src/libeis-connection-setup.c +++ b/src/libeis-connection-setup.c @@ -99,11 +99,18 @@ client_msg_done(struct eis_connection_setup *setup) eis_connection_setup_event_connection(setup, eis_connection_get_id(client->connection), eis_connection_get_version(client->connection)); - client->setup = eis_connection_setup_unref(setup); + /* These aren't required but libei is pointless without them, so let's enforce them + * by establishing the connection and immediately sending the disconnect */ + if (setup->client_versions.ei_seat == 0 || + setup->client_versions.ei_device == 0) { + eis_client_disconnect(client); + } else { + /* Force a ping/pong. This isn't necessary but it doesn't hurt much here + * and it ensures that any client implementation doesn't have that part missing */ + eis_connection_ping(client->connection, pong, NULL); + } - /* Force a ping/pong. This isn't necessary but it doesn't hurt much here - * and it ensures that any client implementation doesn't have that part missing */ - eis_connection_ping(client->connection, pong, NULL); + client->setup = eis_connection_setup_unref(setup); return 0; }