From 7d558479a341d402e2ae3b0180388a7876395a28 Mon Sep 17 00:00:00 2001 From: leviport Date: Fri, 26 Jun 2020 16:37:34 -0600 Subject: [PATCH] Improve keyboard layout customization doc --- doc/keyboard-layout-customization.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/doc/keyboard-layout-customization.md b/doc/keyboard-layout-customization.md index 0c42f3d..a153a68 100644 --- a/doc/keyboard-layout-customization.md +++ b/doc/keyboard-layout-customization.md @@ -8,21 +8,26 @@ - Run `rustup install nightly`) ## Adding your layout -* In `src/board/system76/{your-model}/keymap/`, copy `default.c` and rename it. I named mine `levi.c`. -* In `src/common/include/common/keymap.h` you will find the key definitions. -TODO: elaborate on this +* In `src/board/system76/{your-model}/keymap/`, copy `default.c` and rename it. There are two examples to reference in the `lemp9` directory: `jeremy.c` and `levi.c`. +* In `src/common/include/common/keymap.h` you will find a list of the key definitions.h +* You will notice two sets of keys in these layout files. The top one is the standard mapping. The bottom one is the Fn layer, meaning it is active when the Fn key is being held. If you look at the Fn layer in the `levi.c` layout, you will see that there are arrow keys at WASD, media and volume keys on the bottom row, etc. +* I find it easiest to change one key at a time, referencing the key code I am deleting for keeping myself positioned correctly in the list of keycodes. -## Point EC at your keymap -* In `ec/src/board/system76/{model}/board.mk` change `KEYMAP?=default` to the name of your layout. -TODO: There's probably a better way to do this +## Configure your EC to build with your layout +* Create a file it the project's root directory called `config.mk` and add your board and keyboard layout to it. For example, if I want to build lemp9 firmware with Jeremy's layout (which is at ec/src/board/system76/lemp9/keymap/jeremy.c): +``` +BOARD?=system76/lemp9 +KEYMAP?=jeremy +``` ## Test build your EC -* From the `ec` directory, run `make BOARD=system76/{your-model}` to make sure it builds correctly. +* From the `ec` directory, run `make` to make sure it builds correctly. ## Flash your EC * If the test build went well, you should be ready to flash your EC: - Close all running applications. - Unplug everything from your laptop except the charger. - - Flash with `make BOARD=system76/{your-model} flash_internal` - - When it says, "Waiting 5 seconds for all keys to be released", it is important to not touch the keyboard or trackpad until it turns itself off. + - Flash with `make flash_internal` + - When it says, "Waiting 5 seconds for all keys to be released", it is important to not touch the keyboard or trackpad until it finishes writing the new EC and turns itself off. - Once it shuts down, you can power it back on, and your keymap will be active. + - If you changed your layout in such a way that you can't easily type, just plug in a USB keyboard and fix the layout. The USB keyboard's layout will be unaffected.