From eaefaecdd0ef93546b0adebd8887fdcdad4e398e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 17 Aug 2021 16:08:04 +1000 Subject: [PATCH] eis: fix the seat assignment We're using the upper bits for seats, just adding 1 clashes with the device ids. Signed-off-by: Peter Hutterer --- src/libei.c | 2 +- src/libeis-seat.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libei.c b/src/libei.c index c5f60f7..7c8afd2 100644 --- a/src/libei.c +++ b/src/libei.c @@ -391,7 +391,7 @@ handle_msg_device_added(struct ei *ei, uint32_t deviceid, uint32_t seatid, * won't know which unless we keep some device ID table. Not worth * it, so just silently ignore */ if (ei_seat_find_device(seat, deviceid)) { - log_error(ei, "Server sent duplicate device id %d\n", deviceid); + log_error(ei, "Server sent duplicate device id %#x\n", deviceid); return -EINVAL; } diff --git a/src/libeis-seat.c b/src/libeis-seat.c index ca11c0e..f2e104d 100644 --- a/src/libeis-seat.c +++ b/src/libeis-seat.c @@ -64,10 +64,11 @@ eis_seat_get_client(struct eis_seat *seat) _public_ struct eis_seat * eis_client_new_seat(struct eis_client *client, const char *name) { - static uint32_t seatid = 0x10000; /* we leave the lower bits to the deviceids */ + static uint32_t seatid; struct eis_seat *seat = eis_seat_create(&client->object); - seat->id = seatid++; + /* we leave the lower bits to the deviceids */ + seat->id = ++seatid << 16; seat->state = EIS_SEAT_STATE_PENDING; seat->name = xstrdup(name); list_init(&seat->devices);