Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LED status beyond 0x07 #402

Open
plainlystated opened this issue Jan 23, 2023 · 1 comment
Open

LED status beyond 0x07 #402

plainlystated opened this issue Jan 23, 2023 · 1 comment

Comments

@plainlystated
Copy link

I'm trying to grab the "microphone muted" LED status from the HID library, but it seems like the library only supports a select few statuses out of the box: #151

It seems like 0x21 might be the position of the LED I'm looking for. (FWIW, the laptop keyboard does have an LED for this)

I've tried messing with the three 0x07 values here and changing the signature to uint16_t here, but my c++ isn't strong and it's giving no results at all, so I've broken something...

In my searching, I've seen other people ask about this but haven't found a working example. I've seen some of your comments about it being tricky/non-standard, so not sure if there's a way to pull it off. Any guidance would be appreciated!

Thanks,
Patrick

@qistoph
Copy link

qistoph commented Jul 3, 2024

I'm also curious to get this to work, because it would create a nice way to standardize typical status LEDs on custom keypads. My focus is on a mute toggle switch with indicator.

In my LEDs branch the library is adapted to support 16 bits of LED status. Names have been adopted from the HID Usage Tables 1.5. Also the KeyboardLed example is updated to show all 16 bits of LED information.

Attaching my Arduino Pro Micro with this sketch to my Ubuntu 24.04 laptop shows an additional LED:

# ls -alhd /sys/class/leds/input69\:\:*/
drwxr-xr-x 3 root root 0 Jul  3 21:38 /sys/class/leds/input69::capslock/
drwxr-xr-x 3 root root 0 Jul  3 21:38 /sys/class/leds/input69::compose/
drwxr-xr-x 3 root root 0 Jul  3 21:38 /sys/class/leds/input69::kana/
drwxr-xr-x 3 root root 0 Jul  3 21:38 /sys/class/leds/input69::mute/
drwxr-xr-x 3 root root 0 Jul  3 21:38 /sys/class/leds/input69::numlock/
drwxr-xr-x 3 root root 0 Jul  3 21:38 /sys/class/leds/input69::scrolllock/

Manually toggling the mute LED does trigger and show an update of the status as expected:

Linux:
# echo 1 > /sys/class/leds/input69\:\:mute/brightness 
# echo 0 > /sys/class/leds/input69\:\:mute/brightness 

Arduino:
LEDs: 0000000100000000
LEDs: 0000000000000000

Next steps (suggestions on achieving this are very welcome):

  • Getting Ubuntu to trigger the mute LED on mute/unmute
  • Getting Ubuntu to recognize additional LEDs

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

No branches or pull requests

2 participants