• Benjamin Tissoires's avatar
    Revert "ACPI / button: Change default behavior to lid_init_state=open" · 4c5681af
    Benjamin Tissoires authored
    commit 878d8db0 upstream.
    
    Revert commit 77e9a4aa (ACPI / button: Change default behavior to
    lid_init_state=open) which changed the kernel's behavior on laptops
    that boot with closed lids and expect the lid switch state to be
    reported accurately by the kernel.
    
    If you boot or resume your laptop with the lid closed on a docking
    station while using an external monitor connected to it, both internal
    and external displays will light on, while only the external should.
    
    There is a design choice in gdm to only provide the greeter on the
    internal display when lit on, so users only see a gray area on the
    external monitor. Also, the cursor will not show up as it's by
    default on the internal display too.
    
    To "fix" that, users have to open the laptop once and close it once
    again to sync the state of the switch with the hardware state.
    
    Even if the "method" operation mode implementation can be buggy on
    some platforms, the "open" choice is worse.  It breaks docking
    stations basically and there is no way to have a user-space hwdb to
    fix that.
    
    On the contrary, it's rather easy in user-space to have a hwdb
    with the problematic platforms. Then,  libinput (1.7.0+) can fix
    the state of the lid switch for us: you need to set the udev
    property LIBINPUT_ATTR_LID_SWITCH_RELIABILITY to 'write_open'.
    
    When libinput detects internal keyboard events, it will overwrite the
    state of the switch to open, making it reliable again.  Given that
    logind only checks the lid switch value after a timeout, we can
    assume the user will use the internal keyboard before this timeout
    expires.
    
    For example, such a hwdb entry is:
    
    libinput:name:*Lid Switch*:dmi:*svnMicrosoftCorporation:pnSurface3:*
     LIBINPUT_ATTR_LID_SWITCH_RELIABILITY=write_open
    
    Link: https://bugzilla.gnome.org/show_bug.cgi?id=782380Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    4c5681af
button.c 16.3 KB