Skip to content

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

Open
@fearful-symmetry

Description

@fearful-symmetry

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:

Show a JSON keymap for a keyboard:
```
qmk info -kb clueboard/california -km default
```

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:

if keymap_path and keymap_path.suffix == '.json':
keymap_data = json.load(keymap_path.open(encoding='utf-8'))

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions