Remote control for your QMK-powered keyboard

Related tags

Miscellaneous qmk_rc
Overview

QMK RC

QMK RC is a project that aims to bring the same convenience to controlling your QMK keyboard from your computer, as QMK did to programming keyboards.

Quick start

To get started with QMK RC, you need to set up the keyboard and the host. Let's start with the keyboard:

Keyboard firmware

First, fetch the QMK RC source either into your keymap, or user directory:

bash <(wget -qO- https://raw.githubusercontent.com/mmalecki/qmk_rc/latest/bin/qmkrc_fetch)

Next, add these files to the SRC list in your rules.mk and enable the necessary QMK feature:

SRC += qmk_rc.c
RAW_ENABLE = yes

And include the header in your keymap.c:

#include "qmk_rc.h"

From here on, you can start feeding the QMK RC raw HID data:

#ifdef RAW_ENABLE
#define QMK_RC_BUFFER_MAX 64
uint8_t qmk_rc_buffer[QMK_RC_BUFFER_MAX] = {};

void raw_hid_receive(uint8_t *data, uint8_t length) {
  qmk_rc_receive(qmk_rc_buffer, QMK_RC_BUFFER_MAX, data, length);
}
#endif

Flash your keyboard with the modified software, as you usually do.

Host software

The host application is distributed as an npm package. To get it installed, run:

npm -g install qmkrcd

Play time!

Now, to the fun part.

Launch qmkrcd by typing qmkrcd. It will scan the HID devices attached to the host, and attempt to find one that quacks like a QMK-supported keybaord.

Alternatively, you can have qmkrcd connect to a specified device by passing its name as an argument: qmkrcd 'foostan corne'.

If qmkrcd doesn't find your device, please open an issue on its repository.

From now on, you should be able to control your keyboard. For example, to write a string to an OLED attached to your keyboard:

curl 127.0.0.1:9916/command -XPOST \
  -H 'content-type: application/json' \
  -d '{"id":3,"data":"Hello, QMK RC!"}' -v

For a full list of built-in commands, see Commands. You can also implement your own, Custom commands.

Acknowledgments

  • The QMK team for authoring an amazing piece of software
  • libuv team for their test framework
Issues
  • Default command ids conflict with VIA/VIAL

    Default command ids conflict with VIA/VIAL

    The default ids used in the qmk_rc_commands_quantum enum range from 1 to 15 - which conflicts with VIA (https://github.com/the-via/qmk_firmware) (and VIAL: https://github.com/vial-kb/vial-qmk).

    To even compile firmware using both VIA/VIAL and qmk_rc, the addition of the raw_hid_receive function added needs to be renamed to raw_hid_receive_kb. Even then, VIA doesn't explicitly allow commands other than those that it specifies to be routed from quantum to the keyboard-level handler - which, among other things (such as security concerns), makes VIAL a more attractive option for many.

    Reading through the raw_hid_receive function in VIA's source, you'll notice the raw_hid_receive_kb keyboard-level handler is only invoked for a small number of pre-defined commands known to VIA (essentially any command with "CUSTOM" in the command enum's name), and the default at the end of the switch statement simply says it was unhandled and tosses it: https://github.com/the-via/qmk_firmware/blob/master/quantum/via.c#L374

    VIAL, on the other hand, passes down anything it doesn't recognize to the keyboard-level handler: https://github.com/vial-kb/vial-qmk/blob/2fc27b48b6aa0638914ae3762576cb694ea4d580/quantum/via.c#L455

    Once past these initial hurdles (either modifying the line in VIA's quantum/via.c (the default: case at the end of the giant switch in raw_hid_receive) to add the line VIAL has to call the _kb version, or just use VIAL), you should be able to use custom qmk_rc commands.

    Worth mentioning, VIAL makes some changes to VIA's implementation in the name of security, so that without first "unlocking" your keyboard - only a very small subset of commands are allowed (none of which are the unrecognized ones). This can be overridden with the rule "VIAL_INSECURE" if you don't want to go through the unlock process every time you have a hard boot of your board.

    However, the OOTB default commands you've graciously already implemented cannot be used, as the IDs conflict with the command enums in VIA (VIAL explicitly does this with an additional Byte, using only a single command_id 0xFE at the very last usable command_id they call the id_vial_prefix - minimizing the likelihood of VIA adding more commands that would eventually conflict - then allowing the following byte in the raw payload to serve as the command id and have their own space to play in with whatever command_ids they want).

    Basically, I want all the things. The "easy" way to do this (and I will likely fork your repo and try it that way myself first), would be to change the command_id values in the qmc_rc_commands_quantum to not conflict with VIA's. While this would likely work for a while, as VIA adds more commands - they will take precedent over those of qmk_rc. The "right" (or I should say "A better") way to do this would be to do what VIAL does - making a single command_id (0xFD being the obvious choice) the command_id handled at the "quantum" level (although, in practice, at the kb_level). This pretty much keeps the qmk_rc enums intact, only the code in both qmkrd and the top-level handler in qmk_rc will have to shift one index higher (ie. data[0] = id_qmc_rc_prefix (new, and hardcoded to 0xFD), data[1] = "command_id", etc.).

    I want to validate that this will work the easy way first (as the better way requires changes to qmkrd as well), but wanted to get it on your radar in case this is something you may have already thought of. If this is all news to you, I will likely open PRs to both qmk_rc and qmkrd upon your approval (and after I implement the "better" solution, making sure to account for people that don't use VIA/VIAL as well as lazy hackers who like GUIs more than having to flash their board every time they want a new keymap).

    (great work, btw - super easy to follow - rest assured you've inspired at least one other person to help expand the audience of this promising qmk extension)

    opened by themillerdave 0
  • RGB Matrix not working on bm60rgb

    RGB Matrix not working on bm60rgb

    Hi! first of all, thanks for this awesome tool, it's exactly what I was looking for :)

    I updated my keyboard's firmware without issues. And I managed to run some commands correctly, for example, these commands are working fine:

    $ curl 127.0.0.1:9916/command -XPOST \
      -H 'content-type: application/json' \
      -d '{"id":14,"data":[1]}'
    
    $ curl 127.0.0.1:9916/command -XPOST \
      -H 'content-type: application/json' \
      -d '{"id":8}'
    

    However, when I try to modify the led's color, nothing happens, here is an example:

     $ curl 127.0.0.1:9916/command -XPOST \
      -H 'content-type: application/json' \
      -d '{"id":10,"data":[50,75,90,1,4]}'
    {"message":"Command sent","bytes":[0,10,5,0,0,0,50,75,90,10,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}%
    

    I copied this command from your documentation, I just changed the command id.

    Let me know if I can help with this, I'm not familiar with programming in C, but if you need some debug info or something, let me know!

    Thanks!

    opened by jjimenezlopez 2
  • Figure out a way to share command list

    Figure out a way to share command list

    Currently it's all ints. We should figure out a way to share commands with qmkrcd so that its interface can accept command names. Bonus points for a way to generate commands.md out of that.

    opened by mmalecki 0
Owner
Maciej Małecki
Maciej Małecki
Control Heidelberg Wallbox Energy Control over WiFi using ESP8266 and configure your own local load management

< scroll down for English version and additional information > wbec WLAN-Anbindung der Heidelberg WallBox Energy Control über ESP8266 Die Heidelberg W

null 75 Jul 30, 2022
Bobby Cooke 272 Jul 27, 2022
Raw HID keyboard forwarder to turn the Pi 400 into a USB keyboard

Raspberry Pi 400 as a USB HID Keyboard Hook your Pi 400 up to your PC somehow, using a USB Type-C cable into the power port. Anker make good ones- I u

Philip Howard 157 Aug 7, 2022
Use Atari keyboard as USB keyboard with a Teensy 3.6

Atari Keyboard Convert an Atari 600/800/1200 XL into a USB keyboard. I bricked my Atari mainboard. My goal is to use the keyboard of the Atari on a Ra

Jos Koenis 2 Dec 3, 2021
Gesture-Detecting-Macro-Keyboard - Glorified Bluetooth macro keyboard with machine learning (TensorFlow Lite for Microcontrollers) running on an ESP32.

Gesture detection tldr; Glorified Bluetooth macro keyboard with machine learning (TensorFlow Lite for Microcontrollers) running on an ESP32. Main feat

Jakob Krantz 65 Jul 30, 2022
Simple ATTiny85 based PS/2 to Amiga keyboard protocol converter that fits inside the keyboard.

Simple ATTiny85 based PS/2 to Amiga keyboard protocol converter that fits inside the keyboard.

Jari Tulilahti 8 May 6, 2022
Lock you keyboard and clean your screen. A simple, and easy way to clean your computers.

Pristine Cleaner A screen and keyboard cleaning application made to turn screen black, and lock keyboard for easy cleaning. With features such as star

Rhino Inani 2 Jan 16, 2022
TinyRemoteXL - 12-Button IR Remote Control based on ATtiny13A

TinyRemoteXL is a 12-button IR remote control based on an ATtiny13A powered by a CR2032 or LIR2032 coin cell battery.

Stefan Wagner 33 Jul 10, 2022
Use Arduino to realize IR remote control of equipment supporting Onkyo RI

OnkyoIRRemote 使用红外遥控控制支持OnkyoRI的设备 可用ArduinoNano制作 ID列表(这是我自己测试出来的我的安桥收音机的代码) 3072 列表下一个电台(全组切换) 3073 列表上一个电台(全组切换) 3080 SLEEP 90 3081 FM 3082 AM 3088

null 1 Oct 24, 2021
Bluetooth Gateway for Phantom Remote Control based on ESP32

Phantom remote control Bluetooth gateway An ESP3232 firmware for the gateway of Phantom remote control, which can push the temperature and humidity data of Phantom remote control through LAN, and also support to control Phantom remote control to send and receive IR data through LAN.

George Zhao 13 Jul 9, 2022
A custom OLED animation for QMK keyboards

superloop This animation is made for 32x128 pixel 1-bit OLED displays. Info This repository is a lightweight clone of the crkdb:default QMK configurat

hexcowboy 24 Jun 16, 2022
qmk based oled bongo cat animation

oledbongocat qmk based oled bongo cat animation step 1: append OLED enable and WPM enable to your rules.mk (see last lines of my rules.mk) step 2: in

null 75 Aug 11, 2022
First-up chord-send and tap-and-hold chord repeat extensions to QMK.

Quantum Mechanical Keyboard Firmware This is a keyboard firmware based on the tmk_keyboard firmware with some useful features for Atmel AVR and ARM co

Joshua Grams 7 Jul 19, 2022
QMK keymaps for "all" my keyboards

keymaps Setup Install qmk package for arch and set it up. yay qmk qmk setup Build Steps to build keymap and flash it from arch. qmk new-keymap -kb mec

Aditya Rohan 1 Oct 27, 2021
QMK Configuration for Anne Pro (v1)

Anne Pro QMK firmware port for the Anne Pro 60% keyboard produced by Obins. This firmware is not created or supported by the creator of this keyboard!

null 1 Nov 15, 2021
A C library for RP2040-powered boards to control LCDs via the I2C protocol

picoi2clcd A C library to control I2C LCD displays using the Rapsberry Pi Pico (or really any board using the RP2040 microcontroller). License All of

Kosmas Raptis 2 Oct 16, 2021
A cheap,simple,Ongeki controller Use Keyboard Simulation and Mouse Simulation to controller the ongeki game. Using Pro-micro control.

N.A.G.E.K.I. A cheap,simple,Ongeki controller Use Keyboard Simulation and Mouse Simulation to controller the ongeki game. Using Pro-micro control. 中文版

NanaNana 28 Jul 21, 2022
A cheap,simple,Ongeki controller Use Keyboard Simulation and Mouse Simulation to controller the ongeki game. Using Pro-micro control.

N.A.G.E.K.I. PLEASE CHECK Main Project A cheap,simple,Ongeki controller Use Keyboard Simulation and Mouse Simulation to controller the ongeki game. Us

NanaNana 11 Dec 30, 2021
Harsh Badwaik 1 Dec 19, 2021