qmk/qmk_firmware

[Bug] `qmk info` or docs do not mention that output will be incomplete for keymaps defined as .c files

Open

#25,075 opened on Mar 29, 2025

View on GitHub
 (0 comments) (1 reaction) (0 assignees)C (20,368 stars) (43,867 forks)batch import
bughelp wanted

Description

Describe the Bug

I'm a bit of a qmk noob, so it's possible I'm just doing something wrong here, but I found the whole process rather confusing regardless.

The docs currently say this:

https://github.com/qmk/qmk_firmware/blob/49d13595f64577bc50c08b460538d35055befdf8/docs/cli_commands.md?plain=1#L315-L319

However, I was very confused when this command didn't work for any of my keyboards or my custom keymaps:

qmk info -kb zsa/moonlander -km default
Keyboard Name: Moonlander Mark I
Manufacturer: ZSA Technology Labs
Website: zsa.io/moonlander
Maintainer: ZSA via Drashna
Layouts: LAYOUT
Processor: STM32F303
Bootloader: stm32-dfu
Layout aliases: LAYOUT_moonlander=LAYOUT

qmk info -kb keebio/foldkb -km default
Keyboard Name: FoldKB Rev. 1
Manufacturer: Keebio
Website: https://keeb.io
Maintainer: nooges
Layouts: LAYOUT
Processor: atmega32u4
Bootloader: atmel-dfu

Turns out that there's a bit of code here that only renders the layout if it's in json format:

https://github.com/qmk/qmk_firmware/blob/49d13595f64577bc50c08b460538d35055befdf8/lib/python/qmk/cli/info.py#L53-L54

Sure enough, when I ran qmk c2json --no-cpp -km default -kb zsa/moonlander -o keyboards/zsa/moonlander/keymaps/default/keymap.json , qmk info generated the expected output.

We should probably document this somewhere, or try to fix it, since I went down a rabbit hole of learning qmk's python library to figure out what was going on. It seems like there's three ways to deal with this:

  1. document this in cli_commands.md
  2. Add an else and a log line to the end of show_keymap() telling the user that the command won't work with their .c keymap.
  3. If we find a .c keymap, attempt to run qmk.keymap.c2json() and send that output to render_layout

I'd be happy to fix this myself, but since the fix would be somewhat opinionated, and I've never contributed here, I figured I'd ask first. I can put in a PR if someone tells me which fix is the preferable one.

Keyboard Used

No response

Link to product page (if applicable)

No response

Operating System

No response

qmk doctor Output

Is AutoHotKey / Karabiner installed

  • AutoHotKey (Windows)
  • Karabiner (macOS)

Other keyboard-related software installed

No response

Additional Context

No response

Contributor guide