Code Monkey home page Code Monkey logo

a4keyboard's Introduction

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)

a4keyboard's People

Contributors

x1b6e6 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.