Skip to content

Commit

Permalink
rewrite to rust
Browse files Browse the repository at this point in the history
  • Loading branch information
zzeneg committed Jul 30, 2023
2 parents d6bfe00 + 120f8fa commit 2ae9674
Show file tree
Hide file tree
Showing 54 changed files with 571 additions and 8,217 deletions.
25 changes: 24 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
# Created by https://www.toptal.com/developers/gitignore/api/rust
# Edit at https://www.toptal.com/developers/gitignore?templates=rust

### Rust ###
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# End of https://www.toptal.com/developers/gitignore/api/rust


/dist/*.txt
**/.idea
**/.idea

6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
"editor.codeActionsOnSave": {
"source.fixAll": true
},
"editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer"
},
"rust-analyzer.rustfmt.extraArgs": ["--config", "max_width=140"]
}
32 changes: 32 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[package]
name = "qmk-hid-host"
version = "0.0.0"
edition = "2021"
authors = ["zzeneg"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
tracing = "0.1"
tracing-subscriber = "0.3"
chrono = "0.4.26"
hidapi = "2.4.0"
tokio = { version = "1.29.1", features = ["sync"] }
async-std = "1.7.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

[dependencies.windows]
version = "0.48"
features = [
"implement",
"Foundation",
"Media_Control",
"Win32_Globalization",
"Win32_Foundation",
"Win32_Media_Audio_Endpoints",
"Win32_System_Com_StructuredStorage",
"Win32_UI_Input_KeyboardAndMouse",
"Win32_UI_TextServices",
"Win32_UI_WindowsAndMessaging",
]
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# QMK HID Host

Host component for communicating with QMK keyboards using Raw HID feature. Requires support on keyboard side, currently is supported by [stront](https://github.com/zzeneg/stront).
Host component for communicating with QMK keyboards using Raw HID feature.

Requires support on keyboard side, currently is supported by [stront](https://github.com/zzeneg/stront).

## Architecture

Host contains two parts - server and adapters, which communicate between each other using [socket.io](https://socket.io). Server is a cross-platform application written in node.js, and adapters should be OS-specific to be able to use OS functions. Currently only Windows adapter written in C# exists.
Application is written in Rust which gives easy access to HID libraries, low-level Windows APIs and potential cross-platform compatibility. Currently only Windows is supported, as I don't use other operating systems. Please feel free to raise any PRs with Linux/MacOS support.

## Supported providers

Expand All @@ -15,7 +17,10 @@ Host contains two parts - server and adapters, which communicate between each ot

## How to run it

1. Download and open [dist](/dist) folder.
2. Open server config file `QMK.HID.Host.Server.json`, make sure `device` values matches your keyboard, update `layouts` if needed.
3. Connect your keyboard.
4. Start `QMK.HID.Host.Server.exe` and `QMK.HID.Host.Adapter.Windows.exe` (order does not matter).
1. Download and start [qmk-hid-host.exe](dist/qmk-hid-host.exe)
2. The app will create a configuration json file in the same folder
3. Edit that config with your options and restart the app

## Changelog

- 2023-07-30 - rewritten to Rust
118 changes: 0 additions & 118 deletions adapters/QMK.HID.Host.Adapter.Windows/.editorconfig

This file was deleted.

Loading

0 comments on commit 2ae9674

Please sign in to comment.