Closed EMPI-PL closed 5 months ago
Whilst I can easily recreate this (amiberry 5.6.1/linux/x86-64), after a bit of reading....
AFAICT earlier revisions of amiberry used the linux kernel sysfs interface to implement this feature...
...since then, use of the sysfs interface has been deprecated, and userspace programs should use libgpiod instead...
...in the amiberry Makefile, 'USE_GPIOD=1' has been commented out....
...amiberry 5.6.x has no cited dependency for libgpiod ....
It leaves me with the impression that the keyboard LED support (for power, floppy activity, etc) has yet to be re-implemented using the libgpiod API --- no doubt the project maintainer can confirm/deny my speculation here =)
The keyboard LEDs are used through ioctl
, but there are some cases were they don't seem to work due to how Linux works:
tty
and input
)Whilst I can easily recreate this (amiberry 5.6.1/linux/x86-64), after a bit of reading....
AFAICT earlier revisions of amiberry used the linux kernel sysfs interface to implement this feature...
...since then, use of the sysfs interface has been deprecated, and userspace programs should use libgpiod instead...
...in the amiberry Makefile, 'USE_GPIOD=1' has been commented out....
...amiberry 5.6.x has no cited dependency for libgpiod ....
It leaves me with the impression that the keyboard LED support (for power, floppy activity, etc) has yet to be re-implemented using the libgpiod API --- no doubt the project maintainer can confirm/deny my speculation here =)
@giantclambake That code relates to using the GPIO header pins for actual activity LEDs, not the same as using the keyboard LEDs. It's optional but since some people requested that, it's now available in the Makefile (you'll have to enable it if you want to use it).
@midwan Thanks for the clarification
The keyboard LEDs are used through
ioctl
, but there are some cases were they don't seem to work due to how Linux works:
- the user needs permissions to control them, by being a member in a relevant group (from what I recall,
tty
andinput
)- the console/tty Amiberry was launched from is important. See related issue on the DietPi distro as an example: Amiberry activity leds (DF0: etc.) not working MichaIng/DietPi#5536
I went over your link @midwan to the bug with DietPi.
Running setleds +num
from console results with the following error:
setleds unable to read keyboard flags inappropriate ioctl for device
I'm not sure if it helps in any way but thought it may be useful.
//Adding this, Debian 10.13/amiberry v5.6.1
From X environment (xterm);
gcb@gallah:~$ setleds setleds: Error reading current flags setting. Maybe you are not on the console?: ioctl KDGKBLED: Inappropriate ioctl for device
...follow on with...;
Alt-F2 --> login on tty2 ---> setleds works as expected (no error)
//....just digging this further --- be mindful this is relative to Xorg desktop environment ...but first...
@EMPI-PL
Try this (user must be in sudoers list) ;
//turn capslock ON
sudo bash -c "/usr/bin/setleds -D +caps < /dev/console"
//turn capslock OFF
sudo bash -c "/usr/bin/setleds -D -caps < /dev/console"
That should work from a xterm but unfortunately needs root permissions....
In the Xwindows environment, you have to do something like this;
//runtime -- changes are volatile and lost after logout/reboot....
xkbcomp $DISPLAY myconf.xkb //dump current xkb configuration
nano myconf.xkb --> search for the following fields and remove the exclamation marks before allowExplicit;
indicator "Caps Lock" {
!allowExplicit;
whichModState= locked;
modifiers= Lock;
};
indicator "Num Lock" {
!allowExplicit;
whichModState= locked;
modifiers= NumLock;
};
indicator "Scroll Lock" {
!allowExplicit;
whichModState= locked;
modifiers= ScrollLock;
};
Save the edited file and load it as the current xkb config;
xkbcomp myconf.xkb $DISPLAY
Now the following commands should work ;
//turn capslock ON
$ xset led named 'Caps Lock' //alternately you can address LEDs by number 1-3 ...ie; xset led 1
//turn capslock OFF
$ xset -led named 'Caps Lock' // xset -led 1
// //Permanent system wide changes -- non-volatile .... //
Edit /usr/share/X11/xkb/compat/{ledcaps,lednum,ledscroll}
Remove the exclamation mark before allowExplicit; ( !allowExplicit; -> allowExplicit; ) in each file and save
Logout of X and log back in again --- now the following commands should work as normal user
$ xset led named 'Caps Lock' //alternately you can address LEDs by number 1-3 ...ie; xset led 1 $ xset -led named 'Caps Lock' // xset -led 1
This won't fix the status-quo obviously, as amiberry isn't using xset nor XChangeKeyboardControl() to control the keyboard LEDs in an xsession ...but perhaps it can?
Note: if you are using a wireless keyboard, the power management in the keyboard itself will turn off LEDs after a set time of keyboard inactivity (usually 5 ~ 10 seconds, save battery) ....I really doubt there's any way around this ; wired keyboards are fine however.
HTH
edit: Just FTR & FWIW, the LED functions work correctly when launching amiberry from console
Not sure where we are with this one, but I will close it since we've had no updates for about a year now.
Describe the bug When DFx is in use numlock will not flash even with the option marked under Miscellaneous. In fact no flashing whatsoever also for Caps and Scroll.
To Reproduce Simple. Just mark the option and it should work, but... Key note. In my build I use the following "addons" to RPi.
Expected behavior It should flash numlock/drive led as the floppy is read.