Laptop doesn't suspend when it is closed


When I close the laptop, the screen turns off but it doesn’t suspend. I can manually suspend using power button or by running systemctl suspend.

I tried editing logind.conf file, but nothing changed. I checked the value of /proc/acpi/button/lid/LID0/state and it works correct, it changes when I open and close the laptop accordingly, but when I run acpi_listen and close the laptop, nothing happens, no event is triggered. I think there is an issue with lid switch events.

I tried this solution but it didn’t work. I have used windows and ubuntu before and I had the same issue with ubuntu. It works fine in windows though.

Distro: Fedora Linux 37 (Workstation Edition)
Host: HP Laptop 15-da2xxx
Kernel: 6.0.15-300.fc37.x86_64

Can you please give us the output of sudo inxi -CBSGM in a code or preformatted block?


  Host: pc Kernel: 6.0.15-300.fc37.x86_64 arch: x86_64 bits: 64
    Console: pty pts/0 Distro: Fedora release 37 (Thirty Seven)
  Type: Laptop System: HP product: HP Laptop 15-da2xxx v: Type1ProductConfigId
    serial: CND0338KFM
  Mobo: HP model: 86B4 v: 88.31 serial: PJJDAE3NME25A1 UEFI: Insyde v: F.41
    date: 04/19/2022
  ID-1: BAT1 charge: 14.3 Wh (41.1%) condition: 34.8/40.9 Wh (85.0%)
    volts: 10.8 min: 11.3
  Info: quad core model: Intel Core i5-10210U bits: 64 type: MT MCP cache:
    L2: 1024 KiB
  Speed (MHz): avg: 1338 min/max: 400/1600 cores: 1: 870 2: 2100 3: 937
    4: 900 5: 900 6: 2100 7: 800 8: 2100
  Device-1: Intel CometLake-U GT2 [UHD Graphics] driver: i915 v: kernel
  Device-2: NVIDIA GM108M [GeForce MX110] driver: nvidia v: 525.60.11
  Device-3: Quanta HP Webcam type: USB driver: uvcvideo
  Display: server: X.Org v: 22.1.7 with: Xwayland v: 22.1.7 driver: X:
    loaded: modesetting,nvidia unloaded: fbdev,nouveau,vesa dri: iris gpu: i915
    resolution: 1366x768~60Hz
  API: OpenGL v: 4.6 Mesa 22.3.2 renderer: Mesa Intel UHD Graphics (CML GT2)

An HP laptop I see, probably the lid close is recognized as something else.
Install evtest:
sudo dnf install evtest

Then run: sudo evtest. You will get something like this:

sudo evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:      Lid Switch
/dev/input/event1:      Power Button
/dev/input/event2:      Power Button
/dev/input/event3:      AT Translated Set 2 keyboard
/dev/input/event4:      PC Speaker
/dev/input/event5:      Video Bus
/dev/input/event6:      Video Bus
/dev/input/event7:      Wireless hotkeys
/dev/input/event8:      HP TrueVision HD Camera: HP Tru
/dev/input/event9:      HDA Intel PCH Mic
/dev/input/event10:     HDA Intel PCH Headphone
/dev/input/event11:     HDA Intel PCH HDMI/DP,pcm=3
/dev/input/event12:     HDA Intel PCH HDMI/DP,pcm=7
/dev/input/event13:     HDA Intel PCH HDMI/DP,pcm=8
/dev/input/event14:     HDA Intel PCH HDMI/DP,pcm=9
/dev/input/event15:     HDA Intel PCH HDMI/DP,pcm=10
/dev/input/event16:     HP WMI hotkeys
/dev/input/event17:     Synaptics TM3320-003
Select the device event number [0-17]:

Select the keyboard one on your device. Then close and open the lid. Post the output so we could see the keycode and scancode produced.

When I first installed fedora, there was a problem with airplane mode. When I closed and opened the laptop, airplane mode would turn on and it wouldn’t suspend either. I solved the problem with airplane mode by using new method described in this answer. I had the same issue with ubuntu

Glad you found it yourself.
I also have an HP laptop with the same issue. I set the wrong keycode to suspend so closing the lid suspends.

I got this output when I closed and opened the lid:

Event: time 1672809935.843178, -------------- SYN_REPORT ------------
Event: time 1672809945.039721, type 4 (EV_MSC), code 4 (MSC_SCAN), value d8
Event: time 1672809945.039721, type 1 (EV_KEY), code 240 (KEY_UNKNOWN), value 1
Event: time 1672809945.039721, -------------- SYN_REPORT ------------
Event: time 1672809945.048142, type 4 (EV_MSC), code 4 (MSC_SCAN), value d8
Event: time 1672809945.048142, type 1 (EV_KEY), code 240 (KEY_UNKNOWN), value 0
Event: time 1672809945.048142, -------------- SYN_REPORT ------------
Event: time 1672809945.898836, type 4 (EV_MSC), code 4 (MSC_SCAN), value d7
Event: time 1672809945.898836, type 1 (EV_KEY), code 240 (KEY_UNKNOWN), value 1
Event: time 1672809945.898836, -------------- SYN_REPORT ------------
Event: time 1672809945.909084, type 4 (EV_MSC), code 4 (MSC_SCAN), value d7
Event: time 1672809945.909084, type 1 (EV_KEY), code 240 (KEY_UNKNOWN), value 0
Event: time 1672809945.909084, -------------- SYN_REPORT ------------
Event: time 1672809945.916293, type 4 (EV_MSC), code 4 (MSC_SCAN), value e3
Event: time 1672809945.916293, type 1 (EV_KEY), code 143 (KEY_WAKEUP), value 1
Event: time 1672809945.916293, -------------- SYN_REPORT ------------
Event: time 1672809945.926903, type 4 (EV_MSC), code 4 (MSC_SCAN), value e3
Event: time 1672809945.926903, type 1 (EV_KEY), code 143 (KEY_WAKEUP), value 0

Turns out KEY_UNKNOWN is triggered when laptop is closed

Unfortunately, the problem with suspend still persists. I once got this message in my logs: ACPI: button: The lid device is not compliant to SW_LID
My situtation is similar to this: suspend - Wrong signals from lid switch - Ask Ubuntu

The KEY_UNKNOWN is triggered due to what you did with the askubuntu solution. That solution assigns the lid switch to KEY_UNKNOWN instead of KEY_WLAN.

You should modify the askubuntu solution and assign the scancode to 142 instead of 240. Thats how I fixed it for my laptop (HP 15-da1xxx).


Yeah it works now, thanks a lot :+1: