<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - LID_SWITCH_RELIABILITY=write_open doesn't work"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=102039">102039</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LID_SWITCH_RELIABILITY=write_open doesn't work
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Wayland
          </td>
        </tr>

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

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

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

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

        <tr>
          <th>Severity</th>
          <td>major
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>libinput
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>me@jasonclinton.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Background: Benjamin Tissoires reverted an upstream kernel change which was
intended to make Linux more compatible with default Windows behavior:
<a href="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/acpi/button.c?id=878d8db039daac0938238e9a40a5bd6e50ee3c9b">https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/acpi/button.c?id=878d8db039daac0938238e9a40a5bd6e50ee3c9b</a>

The original commit was to work around bugs like this one where the laptop lid
switch works as expected in Windows without installing any vendor drivers:
<a href="https://bugzilla.kernel.org/show_bug.cgi?id=191211">https://bugzilla.kernel.org/show_bug.cgi?id=191211</a>

With the revert, the bad behavior has returned (with kernel option as only
recourse for users).

In the revert message, he suggests working around the problem in user space
with a HWDB rule. I have created one:

$ cat /etc/udev/hwdb.d/91-libinput-model-quirks.hwdb
##########################################
# Razer
##########################################
# Razer Blade laptops need us to write the open lid switch event
libinput:name:*Lid Switch*:dmi:*svnRazer:pnBlade*
 LIBINPUT_ATTR_LID_SWITCH_RELIABILITY=write_open

And indeed, it sets the property:

$ udevadm info
--path=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:18/PNP0C09:01/PNP0C0D:00/input/input0/event0
P:
/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:18/PNP0C09:01/PNP0C0D:00/input/input0/event0
N: input/event0
E: DEVNAME=/dev/input/event0
E:
DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:18/PNP0C09:01/PNP0C0D:00/input/input0/event0
E: ID_INPUT=1
E: ID_INPUT_SWITCH=1
E: ID_PATH=acpi-PNP0C0D:00
E: ID_PATH_TAG=acpi-PNP0C0D_00
E: LIBINPUT_ATTR_LID_SWITCH_RELIABILITY=write_open
E: LIBINPUT_DEVICE_GROUP=19/0/5/0:PNP0C0D/button
E: MAJOR=13
E: MINOR=64
E: SUBSYSTEM=input
E: TAGS=:power-switch:
E: USEC_INITIALIZED=64391649

However, libinput doesn't actually write open to the lid switch and prevent a
system from suspending after lid open. Systemd eventually times out and sees
that the lid is closed:

$ sudo cat /proc/acpi/button/lid/LID0/state 
state:      closed

$ libinput --version
1.8.0

Running Wayland on F26 with:
Linux version 4.13.0-0.rc3.git0.1.fc27.x86_64
(<a href="mailto:mockbuild@bkernel02.phx2.fedoraproject.org">mockbuild@bkernel02.phx2.fedoraproject.org</a>) (gcc version 7.1.1 20170718 (Red
Hat 7.1.1-6) (GCC)) #1 SMP Mon Jul 31 16:41:10 UTC 2017

Please fix libinput or revert the upstream kernel revert.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>