From 4505d67bb73c5f1d3a50613fd2755c07e07c5be9 Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Tue, 1 Mar 2022 01:34:12 +0200 Subject: [PATCH] fixed missing cfg protocol handlers (led, grab) --- src/proto.h | 2 ++ src/proto_unix.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/proto.h b/src/proto.h index 3d583ff..f95e4ff 100644 --- a/src/proto.h +++ b/src/proto.h @@ -51,6 +51,8 @@ enum { REQ_GCFG_KBMAP, /* get keyboard mapping: Q[0] bidx - R[0] bidx R[1] keysym R[6] status */ REQ_SCFG_LED, /* set LED state: Q[0] state - R[6] status */ REQ_GCFG_LED, /* get LED state: R[0] state R[6] status */ + REQ_SCFG_GRAB, /* set device grabbing: Q[0] state - R[6] status */ + REQ_GCFG_GRAB, /* get device grabbing: R[0] state R[6] status */ REQ_SCFG_SERDEV, /* set serial device path: Q[0] length, followed by bytes - R[6] status */ REQ_GCFG_SERDEV, /* get serial device path: R[0] length R[6] status, followed by bytes */ /* TODO ... more */ diff --git a/src/proto_unix.c b/src/proto_unix.c index 3cd690e..57872bb 100644 --- a/src/proto_unix.c +++ b/src/proto_unix.c @@ -492,6 +492,9 @@ static int handle_request(struct client *c, struct reqresp *req) case REQ_SCFG_LED: cfg.led = req->data[0] ? 1 : 0; + if((dev = get_client_device(c)) && dev->set_led) { + dev->set_led(dev, cfg.led); + } sendresp(c, req, 0); break; @@ -500,6 +503,16 @@ static int handle_request(struct client *c, struct reqresp *req) sendresp(c, req, 0); break; + case REQ_SCFG_GRAB: + cfg.grab_device = req->data[0] ? 1 : 0; + sendresp(c, req, 0); + break; + + case REQ_GCFG_GRAB: + req->data[0] = cfg.grab_device; + sendresp(c, req, 0); + break; + default: logmsg(LOG_WARNING, "invalid client request: %04xh\n", (unsigned int)req->type); sendresp(c, req, -1);