2 unstable releases

0.1.0 Oct 4, 2024
0.0.1 Apr 2, 2024

#1062 in Hardware support

Download history 8/week @ 2024-09-22 160/week @ 2024-09-29 31/week @ 2024-10-06

199 downloads per month

GPL-3.0-only

47KB
1K SLoC

[!WARNING]
qmk-via-api is in early development and partly untested. Use at your own risk!

qmk-via-api

Version image image

qmk-via-api provides an implementation of the VIA API for QMK (Quantum Mechanical Keyboard) based keyboards. It allows developers to interact with QMK keyboards programmatically, enabling tasks such as configuring keymaps, macros, lighting effects and more.

Additionally, this library includes Python bindings for all API calls for integration of QMK keyboard configuration into Python-based applications or scripts.

Usage

Rust

Add dependency with Cargo:

cargo add qmk-via-api

Usage example:

use qmk_via_api::api::KeyboardApi;

const PRODUCT_VID: u16 = 0x594D;
const PRODUCT_PID: u16 = 0x604D;
const USAGE_PAGE: u16 = 0xff60;

fn main() {
    let api = KeyboardApi::new(PRODUCT_VID, PRODUCT_PID, USAGE_PAGE).unwrap();
    println!("Protocol version: {:?}", api.get_protocol_version());
    println!("Layer count: {:?}", api.get_layer_count());
}

Python

Install with pip:

pip install qmk-via-api

Usage example:

import qmk_via_api

PRODUCT_VID = 0x594D
PRODUCT_PID = 0x604D
USAGE_PAGE = 0xff60

if __name__ == "__main__":
    api = qmk_via_api.KeyboardApi(PRODUCT_VID, PRODUCT_PID, USAGE_PAGE)
    print(f"Protocol version {api.get_protocol_version()}")
    print(f"Layers count: {api.get_layer_count()}")

License & Attribution

The Rust code in this project is based on code from the VIA project, which is licensed under the GNU General Public License v3.0.

Dependencies

~5–16MB
~154K SLoC