There are a couple of ARM-based server systems that use the gpio-keyboard and gpio-keyboard-polled drivers to send an event requesting a shutdown. The following rules DTRT, though obviously it'd be nice if a more generic (but still safe) rule could be devised.
You'll notice a couple of differences between the two. The m800 rule specifies a key attribute where the m400 rule does not. This is because the first uses a polled gpio via the gpio-keyboard-polled driver. This driver does not expose a "keys" attribute in sysfs. The m400 uses the gpio-keyboard driver, which does.
You'll also notice the grep vs. cat/RESULT methods. Not sure if upstream has a preference.
It might make sense to drop the model/pin matching of the m800 rule, and bind to any ATTR{keys}=="116" - this is defined as KEY_POWER in <linux/input.h>. Of course, that won't help the -polled variant.
There are a couple of ARM-based server systems that use the gpio-keyboard and gpio-keyboard- polled drivers to send an event requesting a shutdown. The following rules DTRT, though obviously it'd be nice if a more generic (but still safe) rule could be devised.
SUBSYSTEM=="input", KERNEL=="event*", SUBSYSTEMS= ="platform" , KERNELS= ="gpio- keys.6" , PROGRAM="/bin/grep '^HP ProLiant m400 Server Cartridge$' /proc/device- tree/model" , TAG+="power-switch"
SUBSYSTEM=="input", KERNEL=="event*", SUBSYSTEMS= ="platform" , KERNELS= ="gpio_ keys.12" , ATTRS{keys}=="116", PROGRAM="/bin/cat /proc/device- tree/model" , RESULT=="HP ProLiant m800 Server Cartridge", TAG+="power-switch"
You'll notice a couple of differences between the two. The m800 rule specifies a key attribute where the m400 rule does not. This is because the first uses a polled gpio via the gpio-keyboard- polled driver. This driver does not expose a "keys" attribute in sysfs. The m400 uses the gpio-keyboard driver, which does.
You'll also notice the grep vs. cat/RESULT methods. Not sure if upstream has a preference.
It might make sense to drop the model/pin matching of the m800 rule, and bind to any ATTR{keys}=="116" - this is defined as KEY_POWER in <linux/input.h>. Of course, that won't help the -polled variant.