Welcome! Log In Create A New Profile

Advanced

Ox820: gpio-keys-polled does not provide /dev/input/eventx

Posted by Christian 
Hello all,

I habe setup a Medion NAS/Ox820 with 4.4.201-oxnas-tld-1 and Debian buster.

I try to execute a script when gpio-keys-polled reports <Key_Copy>.
By the help of 'showkey' I can see, that Keycode 133 is generated.

Now I want to use esekeyd as descibed in the thread 'NSA325 copy button event'.

But I see that esekeyd is watching on /dev/input/event and the subfolder 'event' is not present.

Maybe the Problem is that kernel is build without option '<*> Event interface'?

BR,
Christian
Me again...

I think I'm a step closer to the root cause...

I have powered up my NSA325 and there /dev/input/event0 is available.
This is, because Kernel module evdev is available in 5.2.9-kirkwood-tld-1 and loaded.

On 4.4.201-oxnas-tld-1 the evdev module is not available.
Additionally I find no hint if the Event interface itself is enabled inside this kernel 4.4.201. But I hope so...

Now my question:
Can anybody provide the evdev module (evdev.ko) from /lib/modules/4.4.201-oxnas-tld-1/kernel/drivers/input to me or do I have to compile it on my own with setting up the whole Kernel sources on my machine?!?

BR,
Christian
Re: Ox820: gpio-keys-polled does not provide /dev/input/eventx
April 19, 2020 03:09AM
Christian,


> On 4.4.201-oxnas-tld-1 the evdev module is
> not available.
> Additionally I find no hint if the Event interface
> itself is enabled inside this kernel 4.4.201. But
> I hope so...
>

> Can anybody provide the evdev module (evdev.ko)
> from
> /lib/modules/4.4.201-oxnas-tld-1/kernel/drivers/input
> to me or do I have to compile it on my own with
> setting up the whole Kernel sources on my
> machine?!?
>

Let me take a look. This kernel was built with the Pogo V3 OXNAS as a base, and there is no button on this Pogoplug box. So now you are running it with the Medion box, I'm not surprised that module is not available.

I'm building the next kernel version for this. Either kernel 5.4.x or 4.14.x, whichever is working first in that order. I will make sure the event input interface will be configured in.

-bodhi
===========================
Forum Wiki
bodhi's corner
Hello Bodhi,

thanks in advance!

The dts for the Medion MD86803 configures the two gpio pins for COPY-Button and Reset-Button in the right manner.
Keycode is working well!!

Hopefully with evdev module available and loaded 'Copy-Button' will create 'Event No.3' as it's already configured inside gpio-keys-polled configuration and I can execute a bash script with the help of esekeyd.

BR and stay healthy,
Christian
Hello bodhi,

great job on kernel 4.14.176!!

/dev/input/event0 is available and esekeyd works out of the box like a charm.

Within a script executed by esekeyd I unload the kernel module 'gpio_key_polled' to release the gpio line used by the kernel. Afterwards I export the line as gpio to continue working with cat command for reading the value.

When copy button is unpressed after 2 seconds (short press) I perform a reboot,
when button is still pressed after 2 seconds (long press) I shutdown the NAS.

In addition the current operating status is signalized by the blue, red and orange LEDs.

Thanks for your support!

Christian
Re: [Solved] Re: Ox820: gpio-keys-polled does not provide /dev/input/eventx
April 30, 2020 04:30PM
Christian ,

> Within a script executed by esekeyd I unload the
> kernel module 'gpio_key_polled' to release the
> gpio line used by the kernel. Afterwards I export
> the line as gpio to continue working with cat
> command for reading the value.
>

> When copy button is unpressed after 2 seconds
> (short press) I perform a reboot,
> when button is still pressed after 2 seconds (long
> press) I shutdown the NAS.

Pretty cool!

If you could share your script, or just a set of commands, I'd like to add it to the Wiki.

-bodhi
===========================
Forum Wiki
bodhi's corner
Hi bodhi,

no problem. Here is my script:

#!/bin/bash
#
# copybtn
#
# This script is executed by esekeyd daemon when
# "Copy-Key"/"KEY_133" gets pressed. 
#
# If button is pressed < 2sec a reboot is executed.
# If button is pressed > 2sec a shutdown is executed.
#
# Make sure that the script will "exit 0" on success or any other
# value on error.

#unload kernel module "gpio_key_polled" because it locks the  gpio line inside chardev gpiochip32/GPIO1
rmmod gpio_keys_polled

# switch off blue LED to signalize to the user, that press of copy button has been detected
echo none > /sys/class/leds/zyxel:blue:status/trigger

# export GPIO1/channel13 to make button status readable by "value"
echo 45 > /sys/class/gpio/export

# wait for 2 seconds
sleep 2

# read current status of copy button after 2 seconds
var=$(cat /sys/class/gpio/gpio45/value)

if [ "$var" = "1" ]; then
        # show "reboot" by blue LED performing "Heartbeat"
        echo heartbeat > /sys/class/leds/zyxel:blue:status/trigger
        shutdown -r now 
else
        # show "shutdown" by red LED "permanent  on"
        echo default-on > /sys/class/leds/zyxel:red:status/trigger
        shutdown -h now
fi

exit 0

BR,
Christian
Re: [Solved] Ox820: gpio-keys-polled does not provide /dev/input/eventx
May 01, 2020 05:16PM
Thanks Christian!

Up in the Wiki


Quote
https://forum.doozan.com/read.php?2,23630

Key daemon (button control)

Multimedia keyboard daemon for Linux
How to use set up button to reboot or shutdown with Key Daemon (esekeyd)

-bodhi
===========================
Forum Wiki
bodhi's corner
Author:

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: