diff --git a/proto.h b/proto.h index 97aba94..0dd086d 100644 --- a/proto.h +++ b/proto.h @@ -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 }; diff --git a/spnav.c b/spnav.c index 0992c4c..b82fa5f 100644 --- a/spnav.c +++ b/spnav.c @@ -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}; diff --git a/spnav.h b/spnav.h index ae33376..e481e41 100644 --- a/spnav.h +++ b/spnav.h @@ -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 */