]> git.donarmstrong.com Git - tmk_firmware.git/commitdiff
Add bootmagic salt key to avoid accidental configuration
authortmk <nobody@nowhere>
Tue, 23 Jul 2013 15:41:28 +0000 (00:41 +0900)
committertmk <nobody@nowhere>
Tue, 23 Jul 2013 15:41:28 +0000 (00:41 +0900)
README.md
common/bootmagic.c
common/bootmagic.h
keyboard/hhkb/config.h

index 8864795c5b95f1517c98fb9f7437ede7bad83216..536cc753fb58076f90061db8c4b96a945bab950b 100644 (file)
--- a/README.md
+++ b/README.md
@@ -124,6 +124,8 @@ Following commands can be also executed with `Magic` + key. In console mode `Mag
 Boot Magic are executed during boot up time. Press Magic key below then pulgin keyboard cable.
 Note that you must use keys of **Layer 0** as Magic keys. These settings are stored in EEPROM so that retain your configure over power cycles.
 
+To avoid configuring accidentally additive salt key `KC_SPACE` also needs to be pressed along with the following configuration keys. The salt key is configurable in `config.h`. See [common/bootmagic.h](common/bootmagic.h).
+
 #### General
 - Skip reading EEPROM to start with default configuration(`ESC`)
 - Clear configuration stored in EEPROM to reset configuration(`Backspace`)
index 11eef3c3c604d205fbbd737ce75fc6dd4cb61eb7..410dc68364562901d4c5067496c82fe57d920fde 100644 (file)
@@ -5,6 +5,7 @@
 #include "bootloader.h"
 #include "debug.h"
 #include "keymap.h"
+#include "action_layer.h"
 #include "eeconfig.h"
 #include "bootmagic.h"
 
@@ -94,7 +95,7 @@ void bootmagic(void)
     }
 }
 
-bool bootmagic_scan_keycode(uint8_t keycode)
+static bool scan_keycode(uint8_t keycode)
 {
     for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
         matrix_row_t matrix_row = matrix_get_row(r);
@@ -108,3 +109,10 @@ bool bootmagic_scan_keycode(uint8_t keycode)
     }
     return false;
 }
+
+bool bootmagic_scan_keycode(uint8_t keycode)
+{
+    if (!scan_keycode(BOOTMAGIC_KEY_SALT)) return false;
+
+    return scan_keycode(keycode);
+}
index 68935e9706c75a0ad5e401b88d3794ed606f222d..2d14b3e7632d5e2fed3cf1b949fd362b48f873ef 100644 (file)
@@ -2,6 +2,12 @@
 #define BOOTMAGIC_H
 
 
+/* bootmagic salt key */
+#ifndef BOOTMAGIC_KEY_SALT
+#define BOOTMAGIC_KEY_SALT              KC_SPACE
+#endif
+
+/* skip bootmagic and eeconfig */
 #ifndef BOOTMAGIC_KEY_SKIP
 #define BOOTMAGIC_KEY_SKIP              KC_ESC
 #endif
index 613e66d138292d73162b84349bd145fca7aeccb4..8c93f97da512eb2c0f88b8272faab024d6bdd2d1 100644 (file)
@@ -59,6 +59,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define TAPPING_TOGGLE  5
 
 
+/* Boot Magic salt key: Space */
+#define BOOTMAGIC_KEY_SALT      KC_FN6
+
 /*
  * Feature disable options
  *  These options are also useful to firmware size reduction.