// The openrazer module's Go tools bundle (novox/hq ADR 0188, ADR 0193, ADR 0208): the Razer // peripherals' kernel driver and the account's daemon that speaks to it, served by the node's runtime // as the operator account. The module holds no seat, so every tool is its own. The tray that drives // the daemon is the polychromatic module's. package main import ( "fmt" "os" stdio "git.novox.be/novox/mesh-sdk/go" ) func main() { if err := stdio.Serve("", tools()); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } } var machine = NewMachine() func tools() []stdio.Tool { return []stdio.Tool{ { Name: "openrazer_status", Description: "The Razer stack: the installed versions, the driver (built by DKMS for the running " + "kernel or not, its kernel modules loaded, the devices bound to it), the account's openrazer " + "group (in the group file, and in its running service manager), the daemon (its unit's state, " + "its process, its version) and each device the daemon sees: name, type, firmware, battery. " + "Asks the daemon without starting it. (r)", Run: func(map[string]any) (any, error) { return machine.Status() }, }, { Name: "openrazer_restart", Description: "Restart the daemon through its unit in the account's service manager (the unit D-Bus " + "activation starts), and answer its state and the devices it then sees. Needs the account " + "logged in. (a)", Run: func(map[string]any) (any, error) { return machine.Restart() }, }, { Name: "openrazer_check", Description: "Check what the module promises and relies on: the packages are installed; the driver " + "is built for the running kernel and loaded; the account is in the openrazer group, and its " + "service manager has it; the daemon runs once, from its unit, and sees the devices the driver " + "has. Answers ok and each finding with what to do. (r)", Run: func(map[string]any) (any, error) { return machine.Check() }, }, } }