Welcome! Log In Create A New Profile

Advanced

NSA3xx Button setup

Posted by pld 
pld
NSA3xx Button setup
March 05, 2016 05:58AM
Hi,

I found 2 ways to set up all buttons on my NSA310 (probably all NSA3xx). Since I did not found to much about it on the net, I decided to share it with you all.

1. Install https://github.com/wertarbyte/magmakeys. Works perfectly. Advantages:
- this is a perl script so you do not need to compile and I think that all needed libraries are present in the bodhi rootfs;
- contains ready to use debian start-up script
- it is able to distinguish key stoke obtained by pressing, holding and releasing of a button;
Disadvantages:
- you need to switch off the hal support (there is no HAL daemon in modern linux distributions) and give the input event file specifically (-d /dev/input/event0);
- you need to manually put all needed files in appropriate directories.

2. Through acpid. The problem with is that acpid allows only keys predefined in the sources (the input_layer.c file). Unfortunately, KEY_COPY and KEY_RESTART are absent till acpid-2.0.23 (which is the current version in debian jessie). So the are 2 ways.
- Exchange KEY_COPY and KEY_RESTART with something like KEY_SLEEP and KEY_SUSPEND in appropriate dts file (kirkwood-nsa3x0-common.dtsi in my case). Then you need to recompile.
- Update to acpid-2.0.25 or later. It already supports KEY_COPY and KEY_RESET.

In both cases, you need only one daemon for all buttons.



Edited 4 time(s). Last edit at 03/06/2016 04:13AM by pld.
Re: NSA3xx Button setup
March 08, 2016 06:07AM
That perl script is a bit ancient, but sounds interesting (and better than acpid, anyway). Thanks for sharing.
Re: NSA3xx Button setup
March 08, 2016 12:46PM
Thanks for sharing pld!

There is a 3rd method, which I like the most: using the esekeyd. It's cleaner, and out of the box from Debian.

My NSA325 config for testing (the NSA310S has similar config).

cat /etc/esekeyd.conf
#POWER:/sbin/shutdown -h now
#RESTART:/sbin/shutdown -r now
POWER:/usr/bin/logger -s -i "POWER button pushed"
RESTART:/usr/bin/logger -s -i "RESTART button pushed"
COPY:/usr/bin/logger -s -i "COPY Button pushed"

ps -deaf | grep ese
root      1838     1  0 Feb20 ?        00:00:00 /usr/sbin/esekeyd /etc/esekeyd.conf
root     32022 31994  0 10:46 pts/0    00:00:00 grep ese

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: