summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2013-07-24 00:43:40 +0900
committertmk <nobody@nowhere>2013-07-24 00:43:55 +0900
commitc7d309e34bf5d05f245811389bea495d814e2111 (patch)
tree5812fd31a0c58c74d252bb638a736ee133cfa7c0
parent7e5081b5a8f2c6e0c3c8d2dc73717c0b3597ef84 (diff)
parent05225dd9d8b666fec75ff5f1824f82fdfe7c0a77 (diff)
Merge branch 'bootmagic_salt'(Fix issue #41)
-rw-r--r--README.md2
-rw-r--r--common/bootmagic.c10
-rw-r--r--common/bootmagic.h6
-rw-r--r--keyboard/hhkb/config.h3
4 files changed, 20 insertions, 1 deletions
diff --git a/README.md b/README.md
index 8864795c5b..536cc753fb 100644
--- 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`)
diff --git a/common/bootmagic.c b/common/bootmagic.c
index 11eef3c3c6..410dc68364 100644
--- a/common/bootmagic.c
+++ b/common/bootmagic.c
@@ -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);
+}
diff --git a/common/bootmagic.h b/common/bootmagic.h
index 68935e9706..2d14b3e763 100644
--- a/common/bootmagic.h
+++ b/common/bootmagic.h
@@ -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
diff --git a/keyboard/hhkb/config.h b/keyboard/hhkb/config.h
index 613e66d138..8c93f97da5 100644
--- a/keyboard/hhkb/config.h
+++ b/keyboard/hhkb/config.h
@@ -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.