aboutsummaryrefslogtreecommitdiff
path: root/content/posts/2020-08-15-systemd-disable-wake-onmouse.md
diff options
context:
space:
mode:
Diffstat (limited to 'content/posts/2020-08-15-systemd-disable-wake-onmouse.md')
-rw-r--r--content/posts/2020-08-15-systemd-disable-wake-onmouse.md42
1 files changed, 33 insertions, 9 deletions
diff --git a/content/posts/2020-08-15-systemd-disable-wake-onmouse.md b/content/posts/2020-08-15-systemd-disable-wake-onmouse.md
index 09e5036..fabdc32 100644
--- a/content/posts/2020-08-15-systemd-disable-wake-onmouse.md
+++ b/content/posts/2020-08-15-systemd-disable-wake-onmouse.md
@@ -1,23 +1,43 @@
1--- 1---
2title: Disable mouse wake from suspend with systemd service 2title: Disable mouse wake from suspend with systemd service
3url: disable-mouse-wake-from-suspend-with-systemd-service.html 3url: disable-mouse-wake-from-suspend-with-systemd-service.html
4date: 2020-08-15 4date: 2020-08-15T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8I recently bought [ThinkPad X220](https://www.laptopmag.com/reviews/laptops/lenovo-thinkpad-x220) just as a joke on eBay to test Linux distributions and play around with things and not destroy my main machine. Little to my knowledge I felt in love with it. Man, they really made awesome machines back then. 8I recently bought [ThinkPad X220](https://www.laptopmag.com/reviews/laptops/lenovo-thinkpad-x220)
9just as a joke on eBay to test Linux distributions and play around with things
10and not destroy my main machine. Little to my knowledge I felt in love with it.
11Man, they really made awesome machines back then.
9 12
10After changing disk that came with it to SSD and installing Ubuntu to test if everything works I noticed that even after a single touch of my external mouse the system would wake up from sleep even though the lid was shut down. 13After changing disk that came with it to SSD and installing Ubuntu to test if 
14everything works I noticed that even after a single touch of my external mouse
15the system would wake up from sleep even though the lid was shut down.
11 16
12I wouldn't even noticed it if laptop didn't have [LED sleep indicator](https://support.lenovo.com/lk/en/solutions/~/media/Images/ContentImages/p/pd025386_x1_status_03.ashx?w=426&h=262). I already had a bad experience with Linux and it's power management. I had a [Dell Inspiron 7537](https://www.pcmag.com/reviews/dell-inspiron-15-7537) laptop with a touchscreen and while traveling it decided to wake up and started cooking in my backpack to the point that the digitizer responsible for touch actually glue off and the whole screen got wrecked. So, I am a bit touchy about this. 17I wouldn't even noticed it if laptop didn't have
18[LED sleep indicator](https://support.lenovo.com/lk/en/solutions/~/media/Images/ContentImages/p/pd025386_x1_status_03.ashx?w=426&h=262).
19I already had a bad experience with Linux and it's power management. I had a
20[Dell Inspiron 7537](https://www.pcmag.com/reviews/dell-inspiron-15-7537) laptop
21with a touchscreen and while traveling it decided to wake up and started cooking
22in my backpack to the point that the digitizer responsible for touch actually
23glue off and the whole screen got wrecked. So, I am a bit touchy about this.
13 24
14I went on solution hunting and to my surprise there is no easy way to disable specific devices to perform wake up. Why is this not under the power management tab in setting is really strange. 25I went on solution hunting and to my surprise there is no easy way to disable
26specific devices to perform wake up. Why is this not under the power management 
27tab in setting is really strange.
15 28
16After googling for a solution I found [this nice article describing the solution](https://codetrips.com/2020/03/18/ubuntu-disable-mouse-wake-from-suspend/) that worked for me. The only problem with this solution was that he added his solution to `.bashrc` and this triggers `sudo` that asks for a password each time new terminal is opened, which get annoying quickly since I open a lot of terminals all the time. 29After googling for a solution I found [this nice article describing the solution](https://codetrips.com/2020/03/18/ubuntu-disable-mouse-wake-from-suspend/)
30that worked for me. The only problem with this solution was that he added his
31solution to `.bashrc` and this triggers `sudo` that asks for a password each
32time new terminal is opened, which get annoying quickly since I open a lot of
33terminals all the time.
17 34
18I followed his instructions and got to solution `sudo sh -c "echo 'disabled' > /sys/bus/usb/devices/2-1.1/power/wakeup"`. 35I followed his instructions and got to solution
36`sudo sh -c "echo 'disabled' > /sys/bus/usb/devices/2-1.1/power/wakeup"`.
19 37
20I created a system service file `sudo nano /etc/systemd/system/disable-mouse-wakeup.service` and removed `sudo` and replaced `sh` with `/usr/bin/sh` and pasted all that in `ExecStart`. 38I created a system service file `sudo nano /etc/systemd/system/disable-mouse-wakeup.service`
39and removed `sudo` and replaced `sh` with `/usr/bin/sh` and pasted all that
40in `ExecStart`.
21 41
22```ini 42```ini
23[Unit] 43[Unit]
@@ -44,4 +64,8 @@ sudo systemctl start disable-mouse-wakeup.service
44sudo systemctl status disable-mouse-wakeup.service 64sudo systemctl status disable-mouse-wakeup.service
45``` 65```
46 66
47This will permanently disable that device from wakeing up you computer on boot. If you have many devices you would like to surpress from waking up your machine I would create a shell script and call that instead of direclty doing it in service file. 67This will permanently disable that device from wakeing up you computer on boot.
68If you have many devices you would like to surpress from waking up your machine
69I would create a shell script and call that instead of direclty doing it in
70service file.
71