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 建立於 2025年3月29日

在 GitHub 查看
 (0 留言) (1 反應) (0 負責人)C (43,867 fork)batch import
bughelp wanted

倉庫指標

Star
 (20,368 star)
PR 合併指標
 (平均合併 20天 9小時) (30 天內合併 27 個 PR)

描述

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

貢獻者指南