Skip to content

About

A native OnlyKey time setter

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

17 Commits

Folders and files

Repository files navigation

onlyKeySetTime Go Report Card

An OnlyKey set time, implemented on GO. This project only need a system with udev to run (or binary usage only), no more Py script. Because it is a cool first Go project and i don't like Py (especially 2.7)

This udev rules are base on official rules, but add (0x1d50, 0x60fc) and (0x16C0, 0x0486) devices support into.

Requirements

  • Linux with udev, and sudo for the installation
  • Go 1.25.7 or later
  • A C compiler (gcc or clang): the USB library is built with cgo

Installation

With make

git clone https://gitlab.com/adrienK/onlyKeySetTime.git
cd onlyKeySetTime
make build
make install

make install refuses to run until make build has produced an up-to-date binary. Run both as your own user, make install calls sudo itself. It installs the binary and the udev rules, creates the onlykey group and adds you to it. Log out and back in for the group to take effect, then unplug and reconnect the OnlyKey.

By hand

The same steps as make install:

git clone https://gitlab.com/adrienK/onlyKeySetTime.git
cd onlyKeySetTime
CGO_ENABLED=1 go build -o bin/onlykey-settime
sudo cp bin/onlykey-settime /usr/local/bin/onlykey-settime
sudo cp 49-onlykey-settime.rules /etc/udev/rules.d/49-onlykey-settime.rules
sudo groupadd -r -f onlykey
sudo usermod -aG onlykey "$USER"
sudo udevadm control --reload

The binary must be installed as /usr/local/bin/onlykey-settime, the path the udev rules call. Then log out and back in, and reconnect the OnlyKey.

Update

git pull
make build
make update

make update only replaces the installed binary. When 49-onlykey-settime.rules has changed, run make install instead, it is safe to run again.

Binary only

make build

The binary is written to ./bin.

For cross-compiling, the USB library needs cgo, so give make a C cross compiler for the target through CC. Without it the build stops with an error.

make build GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc

This writes bin/onlykey-settime_linux_arm64. On the target, install it as /usr/local/bin/onlykey-settime and follow the other steps of the installation by hand.

Clean and Uninstall

For clean repos

make clean

For uninstall

make remove

Or by hand:

sudo rm -f /usr/local/bin/onlykey-settime /etc/udev/rules.d/49-onlykey-settime.rules
sudo udevadm control --reload

The onlykey group is kept, other OnlyKey tools may rely on it. Remove it with sudo groupdel onlykey if nothing else uses it.

License

MIT License, see LICENSE.

About

A native OnlyKey time setter

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages