added missing set/get requests for the repeat interval

hidapi
John Tsiombikas 2023-07-17 17:02:14 +03:00
rodzic 15e6848716
commit 9b46aebfee
2 zmienionych plików z 15 dodań i 1 usunięć

Wyświetl plik

@ -89,6 +89,8 @@ enum {
REQ_GCFG_GRAB, /* get device grabbing: R[0] state R[6] status */
REQ_SCFG_SERDEV, /* set serial device path: Q[0-5] next 24 bytes Q[6] remaining length - R[6] status */
REQ_GCFG_SERDEV, /* get serial device path: R[0-5] next 24 bytes R[6] remaining length or -1 for failure */
REQ_SCFG_REPEAT, /* set repeat interval: Q[0] interval (msec) - R[6] status */
REQ_GCFG_REPEAT, /* get repeat interval: R[0] interval (msec) R[6] status */
/* TODO ... more */
REQ_CFG_SAVE = 0x3ffe, /* save config file: R[6] status */
REQ_CFG_RESTORE, /* load config from file: R[6] status */
@ -176,7 +178,9 @@ const char *spnav_reqnames_3000[] = {
"SCFG_GRAB",
"GCFG_GRAB",
"SCFG_SERDEV",
"GCFG_SERDEV"
"GCFG_SERDEV",
"SCFG_REPEAT",
"GCFG_REPEAT"
};
const int spnav_reqnames_1000_size = sizeof spnav_reqnames_1000 / sizeof *spnav_reqnames_1000;

Wyświetl plik

@ -615,6 +615,16 @@ static int handle_request(struct client *c, struct reqresp *req)
spnav_send_str(c->sock, req->type, cfg.serial_dev);
break;
case REQ_SCFG_REPEAT:
cfg.repeat_msec = req->data[0];
sendresp(c, req, 0);
break;
case REQ_GCFG_REPEAT:
req->data[0] = cfg.repeat_msec;
sendresp(c, req, 0);
break;
case REQ_CFG_SAVE:
sendresp(c, req, write_cfg(cfgfile, &cfg));
break;