You are not logged in.
Pages: 1
Topic closed
Hi,
I have a netbook with the infamous poulsbo/gma500 chipset. To suspend it on the console (I am not yet at X ;-) ) I need to add the --quirk-vbemode-restore option to pm-suspend as described in the wiki [1]. How can I get the same effect when migrating to systemd (and therefore switching to systemctl and dropping pm-utils)?
Thanks
[1] https://wiki.archlinux.org/index.php/Poulsbo
Last edited by olaf.the.lost.viking (2012-08-22 23:13:22)
I switched to OlafLostViking to match the IRC alias.
Offline
The code is in /usr/lib/pm-utils/sleep.d/98video-quirk-db-handler and /usr/lib/pm-utils/sleep.d/99video. The substantial part is
# save/restore the vbe mode
vbe_savemode() { vbe vbemode get |savestate vbemode; }
vbe_restoremode()
{
# this is a little mode complicated to handle special-casing mode 3.
local vbemode=$(restorestate vbemode)
if [ "$vbemode" = "3" ]; then
vbe vgamode set $vbemode
else
vbe vbemode set $vbemode
fi
}
Note that vbe function only forwards its arguments to vbetool. You could place something like this into /usr/lib/systemd/system-sleep/99video
#!/bin/sh
TMPFILE=/tmp/gma500-state
vbe_savemode() {
vbetool vbemode get > $TMPFILE
}
vbe_restoremode() {
# this is a little mode complicated to handle special-casing mode 3.
local vbemode=$(cat $TMPFILE)
if [ "$vbemode" = "3" ]; then
vbetool vgamode set $vbemode
else
vbetool vbemode set $vbemode
fi
}
if [[ $1 == "pre" ]]; then
vbe_savemode
elif [[ $1 == "post" ]]; then
[ -O /tmp/gma500-state ] && vbe_restoremode
fi
Offline
Great! Thank you for your help.
I'll report back if it doesn't work as intended ;-)
I switched to OlafLostViking to match the IRC alias.
Offline
OK, even better: it looks like suspending via pm-utils or /sys/power/state is not possible without some quirks. But systemd seems to suspend and hibernate this system even without any added scripts. Nice. Even though I'd prefer it to work all the time, I can use the netbook with systemd
I switched to OlafLostViking to match the IRC alias.
Offline
You could place something like this into /usr/lib/systemd/system-sleep/99video
#!/bin/sh TMPFILE=/tmp/gma500-state vbe_savemode() { vbetool vbemode get > $TMPFILE } vbe_restoremode() { # this is a little mode complicated to handle special-casing mode 3. local vbemode=$(cat $TMPFILE) if [ "$vbemode" = "3" ]; then vbetool vgamode set $vbemode else vbetool vbemode set $vbemode fi } if [[ $1 == "pre" ]]; then vbe_savemode elif [[ $1 == "post" ]]; then [ -O /tmp/gma500-state ] && vbe_restoremode fi
Note that `==` is not valid in POSIX `sh`. You need to use a single `=`:
Sadly enough, while the script then ran, the solution didn't work.
I came up with a hack that, however, did. I updated the script as follows (including the POSIX `sh` fix):
if [ "$1" = "pre" ]; then
vbe_savemode
DISPLAY=:0 sudo -Eu $USER xrandr --output LVDS-1 --off
elif [ "$1" = "post" ]; then
[ -O $TMPFILE ] && vbe_restoremode
(sleep 1; DISPLAY=:0 sudo -Eu $USER xrandr --output LVDS-1 --auto) &
fi
It's dirty, but I have a single user on this machine (you'll need to set the `$USER` variable), and this Just Works^{tm}.
Last edited by shtrom (2018-07-15 03:18:28)
Offline
Thanks for sharing. I'm going to go ahead and close this six year old topic now.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Pages: 1
Topic closed