Skip to content

Commit

Permalink
added missing set/get requests for the repeat interval
Browse files Browse the repository at this point in the history
  • Loading branch information
jtsiomb committed Jul 17, 2023
1 parent 15e6848 commit 9b46aeb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions src/proto_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9b46aeb

Please sign in to comment.