kopia lustrzana https://github.com/FreeSpacenav/libspnav
added missing requests for the repeat interval
rodzic
130cbe710a
commit
51c220aabe
|
@ -87,6 +87,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 */
|
||||
|
@ -174,7 +176,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;
|
||||
|
|
22
src/spnav.c
22
src/spnav.c
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
This file is part of libspnav, part of the spacenav project (spacenav.sf.net)
|
||||
Copyright (C) 2007-2022 John Tsiombikas <nuclear@member.fsf.org>
|
||||
Copyright (C) 2007-2023 John Tsiombikas <nuclear@member.fsf.org>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
@ -1094,3 +1094,23 @@ int spnav_cfg_get_serial(char *buf, int bufsz)
|
|||
{
|
||||
return request_str(REQ_GCFG_SERDEV, buf, bufsz, TIMEOUT);
|
||||
}
|
||||
|
||||
int spnav_cfg_set_repeat(int msec)
|
||||
{
|
||||
struct reqresp rr = {0};
|
||||
|
||||
if(msec < 0) msec = -1;
|
||||
|
||||
rr.data[0] = msec;
|
||||
return request(REQ_SCFG_REPEAT, &rr, TIMEOUT);
|
||||
}
|
||||
|
||||
int spnav_cfg_get_repeat(void)
|
||||
{
|
||||
struct reqresp rr = {0};
|
||||
|
||||
if(request(REQ_GCFG_REPEAT, &rr, TIMEOUT) == -1) {
|
||||
return -1;
|
||||
}
|
||||
return rr.data[0];
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
This file is part of libspnav, part of the spacenav project (spacenav.sf.net)
|
||||
Copyright (C) 2007-2022 John Tsiombikas <nuclear@member.fsf.org>
|
||||
Copyright (C) 2007-2023 John Tsiombikas <nuclear@member.fsf.org>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
@ -376,6 +376,9 @@ int spnav_cfg_get_grab(void); /* returns 0:no-grab/1:grab, or -1 on error */
|
|||
int spnav_cfg_set_serial(const char *devpath);
|
||||
int spnav_cfg_get_serial(char *buf, int bufsz);
|
||||
|
||||
int spnav_cfg_set_repeat(int msec);
|
||||
int spnav_cfg_get_repeat(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Ładowanie…
Reference in New Issue