DEV Community

Cover image for Contributing to open-source mechanical keyboard firmware
Jordan Duabe
Jordan Duabe

Posted on • Originally published at jduabe.dev on

Contributing to open-source mechanical keyboard firmware

Built the NCR-80 last year, great-looking board especially if you like the retro aesthetic, and is a pleasure to type on.

One thing I did notice was that the product listing points to a Google Drive link to the precompiled firmware, but it hasn’t been added to the QMK and VIA repositories. I thought this would be a good weekend project (Spoiler: it took longer than a weekend).

I wrote the steps of how I got it done (the steps also apply to any keyboard firmware).

Converting KBFirmware JSON to QMK

The starting point is to convert the KBFirmware JSON from the provided “QMK” files from the product listing, and then converting them to QMK formatted files.

There are a couple of tools that can be used for this purpose:

The resulting files will be the base of the QMK firmware for the keyboard.

Creating a QMK pull request

Make sure to read the contribution guide as a first step. It is also a good idea to check out other supported keyboard firmware to get a feel for the directory structure, and conventions in use.

A keyboard firmware folder (simplified example) should look something like:

mt
|-- ncr80
| |-- keymaps
| |-- default
| |-- keymap.c
|-- info.json
|-- readme.md
`-- rules.mk

Enter fullscreen mode Exit fullscreen mode

In cases where keyboards have multiple versions or revisions e.g. rev1, rev2 or hotswap/soldered, the directory structure will look different; refer to QMK’s contribution guide linked above.

Link to the pull request on GitHub for reference: [Keyboard] Add NCR-80

Creating a VIA pull request

In order to add VIA support for a keyboard, it is required to enable the VIA feature in QMK, and adding a via-compatible keymap for the keyboard. You can check out the QMK pull request linked above; look for the keymaps/via directory.

Read the VIA docs for configuring QMK for a more in-depth guide. I also recommend reading about the VIA spec.

It is also required to have the QMK pull request merged in before contributing to the VIA repository.

VIA V2 vs V3 definitions

It is basically just a matter of copying the VIA json files from the Drive link referenced at the start of this post. The main difference here is the location of the definitions depend on the version; V2 definitions are located in thesrc/<manufacturer>/<keyboard> directory while the V3 definitions are in the v3/<manufacturer>/<keyboard>.

If you have a V2 definition, you can convert it a V3 definition by running the scripts/build-all.ts file in thevia keyboards repository.

Link to the pull request on GitHub for reference: Add support for NCR-80

That’s it, once the pull request gets merged VIA should be able to detect your keyboard.

VIA NCR-80

Top comments (0)