Score:0

Awake PC from sleep using only one button?

br flag

I have a Thinkpad X1 tablet running Ubuntu 20.04 LTS. The keyboard is pretty flexible and the keys get easily pressed when the laptop is closed. When the PC is in my backpack it presses keys and drains it for battery.

I would like a way of the PC to wake from sleep ONLY when the power button is pressed. Is there any way to do this? - e.g. disabling "wake when lid opens", keyboard presses and touchpad movements/clicks.

Any help is much appreciated, thanks.

Summary; I would like my PC to wake from sleep by nothing but the POWER BUTTON.

David avatar
cn flag
Is there a bios option that you can change?
br flag
Not that I am aware of.
ru flag
This is a hardware thing. If the BIOS doesnt give an option to control how to awake from sleep you dont really have any options on changing that.
guiverc avatar
cn flag
I have boxes with the exact same ISO installed (*I'm involved in QA-testing so it's just the install I'm interested in for Quality Assurance purposes*), but they react very differently with regards waking. Some will wake from suspend on any keyboard touch, others require power to be pressed - yet Ubuntu is installed from same media & identical setup on all -- ie. it's the machine firmware that controls wake from suspend; as the OS is asleep & it's the firmware of the box that tells the OS to wake.. Your question is about the firmware itself in my opinion like others before me have indicated
guiverc avatar
cn flag
Ubuntu 20.04 LTS has two kernel stack choices (GA & HWE, *I'm ignoring OEM for simplicity here*) so you could try the other kernel stack and see if it's any different (two stacks can co-exist unless you're using certain closed-source video drivers), even use *live* media to test - however I don't think it'll make any difference. (*I rarely test GA then HWE kernel stacks on the same day/week, eg. 20.04.4 being tested right now is the HWE 5.13 kernel as I QA desktop only*) https://wiki.ubuntu.com/Kernel/LTSEnablementStack
Score:0
br flag

I found it out.

For me the best solution was disabling XHC in /proc/acpi/wakeup. I did this by typing into the terminal: sudo sh -c "echo XHC > /proc/acpi/wakeup" - this disables the keyboard and the touchpad. - When i then suspend my PC I can only wake it up by pressing the power button.

I tried making this automatic when turning on my PC, but after a lot of testing and trying and failing I gave up. I ended up with just a simple script that I found online, that I type into the terminal upon reboot. (Because the previous command get reset to default upon reboot).

The script:

#!/bin/sh
for device in XHC
do
    if grep -q "$device.*enabled" /proc/acpi/wakeup
    then
        echo $device > /proc/acpi/wakeup
    fi
done

I then just run it in the terminal like this: sudo sh Desktop/clickme.sh

I tried putting the script file in /etc/rc.local ... but that did nothing. Also tried making the script a startup application by writing sudo sh Desktop/clickme.sh into the Startup Applications GUI. But that did nothing. - If anyone sees an error I made in my troubleshooting... please tell me, I would love to forget about the script upon every reboot.

My top sources for this problem were these: Desktop wakes from suspend at random (14.04) and Disable USB keyboard wakeup

pglpm avatar
cn flag
Any new developments? One of the devices listed in `cat /proc/acpi/wakeup` should be the keyboard, and it should be possible to toggle it there. My problem is that I don't know which of the codes represents the keyboard.
Daniel Wiczew avatar
cn flag
Can't init.d be used ? Also the script seems to stop working on 22.04.2
Pavel Niedoba avatar
vn flag
I can confirm, that it does not work anymore, usb keyboard wakes up my notebook even if i run the script manually
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.