You are not logged in.

#1 2024-09-05 18:37:04

ZenRen
Member
Registered: 2020-05-08
Posts: 24

Laptop waking from sleep in my backpack

So forever I have thought this was a software issue, but I just figured out what is going on. I have a Thinkpad X395, it basically works perfectly and a lot of the teething issues have gone away, but it wakes up in my backpack a lot. Turns out that part of the lid can flex just enough to press the keyboard, the screen stays off, but it wakes up and types into the lock screen. I can't consistently reproduce it, but being as it typed into the lock screen once after I had pulled it out of my bag and once when I pressed around on the lid. Is this a problem with just the hardware, or is there some fiddling with the way ACPI events are handled?

I don't know too much about ACPI, but it appears to know when the lid has opened when it is asleep. Maybe a "simple" solution is to just disable the keyboard when the lid is closed and re-enable it when it is opened? I would be a little concerned that it wouldn't get re-enabled 100% of the time though, which it needs to before I can unlock it, however if it sometimes doesn't wake with a lid open event then that isn't a big deal as the power button would probably wake it.

Any suggestions or anything else I need to look into? If I am to go ahead with my idea, I really don't know how to go about doing that

Since it might be relevant information, I use kde, all power management is configured there. There are no thinkpad related packages installed, I don't think they apply to this machine. The only acpi related package I have currently installed is acpilight, not sure why.

Offline

#2 2024-09-06 15:49:38

mesaprotector
Member
Registered: 2024-03-03
Posts: 138

Re: Laptop waking from sleep in my backpack

You should be able to disable the laptop from waking up with the keyboard. This thread is about wakeups from a USB port, but you should be able to do the same with your keyboard. Here is a stackexchange thread explaining how to find the correct device given the output of cat /proc/acpi/wakeup.

I assume you are okay with not being able to wake up the laptop with the keyboard at all, even manually, since it sounds like you always close the lid to suspend it. If you'd rather not do that I can give you advice on how to get the keyboard to disable/reenable as you mentioned. I have a couple shortcuts for that on my device that work perfectly.

Offline

#3 2024-09-06 16:36:44

ZenRen
Member
Registered: 2020-05-08
Posts: 24

Re: Laptop waking from sleep in my backpack

Yeah I could disable it entirely, its not a terrible solution. I think it would probably be sleeker to have it disable and reenable with the lid though. Sometimes it does go asleep while it is open, so in that case I would have to wake it with the power button since it wouldn't be woke by the lid opening.

Offline

#4 2024-09-06 16:51:28

mesaprotector
Member
Registered: 2024-03-03
Posts: 138

Re: Laptop waking from sleep in my backpack

ZenRen wrote:

Yeah I could disable it entirely, its not a terrible solution. I think it would probably be sleeker to have it disable and reenable with the lid though. Sometimes it does go asleep while it is open, so in that case I would have to wake it with the power button since it wouldn't be woke by the lid opening.

I don't actually use lid sleep, but you could also just close the laptop and then open it to wake it up anyway. The power button would be faster of course.

If you want the keyboard to auto-disable itself the wiki might have you covered. I realized after your response my wording was ambiguous - I have short scripts for toggling the keyboard manually, but I haven't set them up to be automatic. I grep the output of `xinput list` (in Wayland it would be `libinput list-devices`, but with a very different way of formatting the output) to find my keyboard device id #, and float or reattach that device depending on the command.

Offline

#5 2024-09-06 20:08:14

ZenRen
Member
Registered: 2020-05-08
Posts: 24

Re: Laptop waking from sleep in my backpack

Well ok. It didn't sound like you had your scripts automated, but my point still stands. That gives me a starting place, but is it possible to run a script with the lid event as the trigger? I think kde is deciding what to do with that. I can always disable the lid actions in kde and use a different software though.

It would probably be helpful to have the resume unit just always enable the keyboard though. I would just prefer to leave the suspend unit alone

Offline

#6 2024-09-06 21:19:00

seth
Member
Registered: 2012-09-03
Posts: 57,278

Re: Laptop waking from sleep in my backpack

https://wiki.archlinux.org/title/Acpid
You can perhaps also use a https://wiki.archlinux.org/title/Power_ … stem-sleep and query the lid state (probably /proc/acpi/button/lid/LID0/state) to determine whether to disable the keyboard.

Alternatively just stick felt pads as spacers onto the case tongue

Offline

#7 2024-09-09 08:55:43

polytect
Member
Registered: 2024-09-09
Posts: 10

Re: Laptop waking from sleep in my backpack

I would never keep my laptop in the backpack on standby. One key press wakes it up. This is very risky.

Offline

#8 2024-09-09 15:09:58

ZenRen
Member
Registered: 2020-05-08
Posts: 24

Re: Laptop waking from sleep in my backpack

Risky? How... Sure it drains my battery I guess. Literally working on fixing the problem of it waking up anyway

Offline

#9 2024-09-09 15:13:14

seth
Member
Registered: 2012-09-03
Posts: 57,278

Re: Laptop waking from sleep in my backpack

A spinning HDD might take damage depending on what else is happening w/ the backpack.

Offline

#10 2024-09-09 15:25:01

ZenRen
Member
Registered: 2020-05-08
Posts: 24

Re: Laptop waking from sleep in my backpack

Lol like I said I have a Thinkpad X395, you can't even fit a spinning disk in this thing

You couldn't pay me to keep a spinning disk in a laptop anyway

Offline

#11 2024-09-11 20:23:40

ZenRen
Member
Registered: 2020-05-08
Posts: 24

Re: Laptop waking from sleep in my backpack

I was chipping away at this a little while ago, but I am struggling to find out how to float/attach the keyboard with Wayland like Mesaprotector mentioned. Yeah I can list the devices, but then what? I could not find any documentation on this, at least for temporary use.

Would floating the keyboard under Wayland even prevent it from waking up from keyboard input?? I figured you'd need to disable it on the kernel level.

Offline

#12 2024-09-11 20:43:17

seth
Member
Registered: 2012-09-03
Posts: 57,278

Re: Laptop waking from sleep in my backpack

Writing the 4letter Code into /proc/acpi/wakeup will toggle the wakeup state of the device.

Offline

#13 2024-09-11 21:20:04

ZenRen
Member
Registered: 2020-05-08
Posts: 24

Re: Laptop waking from sleep in my backpack

That would be for disabling waking up with the keyboard outright, right? As I mentioned earlier, I don't want to do that, I just want it disabled when the lid is closed

The plan was to run a keyboard disable script for a lid close event, then a keyboard enable script for any wakeup trigger by editing the wakeup systemd unit

Offline

#14 2024-09-11 21:25:08

seth
Member
Registered: 2012-09-03
Posts: 57,278

Re: Laptop waking from sleep in my backpack

https://bbs.archlinux.org/viewtopic.php … 7#p2194507

I'd ckeck the lid when going to sleep and toggle the wakeup state depending on that.

Offline

Board footer

Powered by FluxBB