Skip to content

ehettervik/jieli-volume-knob-daemon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

🎛️ USB Volume Knob (Jieli AU Knob) — Python HID Daemon for KDE Plasma

A tiny Python daemon that turns a cheap Jieli‑based USB volume knob into a fully integrated KDE media controller. It reads the device’s raw USB HID packets, interprets rotation + button presses, and triggers KDE’s native media shortcuts.

This gives you:

  • KDE’s volume popup when turning the knob

  • Smooth, adjustable volume control

  • Play/pause on Dial Press

  • Next/previous track support

  • Zero CPU usage when idle

  • Automatic recovery if the kernel steals the HID interface

  • Autostart support (KDE or systemd user service)

This script behaves like a custom driver, without touching the kernel.

🧩 Supported Device

This script is built for the common Jieli‑based USB volume knobs sold under many names.

USB IDs:

  • Vendor: 0x4c4a

  • Product: 0x4155

If your knob reports those IDs, this script will work.

📦 Required Packages

Install these system packages:

bash

sudo apt install python3 python3-usb xdotool playerctl

Why these?

  • python3-usb — talks directly to the USB HID interface

  • xdotool — sends KDE’s volume + play/pause key events

  • playerctl — handles next/previous track reliably via MPRIS

🔧 Udev Rule (Required)

To allow the script to access the knob without sudo, create:

Code

/etc/udev/rules.d/99-jieli-knob.rules

With:

Code

SUBSYSTEM=="usb", ATTR{idVendor}=="4c4a", ATTR{idProduct}=="4155", MODE="0666"

Reload rules:

bash

sudo udevadm control --reload-rules
sudo udevadm trigger

Unplug/replug the knob.

🐍 Running the Script

Place the script anywhere (recommended: ~/.local/bin/Knobbie.py) and run:

bash

python3 ~/.local/bin/Knobbie.py

You should see:

Code

KDE Volume Knob Daemon Running...

Turn the knob — KDE’s volume popup should appear.

🚀 Autostart on Login (KDE Plasma)

Create:

Code

~/.config/autostart/knobbie.desktop

Contents:

ini

[Desktop Entry]
Type=Application
Exec=python3 /home/eric/.local/bin/Knobbie.py
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=Knobbie
Comment=Custom KDE volume knob daemon

Now it launches automatically every time you log in.

⚙️ Features

  • Reads raw USB HID packets

  • Self‑healing: reclaims interface if kernel steals it

  • Adjustable volume speed (VOLUME_DELAY)

  • KDE‑native volume popup

  • Play/pause button

  • Next/previous track

  • Zero polling — event‑driven

  • Runs as a normal user

🧠 How It Works (Short Version)

The knob sends tiny 1‑byte HID packets:

Code Meaning
1 Volume Up
2 Volume Down
8 Button Press
16 Next Track
32 Previous Track

The script:

  • Claims the USB interface

  • Reads packets from the interrupt endpoint

  • Maps them to KDE media keys

  • Uses xdotool + playerctl to trigger system actions

It’s basically a user‑space HID driver.

📝 License

MIT License

About

Linux support for Jieli and other 0x4155 USB Volume Knobs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages