The actual code is now complete! Well there is still the tray features I want to add but that’s about it. Since there is a lot I did this time around I’ll split this into parts based on what changes I made.
Refactoring Code
This time around I refactored literally the entire codebase. Nearly every function has been changed in some way, whether it be small changes like variable names or parameters, or big changes like merging entire files. There are hardly any comments since I wanted the code itself to be clear enough to anyone trying to understand the code. The main exception to this rule is in purego code, where I have comments explaining which headers constants or data structures come from.
HID Updates
I swapped from “github.com/sstallion/go-hid” to “rafaelmartins.com/p/usbhid” since the former is written in CGO, while the latter is written in purego. Functionality is the exact same, the only differences are in the function definitions and data types. Only one minor change was made which is adding a magic hex header to all data which is sent, which allows a HID device identify whether data is being sent from KIN or some other source.
Tray Icon
I finally updated the tray icon to something more appropriate. I made 3 versions of the icon using Aseprite. The first is the primary version used on Windows and Linux in most situations. The second is a low resolution version which is used only on windows in Low-DPI situations. The third is a monochrome icon which MacOS uses as a NSImage template image. The new icon looks pretty decent on all platforms imo.
The demo attached uses my hackpad to demonstrate data being transmitted from device to my hackpad over HID, which is then logged through QMK.