Closed midwan closed 7 years ago
@midwan Misc menu, keyboard LED assignments for DF0: work fine on Raspbian using v2 binary?
Not able to test right now, but the DF* setting definitely works. It will turn the led on fire any floppy drive access (e.g. DF0, DF1, DF2, etc).
Only the power led setting does not quite work yet.
On Sep 24, 2016 18:13, "Dan" notifications@github.com wrote:
@midwan https://github.com/midwan Misc menu, keyboard LED assignments for DF0: work fine on Raspbian?
β You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/midwan/uae4arm-rpi/issues/3#issuecomment-249372861, or mute the thread https://github.com/notifications/unsubscribe-auth/ADsp9WNaA0wfPv1TvC_sXK2UsOfwOECXks5qtUwkgaJpZM4J2SnT .
@midwan
Not able to test right now, but the DF* setting definitely works. It will turn the led on fire any floppy drive access (e.g. DF0, DF1, DF2, etc).
Thanks. Will give me something to test against π
Notes:
#-------------------------------------------------------------------------------
#AmiBerry LED test, run as standard user:
# useradd amiberry
# usermod -a -G input amiberry
# usermod -a -G video amiberry
# usermod -a -G audio amiberry
# usermod -a -G root amiberry
# sed -i '/allowed_users=/c\allowed_users=anybody' /etc/X11/Xwrapper.config
# cd /etc/uae4arm-rpi && sudo -u amiberry xinit /etc/uae4arm-rpi/uae4arm-rpi -f /etc/uae4arm-rpi/conf/autostart.uae &> /dev/tty1
# cd /etc/uae4arm-rpi && xinit /etc/uae4arm-rpi/uae4arm-rpi -f /etc/uae4arm-rpi/conf/autostart.uae &> /dev/tty1
# chown -R amiberry:amiberry /mnt/dietpi_userdata/uae4arm-rpi
Raspbian:
DietPi:
xinit
= noxinit
= yesRaspbian:
DietPi:
root@DietPi:~# su -c 'cd /etc/uae4arm-rpi; /etc/uae4arm-rpi/uae4arm-rpi -f /etc/uae4arm-rpi/conf/autostart.uae' amiberry
Amiberry v2.0 build 2016-09-19.1
Unknown keycode to use, will use keysym
starting sound thread..
IP: 0x2dd21c [e5953008] 0xa33e4008
bash: line 1: 1562 Segmentation fault /etc/uae4arm-rpi/uae4arm-rpi -f /etc/uae4arm-rpi/conf/autostart.uae
root@DietPi:~# usermod -a -G tty amiberry
root@DietPi:~# su -c "cd /etc/uae4arm-rpi; /etc/uae4arm-rpi/uae4arm-rpi -f /etc/uae4arm-rpi/conf/autostart.uae &> /dev/tty1" amiberry
bash: line 1: 1628 Segmentation fault /etc/uae4arm-rpi/uae4arm-rpi -f /etc/uae4arm-rpi/conf/autostart.uae &> /dev/tty1
root@DietPi:/etc/uae4arm-rpi# cd /etc/uae4arm-rpi && sudo -u amiberry /etc/uae4arm-rpi/uae4arm-rpi -f /etc/uae4arm-rpi/conf/autostart.uae
Amiberry v2.0 build 2016-09-19.1
Unknown keycode to use, will use keysym
starting sound thread..
IP: 0x2dd21c [e5953008] 0xa3441008
#Works with xinit, but no LED's
cd /etc/uae4arm-rpi && sudo -u amiberry xinit /etc/uae4arm-rpi/uae4arm-rpi -f /etc/uae4arm-rpi/conf/autostart.uae
So, as far as I can tell, to get LEDS working:
amiberry
) must be logged in, and, launch the binary manually, without xinit
.amiberry
with su
or sudo -u
results in a seg fault or failure.testleds
when logged in as non-root user (amiberry
) is finetestleds
under user amiberry
with sudo -u amiberry ./testleds
has no effectsetleds +num
works as root and non-root
cat << _EOF_ > /root/test.sh
#!/bin/bash
LEDSTATE=0
while true
do
if (( \$LEDSTATE == 0 )); then
setleds +num
LEDSTATE=1
else
setleds -num
LEDSTATE=0
fi
sleep 0.1
done
_EOF_
chmod +x /root/test.sh
Then run /root/test.sh
from main term
Find sourcecode for setleds
and see if they are using ioctl.h
https://fossies.org/dox/kbd-2.0.3/setleds_8c_source.html
Does indeed use ioctl:
static int
94 setleds(char cur_leds) {
95 if (ioctl(0, KDSETLED, cur_leds)) {
96 kbd_warning(errno, "ioctl KDSETLED");
97 return -1;
98 }
99 return 0;
100 }
@midwan
Ok, Findings:
setleds +num
works as root and non-root. The sourcecode for this also uses ioctl
(https://fossies.org/dox/kbd-2.0.3/setleds_8c_source.html)testleds
only works when logged in as non-root user (eg: amiberry).Maybe this is a SDL issue?
As far as I can tell, setleds +num
does the same thing, yet works every time, regardless of user who launched it.
@Fourdee thanks for the detailed testing feedback! :)
Ok, to clarify if this is in any way related to either a) DispManX or b) SDL1.2, I've prepared the following tiny tool that will test the LEDs from the console. No DispmanX and SDL is initialized or used, just pure ioctl().
It works on Raspbian with both a normal user (pi) and when run with sudo. I'm also attaching the source, in case you want to poke around.
Edit: this works in DietPi as well. :) I will now create a test tool that uses SDL2 and one with SDL1, to check if either one is causing this.
Update: I just tested a binary using SDL2, it works normally in DietPi.
I think we can finally close this then. It seems that it's related to DispmanX when used as a back-end for SDL1 screens. SDL2 does not need/use it, and it does not suffer from this problem.
Therefore, we can safely say that when the SDL2 port is complete, this issue should be resolved "for free" with it. :)
To test the binary, you can use the following package: guisan.zip
It has one requirement: SDL2 library
However, it may not work correctly with the default libsdl2 package delivered through apt-get, as I believe that requires X11 in order to open a screen. Instead, you can use the binary package from libsdl.org (attached below), to avoid compiling your own.
It's compressed with ZIP on top, to allow it to be attached here. It contains the whole dir structure with the files, though you only need the ones contained in "lib" for the binary. Careful to keep the symlinks contained there intact. ;)
@midwan
Update: I just tested a binary using SDL2, it works normally in DietPi. I think we can finally close this then.
π Awesome, great stuffπ
sdl-raspberrypi-1403.tar.xz.zip
Excellent, i'll give this a spin π
@Fourdee I've managed to fix this for the SDL1.2 branch also. The requirements are:
Do you think we could plan for an update in the DietPi distribution, using the latest binaries with the fixes?
Closing issue as it has been resolved in both SDL1.x and SDL2 branches, as long as the requirements are ment:
The keyboard LEDs (Scroll Lock, Num Lock) do not work as expected when they are assigned functions like drive activity, from within the emulator.
This works if the emulator is running under Raspbian, but not in DietPi. However, the following scenario applies:
xinit
, but not when running in the console framebuffer. However, the functions assigned to the LEDs do not work when running underxinit
.xinit
.Note: The code uses calls to
ioctl()
(#include <sys/ioctl.h>) to get and set the keyboard LED status.