touch-packages team mailing list archive
-
touch-packages team
-
Mailing list archive
-
Message #08326
[Bug 1347776] Re: shutdown trigger on gpio_keys.X for armhf hardware
Launchpad has imported 1 comments from the remote bug at
https://bugs.freedesktop.org/show_bug.cgi?id=82347.
If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.
------------------------------------------------------------------------
On 2014-08-08T13:01:28+00:00 dann frazier wrote:
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.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1347776/comments/9
** Changed in: systemd
Status: Unknown => Confirmed
** Changed in: systemd
Importance: Unknown => Medium
--
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1347776
Title:
shutdown trigger on gpio_keys.X for armhf hardware
Status in systemd:
Confirmed
Status in “systemd” package in Ubuntu:
Fix Released
Status in “systemd” source package in Trusty:
Fix Committed
Status in “systemd” source package in Utopic:
Fix Released
Bug description:
Some ARM board uses GPIO gpio_key.12 for power control (key=116). The
proposed patch adds entry to logind's 70-power-switch.rules to
initiate soft shutdown of the cartridge from ilo.
Here is the udevadm output for /dev/input/event0
sudo udevadm info --query=all --name=/dev/input/event0 --attribute-
walk
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/devices/soc.3/gpio_keys.12/input/input0/event0':
KERNEL=="event0"
SUBSYSTEM=="input"
DRIVER==""
looking at parent device '/devices/soc.3/gpio_keys.12/input/input0':
KERNELS=="input0"
SUBSYSTEMS=="input"
DRIVERS==""
ATTRS{name}=="gpio_keys.12"
ATTRS{phys}=="gpio-keys/input0"
ATTRS{uniq}==""
ATTRS{properties}=="0"
looking at parent device '/devices/soc.3/gpio_keys.12':
KERNELS=="gpio_keys.12"
SUBSYSTEMS=="platform"
DRIVERS=="gpio-keys"
ATTRS{keys}=="116"
ATTRS{switches}==""
ATTRS{disabled_keys}==""
ATTRS{disabled_switches}==""
looking at parent device '/devices/soc.3':
KERNELS=="soc.3"
SUBSYSTEMS=="platform"
DRIVERS==""
Regarding the possibility of gpio_key.12 being used by other systems
to map to some other trigger, I put in the check that the gpio_key.12
is associated with power control (keys=116). '116' is supposedly linux
generic power control in DTS. There is no uniq idSystem or idVendor
for device /dev/input/event0 as you can see from udevadm output,
therefore I tried to use the best available combination as a safety
check. This patch will enable power control for any system vendor
(Other than the one the patch in intended for) that describes in DTS,
the trigger gpio_key.12 as power control (116).
SRU Request
==========
[Impact]
* User won't be able to initiate a soft shutdown from the chassis
manager.
[Test Case]
* To reproduce this bug, initiate a soft shutdown from the chassis manager, for example from ilo you could do
<ilo> set node power off shutdown <node number>
[Test Result]
== BEFORE PATCH ==
$ cat /lib/udev/rules.d/70-power-switch.rules
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
ACTION=="remove", GOTO="power_switch_end"
SUBSYSTEM=="input", KERNEL=="event*", SUBSYSTEMS=="acpi", TAG+="power-switch"
SUBSYSTEM=="input", KERNEL=="event*", KERNELS=="thinkpad_acpi", TAG+="power-switch"
LABEL="power_switch_end"
$
</>hpiLO-> set node power off shutdown c3n2
c3: #Cartridge 3
c3n2: #Node 2 Shutting node down gracefully
hpiLO-> show node list
Slot ID Proc Manufacturer Architecture Memory Power Health
---- ----- ---------------------- -------------------- ------ ----- ------
3 c3n1 **** ARM Architecture 8 GB On OK
3 c3n2 **** ARM Architecture 8 GB On OK
3 c3n3 **** ARM Architecture 8 GB On OK
3 c3n4 **** ARM Architecture 8 GB Off OK
hpiLO->
== AFTER PATCH ==
hpiLO-> set node power off shutdown c3n1
c3: #Cartridge 3
c3n1: #Node 1 Shutting node down gracefully
hpiLO-> show node list
Slot ID Proc Manufacturer Architecture Memory Power Health
---- ----- ---------------------- -------------------- ------ ----- ------
3 c3n1 **** ARM Architecture 8 GB Off OK
3 c3n2 **** ARM Architecture 8 GB On OK
3 c3n3 **** ARM Architecture 8 GB On OK
3 c3n4 **** ARM Architecture 8 GB Off OK
hpiLO->
[Regression Potential]
None.
Note: Regarding the possibility of gpio_key.12 being used by other systems to map to some other trigger, I put in the check that the gpio_key.12 is associated with power control (keys=116). '116' is supposedly linux generic power control in DTS.
To manage notifications about this bug go to:
https://bugs.launchpad.net/systemd/+bug/1347776/+subscriptions