diff options
author | Ineiev <ineiev@gnu.org> | 2016-09-19 11:15:21 +0300 |
---|---|---|
committer | Ineiev <ineiev@gnu.org> | 2016-09-20 16:38:21 +0300 |
commit | 37c965d303155fcee735148cbaa757b9b7279f39 (patch) | |
tree | 8c4c3e49608bb32f479f1fd4537b8c87cf4ad877 | |
parent | a9df18b54a505bd82826d72f554f347576026ad8 (diff) | |
download | miguel-37c965d303155fcee735148cbaa757b9b7279f39.tar.gz miguel-37c965d303155fcee735148cbaa757b9b7279f39.tar.bz2 |
replace --enable-idle-rate -> --with-max-idle-rate
-rw-r--r-- | firmware/clav.c | 12 | ||||
-rw-r--r-- | firmware/configure.ac | 19 |
2 files changed, 21 insertions, 10 deletions
diff --git a/firmware/clav.c b/firmware/clav.c index d696583..3f2699e 100644 --- a/firmware/clav.c +++ b/firmware/clav.c @@ -20,6 +20,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.*/ /* Fuse bits for ATmega48..ATmega328: ext and high as default, low 0xEF. */ #include <config.h> + +#if MAX_IDLE_RATE < 0 +#define RESPECT_IDLE_RATE 0 +#define max_idle_rate 0 +#else +#define RESPECT_IDLE_RATE 1 +#define max_idle_rate MAX_IDLE_RATE +#endif + #include <avr/io.h> #include <avr/sleep.h> #include <avr/wdt.h> @@ -671,6 +680,9 @@ usbFunctionSetup (uchar data[8]) else if(rq->bRequest == USBRQ_HID_SET_IDLE) { idle_rate = rq->wValue.bytes[1]; + if (RESPECT_IDLE_RATE && max_idle_rate + && (!idle_rate || max_idle_rate < idle_rate)) + idle_rate = max_idle_rate; reset_idle_period (); } else if(rq->bRequest == USBRQ_HID_GET_PROTOCOL) diff --git a/firmware/configure.ac b/firmware/configure.ac index 8a248eb..862d7da 100644 --- a/firmware/configure.ac +++ b/firmware/configure.ac @@ -113,16 +113,15 @@ AS_CASE([$enable_raw_scancodes], [yes], [raw_scancodes=1], [raw_scancodes=0]) AC_DEFINE_UNQUOTED([RAW_SCANCODES], [$raw_scancodes], [Define to 1 to output unprocessed scancodes]) -AC_MSG_CHECKING([whether to respect idle rate]) -AC_ARG_ENABLE([idle-rate], -[AS_HELP_STRING([--disable-idle-rate], -[Ignore idle rate setting])], -[enable_idle_rate=$enableval], [enable_idle_rate=yes]) -AC_MSG_RESULT([$enable_idle_rate]) -AS_CASE([$enable_idle_rate], [yes], [idle_rate=1], [idle_rate=0]) - -AC_DEFINE_UNQUOTED([RESPECT_IDLE_RATE], [$idle_rate], - [Define to 0 to ignore idle rate]) +AC_MSG_CHECKING([for maximum idle rate]) +AC_ARG_WITH([max-idle-rate], +[AS_HELP_STRING([--with-max-idle-rate], +[Maximum idle rate (-1 to ignore idle rate setting, 0 to allow any rate) [0]])],, +[with_max_idle_rate=0]) +AC_MSG_RESULT([$with_max_idle_rate]) + +AC_DEFINE_UNQUOTED([MAX_IDLE_RATE], [$with_max_idle_rate], + [Maximum idle rate (-1 to ignore the setting, 0 to allow any rate)]) AC_MSG_CHECKING([whether to enable jamming phantom keys]) AC_ARG_ENABLE([jamming], |