Tag Archives: linux

HP Envy 360 laptop close lid suspend does not work: fixed – linux

If you are like me and struggle that the suspend function when closing the lid on your

~> inxi -M
Machine:
  Type: Convertible System: HP product: HP ENVY x360 Convertible 15-ed0xxx
    v: Type1ProductConfigId serial: <superuser required>
  Mobo: HP model: 8757 v: 08.42 serial: <superuser required> Firmware: UEFI
    vendor: Insyde v: F.24 date: 03/16/2022

HP notebook does not work, there are several fixes and tweaks to the system that can be tried. I have literally tried all of them, and believe me, they all DO NOT WORK.

What is the problem? The suspend function in linux works ok, because

# systemctl suspend

works flawlessly. But it does not work when setting the events in KDE plasma Power Management settings. Believe me, it simply does not work.

Then I tried a LOT of other options, ranging from GRUB kernel boot options to creating custom ACPI events and letting systemd logind handle the event etc. etc. etc.

I spend a lot of time, none of the options worked for me. Finally this solution worked. it uses a service to manually suspend the machine (since the command does work normally).

Here are the 3 things you have to do:

1. Create a unit file

Create a unit file :

# vi /etc/systemd/system/lid-suspend.service

with the following content:

[Unit]
Description=HP Envy lid close suspend poller
After=plasma-kwin_wayland.service powerdevil.service
Wants=plasma-kwin_wayland.service powerdevil.service

[Service]
Type=simple
ExecStartPre=
ExecStart=/usr/local/bin/lid-suspend.sh
Restart=always
RestartSec=5
CPUWeight=1
IOSchedulingClass=idle

[Install]
WantedBy=default.target

2. create a script

Create the following script:

# vi /usr/local/bin/lid-suspend.sh

with the following content:

#!/bin/bash
exec > /var/log/lid-suspend.log 2>&1
echo "$(date): Lid poller v2 started - checking all paths"

while true; do
  for path in /proc/acpi/button/lid/LID*/state /proc/acpi/button/lid/state /sys/class/input/*/uevent; do
    if [ -f "$path" ]; then
      if grep -qi "closed\|LID=closed" "$path" 2>/dev/null; then
        echo "$(date): Lid closed op $path - suspending!"
        systemctl suspend
        sleep 15
        break 2
      fi
    fi
  done
  
  # Fallback: input event checken
  if ls /sys/class/input/input*/name 2>/dev/null | grep -qi lid; then
    echo "$(date): Lid input device gevonden via fallback"
  fi
  
  sleep 1
done

3. activate the files

# chmod +x /usr/local/bin/lid-suspend.sh
# systemctl daemon-reload
# systemctl enable --now lid-suspend.service

After this, the suspend function works when the lid is closed in linux plasma6!

Leave a Reply

Your email address will not be published. Required fields are marked *

Upgrade 7 year old openSUSE Tumbleweed KVM/Qemu VM

I came across an old openSUSE Tumbleweed virtual machine image. It still booted in KVM/Qemu. When it started I noticed it was from 2018. So I tried to update it (I had to install the correct repositories) and when I did

# zypper dup

this is what I saw:

After a long time, the update was NOT successful. Of course. There was a dependency hell of cpio not able to extract packages, rpm, zypper ,libzypp and several others (all the way to numerous python modules) that I simply could not solve. Bummer!

Leave a Reply

Your email address will not be published. Required fields are marked *

Make pipewire play bitperfect audio / Linux

If you are like me,

and have always wondered why PulseAudio had a fixed setting for sample rate,

but thought that that situation would improve when PipeWire got established,

and then learning that PipeWire STILL had a fixed sample rate?

So that everything was resampled to 48000, or whatever setting was the default?!

Fear no more.

THIS is how to make PipeWire always choose the best sample rate when playing audio. So that a 44100 Hz files will play with a 44100 sample rate, and a HiRes 96000 file will put the soundcard at 96000.

  1. open, or create, ~/.config/pipewire/pipewire.conf and put this in:
    context.properties = {
       default.clock.allowed-rates = [ 44100 48000 88200 96000 ]
    }

    if required, add extra sample rates that your files and/or your soundcard supports.
  2. That’s it! Maybe need to log out/in, or kill PipeWire, whichever you choose
  3. check the result with
    # pw-mon
    R   52   4096  96000  83,3us  16,5us  0,00  0,00    0    S32LE 2 96000 alsa_output.usb-Focusrite_Scarlett_2i2_USB-00.HiFi__hw_USB__sink
    R   72   7200  96000  41,0us  22,4us  0,00  0,00    0    F32LE 2 96000  + LibreWolf
  4. Both the hardware (Focusrite) and the program (LibreWolf) are playing audio at 96000.
  5. I found that in order for Qobuz (and probably other streaming services as well) to really play at native bit rate, LibreWolf will do the trick, NOT the ‘native’ linux flatpak client for Qobuz.
    So use the url: ‘https://play.qobuz.com/’

Leave a Reply

Your email address will not be published. Required fields are marked *