Skip to content

Tool for controlling color of A4Tech Bloody keyboard

Notifications You must be signed in to change notification settings

x1b6e6/a4keyboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

a4keyboard

Tool for controlling color of A4Tech Bloody keyboard

Rewritten apo5tol project to use HID-BPF for better user experience

Why not original project

Original apo5tol's bloody_keyboard_rgb_control project use libusb library for communication with device. This library must detach HID driver from device and only then device will be available to communication. While HID driver is detached from device any keys pressed at this time will be missed. Duration of original script more than 1 second - that is a lot.

Current project use HID-BPF what provides communication with device without detaching HID driver from device. Any pressed keys while program is running will be correctly processed by HID driver. Duration of my program is ~30ms (color command) whats take possibilities to make animations by user scripts (per key colors is not supported at now).


Install dependencies

  • Archlinux

    pacman -Sy --needed cmake clang ninja bpf libbpf lib32-gcc-libs

Building

Only ninja generator is supported at now

Only clang compiler is supported at now

cmake -Bbuild -GNinja \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_C_COMPILER=clang \
    -DCMAKE_CXX_COMPILER=clang++  \
    -DCMAKE_BPFTOOL=bpftool \
    -DCMAKE_INSTALL_PREFIX=/usr

# Install to the system. Files:
#   /usr/bin/a4keyboard
#   /usr/lib/udev/rules.d/80-a4keyboard.rules
sudo cmake --build build --target install/strip

# Set white color at boot (can be changed)
COLOR=FFFFFF
sed -e "s@init@color $COLOR@" /usr/lib/udev/rules.d/80-a4keyboard.rules | \
    sudo tee /etc/udev/rules.d/99-a4keyboard.rules

# Reload udev rules for automatic prepare keyboard after re-plug or at system boot
sudo udevamd control --reload

# prepare keyboard
a4keyboard init # or just reconnect keyboard

Using

a4keyboard color f00 # set red color (short form)
a4keyboard color 00FF00 # set green color (long form)

About

Tool for controlling color of A4Tech Bloody keyboard

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published