mishamyrt / nuga-lib

⌨️ Go interface for BYK916 NuPhy® keyboards
MIT License
4 stars 1 forks source link
byk916 nuphy reverse-engineering usb-hid

Nuga library Logo

Nuga library

Go interface for BYK916 NuPhy® keyboards


This library provides the ability to control keyboard parameters through the HID USB interface. It is used in Nuga.app.

Usage

First of all, add a library module to your project.

go get -u github.com/mishamyrt/nuga-lib@latest

Use the nuga.Open() method to get the keyboard controller. It allows you to control the keyboard. For example, the brightness can be changed.

package main

import (
    "github.com/mishamyrt/nuga-lib"
)

func main() {
    // Setup HID
    nuga.Init()
    defer nuga.Exit()
    // Open connection with keyboard
    device, _ := nuga.Open()
    // Read current effects
    effects, _ := device.Features.Light.GetEffects()
    // Set brightness to 50%
    effects.Backlight.SetBrightness(2)
    // Write effects
    _ = device.Features.Light.SetEffects(effects)
}

Terminology

Protocol

The library is based on reverse-engineering of the keyboard protocol. The knowledge that was obtained is recorded in the docs folder.

Trademarks

NuPhy® is a registered trademark of NuPhy Studio. Nuga is an unofficial product and is not affiliated with NuPhy Studio.