[systemd-devel] GPIO Reset Button

Lennart Poettering lennart at poettering.net
Fri Nov 9 16:17:41 PST 2012


On Fri, 02.11.12 09:56, Pawel Pastuszak (pawelpastuszak at gmail.com) wrote:

> Hi all,
> 
> I was wondering if there is an way to attach an GPIO line to reboot the
> system. I am currently working on an Embedded device that has an GPIO line
> which needs to act as an reboot button this GPIO comes up as an
> /sys/class/gpio/gpio103/ which i want to have it trigger when it switches
> state to low and do an system soft reboot. Does systemd allow any
> functionally like this?

No. We only look for input devices marked with the "power-switch"
tag. 

The kernel can create input devices for GPIO lines
(CONFIG_KEYBOARD_GPIO), IIRC? Maybe that's useful to achieve this?

If CONFIG_KEYBOARD_GPIO is not useful for this, I'd be willing to merge
a patch for logind that makes it watch gpio lines marked with a specific
udev tag the same way it already watches input devices. The code for
that should be quite simple and minimal given that we already have the
input-based code in place. That way adding device-specific udev rules
adding the tag to your gpio device is all that is necessary to make
logind pick it up. This should be useful frequently enough to make a
logind core feature that we can support upstream.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list