gbmonctl
gbmonctl copied to clipboard
CLI control utility for Gigabyte M32U monitors over USB (to not use OSD sidekick)
#+TITLE: Gigabyte Monitor control
- Introduction
A CLI tool to change monitor settings over USB to the Gigabyte M32U
- Supported monitors
- Gigabyte M32U
In theory any Gigabyte Monitor that uses a Realtek HID device (presumably the M28U also uses this) to control it over OSD sidekick should have the same protocol, but this is the only one I own.
- To install:
You'll need libhidapi and libudev -- on Debians that's ~apt install libhidapi-dev libudev-dev~, and on darwin you can use ~brew install hidapi~
#+begin_src sh go install github.com/kelvie/gbmonctl@latest #+end_src
** Mac specific steps: On Mac, you might run into an error like this when running the above command:
#+begin_src sh
github.com/sstallion/go-hid
/Users/dport/go/pkg/mod/github.com/sstallion/[email protected]/hid.go:38:10: fatal error: 'hidapi/hidapi.h' file not found #include <hidapi/hidapi.h> ^~~~~~~~~~~~~~~~~ 1 error generated. #+end_src
This means ~go~ cannot find the headers / library for ~hidapi~. To fix this, tell ~go~ where to find them. First, figure out where ~hidapi~ is: #+begin_src sh $ brew info hidapi | grep files /opt/homebrew/Cellar/hidapi/0.12.0 (19 files, 185KB) * #+end_src
Now try to install ~gbmonctl~ like this:
#+begin_src sh CGO_CFLAGS='-I/opt/homebrew/Cellar/hidapi/0.12.0/include' CGO_LDFLAGS='-L/opt/homebrew/Cellar/hidapi/0.12.0/lib' go install github.com/kelvie/gbmonctl@latest #+end_src
- To use:
#+begin_example ~ ~/go/bin/gbmonctl ERROR: -prop or -propNum is required
Usage of gbmonctl: -n Dry run: test commands and print instead -prop string Property to set. Available properties: brightness (0-100) contrast (0-100) sharpness (0-10) low-blue-light (0-10) Blue light reduction. 0 means no reduction. kvm-switch (0-1) Switch KVM to device 0 or 1 colour-mode (0-3) 0 is cool, 1 is normal, 2 is warm, 3 is user-defined. rgb-red (0-100) Red value -- only works if colour-mode is set to 3 rgb-green (0-100) Green value -- only works if colour-mode is set to 3 rgb-blue (0-100) Blue value -- only works if colour-mode is set to 3 -propNum uint Property number to set instead of -prop -val int Value to set property to (default -1)
#+end_example
Examples: #+begin_src sh
Set brightness to 50
gbmonctl -prop brightness -val 50
Set contrast to 50
gbmonctl -prop contrast -v 50
Set sharpness to 5
gbmonctl -prop sharpness -v 5
Set colour temperature to 2700K for nighttime
gbmonctl -prop colour-mode -val 3 gbmonctl -prop rgb-red -val 100 gbmonctl -prop rgb-green -val 66 gbmonctl -prop rgb-blue -val 35 #+end_src
When using propNum, I don't recommend using values that are out of the ranges listed, and this program doesn't check, so I'm not liable for monitor damage that occurs from this.
-
Other notes ~fwupd~ seems to delete the hidraw device that this uses, so you will have to disable fwupd and re-plug in your monitor (hit the KVM switch on the side), see https://github.com/kelvie/gbmonctl/issues/1
-
TO-DO
- Get the rest of the commands
- Make more user friendly