-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Keyboard LEDs assigned to drives don't work in DietPi (work in Raspbian) #3
Comments
This ideally should be part of one fix which includes the Caps Lock detection when running from the console, so that we eliminate the need to start it with |
@midwan Note to self: |
Yes, I believe that should be the target eventually. I've already started working in this direction, we'll see how it goes in the following days. |
- Added LED_DFs define - Calling LED_POWER when emulation starts (does not work yet) - Simplified configuration regarding LEDs - Added support for CD LED assignment
There is a known issue with the Caps Lock LED/flag in Raspbian, as shown here: A temporary workaround is to run which restores the "normal" behavior for the key (both LED and flag are turned on/off when pressing the key after that). But this does not survive reboots of course. I also tested it under UAE, and it works correctly when started from the console. The LED does not turn on in DietPi, but the flag does change. Will test the same in Raspbian also to compare. |
Confirmed working in Raspbian, including turning the Caps Lock LED on under emulation (when started from the console). This brings us to the difference between DietPi vs Raspbian: The below is a simple program I used to test this. The result should be that all keyboard LEDs should start flashing in a loop, until you hit Ctrl-C to cancel. It runs from the console:
Binary also attached below. Edit: I actually found out what's causing this. :) In the code sample above, I'm using /dev/console as the console to apply LED changes. But in Amiberry we have switched the console to tty3, so of course it doesn't work! If I change the code to use /dev/tty1 then the LEDs work as expected. |
@Fourdee this means that we can get rid of xinit during startup, once I test that everything works correctly. I'll change the UAE code a bit, since it's now hardcoded to use 0 (zero) as the console, instead it should fetch /dev/tty1 from the system. Once I test that everything works, I'll post new binaries in Dropbox. I still didn't get it to turn on the "POWER" led, but we can fix that later. |
Hmm, nope. It works in Raspbian, but still doesn't work in DietPi for some reason. :-/ |
Yep, very likely, leave it with me i'll take a look today.
👍 |
Strange, as far as I can tell, all the includes use libc6-dev: https://packages.debian.org/search?suite=jessie§ion=all&arch=any&searchon=contents&keywords=sys%2Ftypes.h
Binaries are already installed:
I was going to compile and test, but the only keyboard I have with Num/scroll/caps LED is a ps/2, and no converter lol. |
NotesBorrowing my misses keyboard, has a num lock LED !!! Checking kernel versionsRaspbian:
DietPi:
Revert back to 4.4.11
🈴 No effect Checking logs:
🈴 No errors found Trying Raspbian
|
Most likely an undocumented configuration on the Raspbian image. I'll recreate the DietPi image from latest Raspbian, then test LED. |
Thanks for your efforts! On Sep 13, 2016 14:27, "Dan" notifications@github.com wrote:
|
To clarify, if you change the source code line above: to this: and compile, the tool works correctly in both Raspbian and DietPi from the console. Binary version is attached below. It's within UAE that things break down. It works in Raspbian but not in DietPi, even when using the same code... :-/ |
Bizzare. Are you running the setled binary over SSH? I get:
EDIT:Works on main screen, let me do some more tests. |
I run it on the actual device (not over SSH). Did you see the LEDs blinking while it's running? that's what it's supposed to do. |
Only when I press Numlock, then capslock comes on, press capslock, numlock goes off lol. Keyboard lacks scroll lock. |
Hm, it should flash all the LEDs constantly and repeatedly, until you cancel it with Ctrl-C. At least that's how it behaves here in both my environments. Edit: maybe the lack of a Scroll Lock causes the error you get, and that may be why it doesn't loop. If that key does not exist, then the code that tries to enable/disable it with ioctl() would probably give an error. Give me a minute to compile a version without Scroll Lock so we can verify this. I just flashed over a fresh AmiBerry image to try #3 again, so I'll test it there as well to see. |
Its a cheap china-town USB wifi keyboard, probably to blame :) |
Try with this version, it skips over the Scroll Lock key: |
Haven't managed to find a solution yet, but some more details that might help us:
Note: It's not only DietPi that doesn't work with this, Minibian has the same problem from what users reported. I'll keep looking... |
@Fourdee I've updated the emulator binaries, to fix a bug that caused it not to load the assigned LED functions from the config file correctly (the first entry was always ignored). I was waiting to fix the LED issue here before I push this, but since I see it will take some time, maybe it's better to have it out. |
I may have discovered something. Out of curiosity, I flashed a fresh Raspbian Lite to a new card and tried from scratch. I followed these steps:
then tried UAE. The LEDs did not work - same as in DietPi. That means that there is a difference between my developer environment/full Raspbian image and this one. At least we know it's not as isolated to other distros as we thought. |
I tried a fresh full Raspbian image yesterday also, and in a real WTF moment I discovered that it didn't work there as well. I did a quick check for differences in the installed packages, and even installed some of the dev packages that I had as extra on my "dev Raspbian" (where the LEDs work), but it didn't make a difference. I'm beginning to suspect that it's not a package but rather some configuration, but I'll need more time/tests to narrow this down. I don't remember doing much customization in the Raspbian installation that I use as a development environment. Next steps:
|
Confirmed that it still works with the latest binary in my dev-Raspbian image, but not in a stock Raspbian. Will now try to incrementally bring this image up to the same level as my Dev, to find out what the difference that makes it work is. |
Update: It seems that the thing that doesn't work in the default Raspbian, is the Scroll Lock LED. The Num Lock one does work, when assigned a function through UAE. I tested this in both Raspbian Lite and Raspbian, with the same results. With this new information, I believe we can move the investigation to the next level:
|
Trying to make some sense before we lose it completely... :) I followed these steps, and these steps only:
So we know that a stock Raspbian (Lite) has the LEDs working, with the exception of the Scroll Lock one which needs the extra fix (which we have in DietPi already). This gives us a relatively minimal system to compare against a normal DietPi installation for differences. |
Ah yes, forgot about this one. 👍 Correct, applied by default to all DietPi RPi systems as per your suggestion.
Nearly, on a base system, DietPi has less installed packages. Not sure of the exact figure currently, but a while back we had 140~ less installed packages: https://docs.google.com/spreadsheets/d/1mDHGZC-H6tU6_O8kuLTG8d4A8Nt7lV1Q7MXTR_6qw30/edit#gid=0 Heres the package difference when AmiBerry is installed on DietPi:https://www.diffchecker.com/o8zdyBFN
If we can isolate a single test I can run to get a definite result, I'll be able to re-do all my tests and hopefully provide some assistance. Ideally, if we can have a single binary that turns of Num lock, then exits? Would this test cover the current issue? |
I tried starting with Raspbian Lite and following the steps you provided above also:
Err http://mirrordirector.raspbian.org jessie Release.gpg So I couldn't test it further... |
sdl2_test.zip This binary also uses DispmanX and SDL2 on top, and works fine on a normal Raspbian (Lite) distro, I get the same message in Lite, but then it opens up a display and does it's job without problems. On DietPi, it just returns to the prompt. Edit: I'm attaching the binary here in case you want to test it. The packages it needs are: What this binary is supposed to do is open a display, show a rainbow box test image first, then change the color of the screen a few times before exiting to the prompt again. |
@Fourdee Notes:
|
Excellent testing and details 👍 Going to focus on getting v131 released today, however, I've ordered a USB keyboard with LEDs on it: https://www.amazon.co.uk/Microsoft-Wired-Keyboard-200-Layout/dp/B0041SKBGK/ref=sr_1_1?s=computers&rps=1&ie=UTF8&qid=1474380457&sr=1-1&keywords=usb+keyboard Once I've got it, i'll go through your results and see if I can replicate. Hopefully, this keyboard will give me a viable way to testing the LED's are working, then the debugging can begin :) |
Great, let's hope we'll find out what's going on. :) That theory explains the mouse pointer shown, and the LEDs not working - since if you go in an X environment the ioctl() calls to the keyboard no longer change the LED status. I'm not sure why it doesn't work though. Are you removing anything from Either that, or it's a configuration issue in the system somewhere. |
One more thing to test:
Of course, this is temporary (it will go away on the next reboot), so if we implement it it should be part of the startup. Unless you know a way to make it more "permanent" that is. If using the above allows the Caps Lock to work normally within UAE (i.e. press it and the LED turns on, letters are capitals), from a console startup, then we can get rid of This approach works in Raspbian, I didn't test it in DietPi yet. |
I tested it in a fresh installation of DietPi v131, unfortunately it's still the same regarding the LEDs. I did notice a different behavior compared to my earlier tests, regarding the SDL2 stuff. My test program worked this time, after following these steps:
Although the display worked, and testing the "testleds" program does not show a mouse pointer anymore, the LEDs unfortunately remained turned off during the test. At least this proves that whatever is causing the LED problem is probably unrelated to the earlier display issues I had noticed. The Caps Lock fix does work from the console (the LED turns on when you press Caps Lock), but not in UAE, I guess for the same reason as the other LEDs. However, the key does work in UAE when started from the console, so I believe we can get rid of |
Using: https://www.amazon.co.uk/gp/product/B00JAE915C/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1 Fresh Raspbian lite installation:
Removal of Xserver package deps would be awesome 👍 Looking forward to seeing this in SDL2. EDIT:Binary tests work under user Pi, not root. So there must be some additional configs specific to the Pi user, i'll have a look. Create user bob:
Login as user pi:
Root:Shouldnt have any effect, root > all
|
Ok, so LED's work as standard users, but not under editYep, works fine on DietPi image, same results. |
Interesting, that explains the behavior at least. I wonder why... On Sep 23, 2016 17:06, "Dan" notifications@github.com wrote:
|
Not sure. I suppose we could test if this is a SDL specific issue, by creating another binary that tests the LEDS without SDL library (bare bones main.cpp with LED flashing). Any chance you can make one of those binaries and i'll continue testing? |
@Fourdee The "setled" binary will start from main, go in a loop and flash the LEDs until you cancel it with Ctrl-C. Both of these worked in Raspbian Lite (and full), but of course I only tested them under the "pi" default account. |
Still puzzles me this one. Doesn't make sense why LEDs fail with root, if anything, should be the other way round. I suppose, as a possible fix, we could create a user specifically for AmiBerry. This would resolve the LED issues. But either way, I'll try the method above and run some tests. |
@midwan |
Not able to test right now, but the DF* setting definitely works. It will Only the power led setting does not quite work yet. On Sep 24, 2016 18:13, "Dan" notifications@github.com wrote:
|
Thanks. Will give me something to test against 👍 Notes:
LED: numlock set to df*
Raspbian:
DietPi:
LED: testledRaspbian:
DietPi:
So, as far as I can tell, to get LEDS working:
Then run Find sourcecode for https://fossies.org/dox/kbd-2.0.3/setleds_8c_source.html Does indeed use ioctl:
|
Ok, Findings:
Maybe this is a SDL issue? |
@Fourdee 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. :) |
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: 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. ;) |
🏆 Awesome, great stuff👍
Excellent, i'll give this a spin 👍 |
@Fourdee
Do you think we could plan for an update in the DietPi distribution, using the latest binaries with the fixes? |
Simplified the function call (only needs 2 parameters anyway, took away the third) Fixed functionality to enable the keyboard LEDs to work as expected Note: This only works when started from the console (using fbcon) and not as root
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.The text was updated successfully, but these errors were encountered: