Skip to content

feat(led): add D-Bus method to set LED effect, color and brightness - #734

Open
sknowledge1 wants to merge 1 commit into
ShadowBlip:mainfrom
sknowledge1:ayaneo3-rgb-20260924
Open

sknowledge1 wants to merge 1 commit into
ShadowBlip:mainfrom
sknowledge1:ayaneo3-rgb-20260924

Conversation

@sknowledge1

@sknowledge1 sknowledge1 commented Sep 24, 2026 •

Copy link
Copy Markdown

Problem

The AYANEO 3 joystick rings have built-in effects (monocolor, breathe and rainbow), but nothing in InputPlumber can select them. Cycling the color from software flickers on this device, so the built-in effects are the best option.

Solution

Two new methods on the existing org.shadowblip.Input.Source.LEDDevice D-Bus interface:

  • GetEffects returns the effects the LED supports (read from effect_index).
  • SetState(effect, (red, green, blue), brightness) writes the effect, color and brightness to the LED. Brightness is 0-255.

InputPlumber does not save the state. Userspace decides what to set and when to set it again, for example at startup.

Why this way

It reuses the existing LED color and brightness functions and adds one sysfs write for the effect. There are no new config options, no background thread and no saved files, so there is little to maintain. Each method has its own polkit action, and the existing inputplumber/wheel group rule already covers them.

The LED functions now return LedMcError instead of Box<dyn Error>, so the new code can use ?. Its separate read and write I/O errors become one, which removes the remaining map_err calls in the file.

Testing

Tested on an AYANEO 3: GetEffects returned monocolor breathe rainbow, SetState wrote each effect, color and brightness to sysfs, and an unknown effect returned an error. I did not check the lights by eye. cargo check, cargo clippy --all-targets and cargo fmt --check are clean.

Assisted-by: LLM

Comment thread src/config/mod.rs Resolved

@pastaq pastaq left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pleat have your AI reduce the complexity of this pr, keep descriptions and comments jargon free, and ensure that it's following the latest instructions in our AGENTS.md

This is exhausting to read in it's current state, and I didn't get through half of it before I had to stop.

All new features or concepts need a preamble that states what the problem it is trying to solve is, why this is the best way to do it, and it should emphasize readability and maintainability.

Comment thread docs/led-control.md Resolved
Comment thread src/config/mod.rs Resolved
@sknowledge1 sknowledge1 changed the title feat(led): manage native AYANEO 3 joystick lighting feat(led): add D-Bus method to set LED effect, color and brightness Nov 12, 2026
The AYANEO 3 joystick rings have built-in effects (monocolor, breathe and
rainbow), but nothing could select them. Software cycling the color flickers
on this device, so the built-in effects are the best option.

Add two methods to the LEDDevice D-Bus interface:

- GetEffects returns the effects the LED supports, read from `effect_index`.
- SetState(effect, (red, green, blue), brightness) writes the effect, color
  and brightness to the LED. Brightness is 0-255.

InputPlumber does not save the state. Userspace decides what to set and when
to set it again, for example at startup.

Each method has its own polkit action. The existing `inputplumber` and
`wheel` group rule already covers them.

The LED functions now return `LedMcError` instead of `Box<dyn Error>`, so the
new code can use `?`. Its separate read and write I/O errors become one, which
removes the remaining `map_err` calls in the file.

Tested on an AYANEO 3: GetEffects returned the three effects, SetState wrote
each effect, color and brightness to sysfs, and an unknown effect returned an
error.

The LLM wrote the two D-Bus methods, the new LED functions and the error
type changes, and ran the build and the device test. Prompt: reduce an
earlier, larger LED change to the smallest version that follows the review
comments and AGENTS.md, with no saved state and no new config options.

Assisted-by: LLM
@sknowledge1
sknowledge1 marked this pull request as ready for review November 12, 2026 21:48
@sknowledge1
sknowledge1 requested a review from pastaq November 12, 2026 21:48
@sknowledge1

Copy link
Copy Markdown
Author

changes as you mentioned implemented. thank you! 👍

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants