added spnav_cfg_reset, spnav_cfg_restore, and spnav_cfg_save.

pull/15/head
John Tsiombikas 2022-03-20 21:55:23 +02:00
rodzic 1cb5c2c80e
commit 97b2deda3a
3 zmienionych plików z 34 dodań i 0 usunięć

Wyświetl plik

@ -60,6 +60,7 @@ enum {
/* TODO ... more */
REQ_CFG_SAVE = 0x3ffe, /* save config file: R[6] status */
REQ_CFG_RESTORE, /* load config from file: R[6] status */
REQ_CFG_RESET, /* reset to default config: R[6] status */
REQ_CHANGE_PROTO = 0x5500
};

18
spnav.c
Wyświetl plik

@ -789,6 +789,24 @@ int spnav_dev_type(void)
return rr.data[0];
}
int spnav_cfg_reset(void)
{
struct reqresp rr = {0};
return request(REQ_CFG_RESET, &rr, TIMEOUT);
}
int spnav_cfg_restore(void)
{
struct reqresp rr = {0};
return request(REQ_CFG_RESTORE, &rr, TIMEOUT);
}
int spnav_cfg_save(void)
{
struct reqresp rr = {0};
return request(REQ_CFG_SAVE, &rr, TIMEOUT);
}
int spnav_cfg_set_sens(float s)
{
struct reqresp rr = {0};

15
spnav.h
Wyświetl plik

@ -223,6 +223,21 @@ enum {
SPNAV_MAX_BNACT
};
/* Reset all settings to their default values. This change will not persist
* between spacenavd restarts, unless followed by a call to spnav_cfg_save.
*/
int spnav_cfg_reset(void);
/* Revert all the session settings to the values defined in the spacenavd
* configuration file. This change will not persist between spacenavd restarts,
* unless followed by a call to spnav_cfg_save.
*/
int spnav_cfg_restore(void);
/* Save all the current settings to the spacenavd configuration file. */
int spnav_cfg_save(void);
/* Set the global sensitivity.
* cfgfile option: sensitivity
*/