<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - gpio-controlled shutdown power mechanism"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=82347">82347</a>
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>gpio-controlled shutdown power mechanism
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dannf@dannf.org
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>ARM
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>systemd
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>