Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
202145e
feat: Enable Linux build support via hidapi
TheNotary Jul 7, 2026
cca8517
Documentation Updates
TheNotary Jul 7, 2026
674f0be
fixing repo to build with cmake 4, likely breaking builds on windows
TheNotary Jul 10, 2026
9c15585
omg, it got it working by switching to libusb, I wish I had stuck wit…
TheNotary Jul 10, 2026
0ee4fb3
introduces file locking on windows incase two instances of this app r…
TheNotary Jul 10, 2026
ee94ac5
cleans up demo outputs
TheNotary Jul 14, 2026
e6c319e
adds Sabreclaw's py script for uploading gifs
TheNotary Jul 14, 2026
fe8e622
does py -> cpp transcode that really should never be run till debugged
TheNotary Jul 21, 2026
d2be430
improves diagnostics on py script
TheNotary Jul 21, 2026
7add21b
adds support to udev rule for hidraw
TheNotary Jul 21, 2026
5c43715
update py script to be integration test friendly
TheNotary Jul 21, 2026
41fde59
adds an integration test to the cpp code that compares to the python …
TheNotary Jul 21, 2026
d06107c
does integration-test backed bug sweep on cpp code
TheNotary Jul 21, 2026
5994da8
misc
TheNotary Jul 29, 2026
5f92f9f
adds multi-platform-arch build pipeline
TheNotary Jul 29, 2026
1eafaa1
move to CC attribution license
TheNotary Jul 29, 2026
554c94a
adds note to readme while I switch on GH Actions
TheNotary Jul 29, 2026
1d5e808
fixes bug where windows builds were broken
TheNotary Jul 29, 2026
f2f5703
more build fixes that went a bit over-the-top imo, but w/e
TheNotary Jul 29, 2026
56ec5ae
Troubleshooting Fixes: rename OpEntry::interface to avoid Windows SDK…
TheNotary Jul 29, 2026
39b6999
fixes issue where it's release tags don't follow semver well enough
TheNotary Jul 29, 2026
f7c5947
drops README warning, found bug in release tag glob pattern
TheNotary Jul 29, 2026
9e5270b
c ABI for rust interop
TheNotary Jul 29, 2026
64ec81d
I think it hallucinated this but no time to check =/
TheNotary Jul 29, 2026
5890a2e
Troubleshooting Fixes: accept SemVer pre-release version tags
TheNotary Jul 30, 2026
bd54da9
Add Rust interop crates, pkg-config support and Rust CI
TheNotary Jul 30, 2026
c3bb0ee
Troubleshooting Fixes:
TheNotary Jul 30, 2026
ce92a75
rebrands to keylt
TheNotary Jul 30, 2026
3475cce
fixes up licensing and lists release process
TheNotary Jul 30, 2026
1ef873b
cleans up release tag so everything is in sync
TheNotary Jul 30, 2026
6f82f48
fixes issue where crate is very business business about license types
TheNotary Jul 30, 2026
43d8d29
brand on readme title
TheNotary Jul 30, 2026
2bb50b0
improves error reporting
TheNotary Jul 30, 2026
188785f
documents future cli
TheNotary Jul 31, 2026
4235062
moves the library implementation to src/libkeylt, and produces a bina…
TheNotary Jul 31, 2026
c3d8307
enhances cli
TheNotary Jul 31, 2026
f4fe1a3
adds test fixtures for the actual keyboard LED messages, but I think …
TheNotary Jul 31, 2026
f69469c
asks it to clean up it's tech debt in the demo
TheNotary Aug 1, 2026
ad1013e
it's such such slop now, agents and C++ don't mix...
TheNotary Aug 2, 2026
bd922b0
changes linux usb backend so set_feature_report can be used
TheNotary Aug 3, 2026
1483851
adds validation to make sure we're connected to a device that wants t…
TheNotary Aug 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .beader/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.lock
*.log
identities.yaml
integrations
hooks
2 changes: 2 additions & 0 deletions .beader/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
write_prod_log: true
write_commands_log: true
12 changes: 12 additions & 0 deletions .beader/issues/1-linux-platform-support.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
id: 1
title: Linux Platform Support
type: epic
status: closed
priority: 1
created_at: 2026-07-06T23:59:46.188348832Z
updated_at: 2026-07-07T03:08:43.812205954Z
closed_at: 2026-07-07T03:08:43.812205414Z
---

Enable the keyboard driver to build and run on Linux in addition to Windows. This includes platform abstraction, hidapi integration, build system changes, and CI.
20 changes: 20 additions & 0 deletions .beader/issues/10-add-hidapi-to-vcpkg-json-dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
id: 10
title: Add hidapi to vcpkg.json dependencies
type: task
status: closed
priority: 2
parent: 2
assignees:
- keen-cedar
created_at: 2026-07-07T00:01:22.127627112Z
updated_at: 2026-07-07T00:04:21.710212105Z
closed_at: 2026-07-07T00:04:21.710211280Z
---

Add "hidapi" to the dependencies list in vcpkg.json.

vcpkg has hidapi for both platforms; on Windows it's a no-op if we don't use it there. The hidraw backend (default on Linux) is needed for feature reports.

Files:
- vcpkg.json
26 changes: 26 additions & 0 deletions .beader/issues/11-add-linux-preset-to-cmakepresets-json.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
id: 11
title: Add Linux preset to CMakePresets.json
type: task
status: closed
priority: 2
parent: 2
blocked_by:
- 9
assignees:
- keen-cedar
created_at: 2026-07-07T00:01:29.388945751Z
updated_at: 2026-07-07T00:12:13.334797403Z
closed_at: 2026-07-07T00:12:13.334796578Z
---

Add a Linux preset to CMakePresets.json (no architecture override, uses system default toolchain, no vcpkg host triplet override to x86):

```json
{ "name": "linux-debug", "inherits": "default", "condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Linux" } }
```

Also add corresponding build and test presets for Linux.

Files:
- CMakePresets.json
25 changes: 25 additions & 0 deletions .beader/issues/12-create-setup-sh-for-linux-builds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
id: 12
title: Create setup.sh for Linux builds
type: task
status: closed
priority: 2
parent: 2
blocked_by:
- 11
assignees:
- keen-cedar
created_at: 2026-07-07T00:01:35.669698117Z
updated_at: 2026-07-07T00:13:14.483735149Z
closed_at: 2026-07-07T00:13:14.483734508Z
---

Create `setup.sh` — Linux equivalent of `setup.bat`:

- Bootstrap vcpkg if not present
- `vcpkg install`
- `cmake --preset linux-debug`
- `cmake --build --preset linux-debug-build`

Files:
- setup.sh (NEW)
25 changes: 25 additions & 0 deletions .beader/issues/13-verify-unit-tests-compile-and-pass-on-linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
id: 13
title: Verify unit tests compile and pass on Linux
type: task
status: closed
priority: 2
parent: 2
blocked_by:
- 9
- 11
assignees:
- keen-cedar
created_at: 2026-07-07T00:01:46.272031456Z
updated_at: 2026-07-07T03:07:37.075315862Z
closed_at: 2026-07-07T03:07:37.075314872Z
---

Ensure existing unit tests compile and pass on Linux. They test protocol/message construction, not USB I/O directly — should work once platform types are fixed.

Also verify that the mock/stub for usb_functions in tests means KeyboardTest doesn't require a physical device (already the case — verify).

Files:
- test/keyboard_test.cpp
- test/keyboard_rk84_test.cpp
- test/keyboard_sk80_test.cpp
25 changes: 25 additions & 0 deletions .beader/issues/14-add-linux-ci-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
id: 14
title: Add Linux CI workflow
type: task
status: closed
priority: 2
parent: 2
blocked_by:
- 13
assignees:
- tidy-raven
created_at: 2026-07-07T00:01:52.809042679Z
updated_at: 2026-07-07T03:08:26.698751215Z
closed_at: 2026-07-07T03:08:26.698750585Z
---

Add a CI workflow `.github/workflows/linux.yml`:

- Ubuntu runner
- Install hidapi-dev (or use vcpkg)
- cmake configure + build + test
- Ensure Windows build remains functional (regression check)

Files:
- .github/workflows/linux.yml (NEW)
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
id: 15
title: Add udev rules file for Linux device permissions
type: task
status: closed
priority: 3
parent: 2
blocked_by:
- 7
assignees:
- keen-cedar
created_at: 2026-07-07T00:02:00.845307423Z
updated_at: 2026-07-07T00:10:44.237175212Z
closed_at: 2026-07-07T00:10:44.237174662Z
---

Add a sample udev rules file for Linux so users don't need root to access the keyboard HID device.

Create `99-keyboard-leds.rules` with rules granting user access to the specific VID/PID combinations for supported keyboards (SK80, RK84).

hidraw devices require root or a udev rule. Include installation instructions in README or a doc file.

Files:
- 99-keyboard-leds.rules (NEW)
35 changes: 35 additions & 0 deletions .beader/issues/2-enable-linux-build-support-via-hidapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
id: 2
title: Enable Linux build support via hidapi
type: feature
status: closed
priority: 1
parent: 1
created_at: 2026-07-07T00:00:01.492618850Z
updated_at: 2026-07-07T03:08:43.809721954Z
closed_at: 2026-07-07T03:08:43.809721414Z
---

## Summary

Enable this Windows-only HID keyboard driver to build and run on Linux by introducing hidapi as the Linux USB/HID backend, a platform compatibility header to eliminate Windows types from public interfaces, platform-specific implementation files selected at CMake time, and the necessary build system changes.

## User Message

Create issues from the following plan. The plan is for enabling a C++ keyboard driver project (currently Windows-only) to build and run on Linux using hidapi.

## Plan

The plan consists of 5 phases:
1. Platform Compatibility Layer - introduce platform.h, remove Windows types from public headers
2. Split USB Implementation Files - separate Windows/Linux USB code, CMake selects which to compile
3. Build System Changes - CMake platform selection, hidapi dependency, Linux presets
4. hidapi Implementation Details - byte-perfect mapping of Windows HID calls to hidapi
5. Testing & Verification - ensure tests pass, add CI workflow

Key decisions:
- hidapi chosen as Linux HID backend (vcpkg-available, maps cleanly to SetFeature/GetReport)
- Platform impl files with #ifdef in headers (not runtime polymorphism)
- Typedefs in platform.h to keep Windows type names on both platforms
- No hidapi on Windows — existing Windows SDK code preserved as-is
- target_device_path on Linux becomes interface_number matching
23 changes: 23 additions & 0 deletions .beader/issues/3-create-platform-h-compatibility-header.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
id: 3
title: Create platform.h compatibility header
type: task
status: closed
priority: 1
parent: 2
assignees:
- keen-cedar
created_at: 2026-07-07T00:00:13.202779044Z
updated_at: 2026-07-07T00:04:14.656669667Z
closed_at: 2026-07-07T00:04:14.656669117Z
---

Create `include/main/platform.h` — a compatibility header defining:
- `typedef uint8_t UINT8` (or alias) for Windows compat
- `typedef unsigned char UCHAR`
- `typedef void* DeviceHandle` (replaces `HANDLE` in interfaces)
- On Windows: `#include <windows.h>` and typedef `DeviceHandle = HANDLE`
- On Linux: `#include <cstdint>` and typedef `DeviceHandle = void*` (hidapi device pointer)
- Platform detection via `#ifdef _WIN32` / `#ifdef __linux__`

Files: include/main/platform.h (NEW)
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
id: 4
title: Replace Windows headers with platform.h in public headers
type: task
status: closed
priority: 1
parent: 2
blocked_by:
- 3
assignees:
- keen-cedar
created_at: 2026-07-07T00:00:22.673198288Z
updated_at: 2026-07-07T00:05:30.106435295Z
closed_at: 2026-07-07T00:05:30.106434745Z
---

Update public headers to use platform.h instead of Windows-specific includes:

1. Update `include/main/misc.h` — replace `#include <basetsd.h>` with `#include "platform.h"`. All UINT8 usages now come from platform.h.
2. Update `include/main/usb_functions.h` — replace `#include <windows.h>` with `#include "platform.h"`. Change HANDLE return/parameter types to DeviceHandle.
3. Update `include/main/keyboard.h` — remove `#include <windows.h>`, include "platform.h" instead.
4. Update `include/main/keyboards/abstract_keyboard.h` — remove `#include <basetsd.h>` and `#include <windows.h>`, include "platform.h". Change `HANDLE device_handle` to `DeviceHandle device_handle`.

Files:
- include/main/misc.h
- include/main/usb_functions.h
- include/main/keyboard.h
- include/main/keyboards/abstract_keyboard.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
id: 5
title: Update .cpp files to use DeviceHandle instead of HANDLE
type: task
status: closed
priority: 2
parent: 2
blocked_by:
- 3
assignees:
- keen-cedar
created_at: 2026-07-07T00:00:29.972305434Z
updated_at: 2026-07-07T00:08:09.393933013Z
closed_at: 2026-07-07T00:08:09.393932555Z
---

Update all .cpp files that reference HANDLE in the context of device handles to use DeviceHandle. The Windows .cpp implementation file can still cast back internally.

Files:
- src/blink/keyboard.cpp — update HANDLE → DeviceHandle
- src/blink/keyboards/sk80/sk80.cpp — same
- src/blink/keyboards/rk84/rk84.cpp — same
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
id: 6
title: Rename usb_functions.cpp to usb_functions_win.cpp
type: task
status: closed
priority: 2
parent: 2
blocked_by:
- 5
assignees:
- keen-cedar
created_at: 2026-07-07T00:00:39.854507271Z
updated_at: 2026-07-07T00:09:30.729474642Z
closed_at: 2026-07-07T00:09:30.729473817Z
---

Rename `src/blink/usb_functions.cpp` → `src/blink/usb_functions_win.cpp`.

Preserves all existing Windows code with no behavior change on Windows. This is a prerequisite for adding the Linux implementation file.

Files:
- src/blink/usb_functions_win.cpp (renamed from usb_functions.cpp)
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
id: 7
title: Implement usb_functions_linux.cpp using hidapi
type: feature
status: closed
priority: 1
parent: 2
blocked_by:
- 4
- 5
assignees:
- keen-cedar
created_at: 2026-07-07T00:00:53.456951290Z
updated_at: 2026-07-07T00:09:35.128606605Z
closed_at: 2026-07-07T00:09:35.128605780Z
---

Create `src/blink/usb_functions_linux.cpp` — Linux implementation using hidapi:

- `SearchForDevice(vid, pid, target_device_path)` → Use `hid_enumerate()` to find devices by VID/PID, match interface number, call `hid_open_path()`. Return the `hid_device*` cast to `DeviceHandle`.
- `SendBufferToDevice(handle, messages, count, length)` → Loop calling `hid_send_feature_report(dev, messages[i], length)` with a 1ms `usleep()` between sends.
- `SendBufferToDeviceAndGetResp(handle, messages, count, length)` → Call `hid_send_feature_report()` then `hid_get_feature_report()` for each message.
- `ListAvailableKeyboards()` → Use `hid_enumerate(0, 0)`, match against `known_keyboards`, return matches.
- Device close/cleanup via `hid_close()`.

### Byte-Perfect Mapping (Critical)

- `HidD_SetFeature(handle, buffer, 65)` → `hid_send_feature_report(dev, buffer, 65)` — identical semantics, buffer[0] is report ID
- `DeviceIoControl(IOCTL_HID_GET_FEATURE)` → `hid_get_feature_report(dev, buffer, 65)` — buffer[0] must be set to report ID (0x00)
- `Sleep(1)` → `usleep(1000)` (1ms delay between feature reports — critical for device stability)
- Device open: `CreateFile()` → `hid_open_path()`, Device close: `CloseHandle()` → `hid_close()`

Files:
- src/blink/usb_functions_linux.cpp (NEW)
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
id: 8
title: Add Linux device matching constants for SK80 and RK84
type: task
status: closed
priority: 2
parent: 2
blocked_by:
- 7
assignees:
- keen-cedar
created_at: 2026-07-07T00:01:02.747675470Z
updated_at: 2026-07-07T00:10:55.406438556Z
closed_at: 2026-07-07T00:10:55.406437914Z
---

Adapt target_device_path constants for Linux:

- Windows paths look like `\\?\hid#vid_05ac&pid_024f...`
- Linux hidraw paths look like `/dev/hidraw0` — hidapi uses a usage_page/interface_number filter instead
- For SK80/RK84 constants headers, add Linux-appropriate device matching criteria (usage page or interface number rather than a full path string)
- The VID/PID match plus interface number should be sufficient

Files:
- include/main/keyboards/sk80/constants_sk80.h — add Linux interface constant
- include/main/keyboards/rk84/constants_rk84.h — add Linux interface constant
Loading
Loading