You are not logged in.

#1 2023-03-26 21:06:27

train__wreck
Member
Registered: 2020-08-23
Posts: 32

Can't stop mouse from waking computer

I am trying to stop my mouse from waking my computer. Thought it would be simple.........

I am following the wiki instructions here: https://wiki.archlinux.org/title/Udev#W … USB_device . I am assuming that if I want to stop a device from waking the computer, I need to change "enabled" to "disabled".

So, I run the commands like the article says:

[root@HOSTNAME /]# lsusb | grep Razer
Bus 001 Device 005: ID 1532:0043 Razer USA, Ltd DeathAdder Chroma

Then I grep for the location under proc:

[root@HOSTNAME /]# grep 0043 /sys/bus/usb/devices/*/idProduct
/sys/bus/usb/devices/1-7/idProduct:0043
[root@pLAN9-Wil /]#

OK, so the wiki says I need to make a .rules file but replace the idVendor, idProduct, and the "driver/<whatever>/power/wakeup" with the values shown before. So I do that in /etc/udev/rules.d/50-wake-on-device.rules:

ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{idVendor}=="1532", ATTRS{idProduct}=="0043", ATTR{power/wakeup}="disabled", ATTR{driver/1-7/power/wakeup}="disabled"

and..... fail. The mouse still wakes up the computer. I get the following errors in the journal:

Mar 26 15:51:34 HOSTNAME (udev-worker)[411]: 1-7:1.1: /etc/udev/rules.d/50-wake-on-device.rules:1 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-7/1-7:1.1/power/wakeup}, ignoring: No such file or directory
Mar 26 15:51:34 HOSTNAME (udev-worker)[411]: 1-7:1.1: /etc/udev/rules.d/50-wake-on-device.rules:1 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-7/1-7:1.1/driver/1-7/power/wakeup}, ignoring: No such file or directory
Mar 26 15:51:34 HOSTNAME (udev-worker)[414]: 1-7:1.0: /etc/udev/rules.d/50-wake-on-device.rules:1 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-7/1-7:1.0/power/wakeup}, ignoring: No such file or directory
Mar 26 15:51:34 HOSTNAME (udev-worker)[414]: 1-7:1.0: /etc/udev/rules.d/50-wake-on-device.rules:1 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-7/1-7:1.0/driver/1-7/power/wakeup}, ignoring: No such file or directory
Mar 26 15:51:34 HOSTNAME (udev-worker)[419]: 1-7:1.2: /etc/udev/rules.d/50-wake-on-device.rules:1 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-7/1-7:1.2/power/wakeup}, ignoring: No such file or directory
Mar 26 15:51:34 HOSTNAME (udev-worker)[419]: 1-7:1.2: /etc/udev/rules.d/50-wake-on-device.rules:1 Failed to write ATTR{/sys/devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-7/1-7:1.2/driver/1-7/power/wakeup}, ignoring: No such file or directory

Really don't understand where I screwed up, I have no idea where those giant "Failed to write ATTR{......." directories are coming from, or why they show up 3 times,  but they definitely doesn't exist......

Offline

#2 2023-03-27 02:40:21

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 257

Re: Can't stop mouse from waking computer

train__wreck wrote:

I am trying to stop my mouse from waking my computer.

Do you mean waking from suspend or from hibernate? Or both?

train__wreck wrote:

Really don't understand where I screwed up, I have no idea where those giant "Failed to write ATTR{......." directories are coming from, or why they show up 3 times,  but they definitely doesn't exist......

Because "1-7:1.1" component in "/sys/devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-7/1-7:1.1/" path corresponds to an interface of USB device. Interfaces don't have idVendor/idProduct attribute as well as "power/wakeup". Probably you want

... ATTR{idVendor}=="1532", ATTR{idProduct}=="0043", ...

Note ATTR istead of ATTRS.
Also

ATTR{driver/1-7/power/wakeup}

looks redundant.

Offline

#3 2023-03-27 03:11:41

train__wreck
Member
Registered: 2020-08-23
Posts: 32

Re: Can't stop mouse from waking computer

I mean suspend, I do not have hibernation enabled.

So you're saying the whole rules file should like this?:

ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0043", ATTR{power/wakeup}="disabled"

Because this still doesn't work, the error messages in the log are gone but the mouse still wakes up the computer....

Offline

#4 2023-03-27 04:08:40

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 257

Re: Can't stop mouse from waking computer

train__wreck wrote:

So you're saying the whole rules file should like this?:

I explained where those directories are coming from: ATTRS matches all devices which parent node contain specifies attribute too, not only device itself.

train__wreck wrote:

Because this still doesn't work, the error messages in the log are gone but the mouse still wakes up the computer....

What "/sys/bus/usb/devices/1-7/power/wakeup" contain? Reload udev rules (`udevadm control -R`) and re-plug the mouse before checking. Or even better reboot for reliability.

Offline

#5 2023-03-27 05:07:22

train__wreck
Member
Registered: 2020-08-23
Posts: 32

Re: Can't stop mouse from waking computer

dimich wrote:

What "/sys/bus/usb/devices/1-7/power/wakeup" contain? Reload udev rules (`udevadm control -R`) and re-plug the mouse before checking. Or even better reboot for reliability.

The file contains "enabled". I have been rebooting each time, no change.

Offline

#6 2023-03-27 05:14:37

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 257

Re: Can't stop mouse from waking computer

train__wreck wrote:

The file contains "enabled". I have been rebooting each time, no change.

Output of

# udevadm info /sys/bus/usb/devices/1-7

?

What if you set it manually from command line:

# echo disabled > /sys/bus/usb/devices/1-7/power/wakeup

and suspend the system? Does mouse still wake it up? What is content of power/wakeup after waking up?

Offline

#7 2023-03-27 05:30:47

train__wreck
Member
Registered: 2020-08-23
Posts: 32

Re: Can't stop mouse from waking computer

dimich wrote:
train__wreck wrote:

The file contains "enabled". I have been rebooting each time, no change.

Output of

# udevadm info /sys/bus/usb/devices/1-7
P: /devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-7
M: 1-7
R: 7
U: usb
T: usb_device
D: c 189:4
N: bus/usb/001/005
L: 0
V: usb
E: DEVPATH=/devices/pci0000:00/0000:00:01.2/0000:02:00.0/usb1/1-7
E: SUBSYSTEM=usb
E: DEVNAME=/dev/bus/usb/001/005
E: DEVTYPE=usb_device
E: DRIVER=usb
E: PRODUCT=1532/43/200
E: TYPE=0/0/0
E: BUSNUM=001
E: DEVNUM=005
E: MAJOR=189
E: MINOR=4
E: USEC_INITIALIZED=7516621
E: ID_BUS=usb
E: ID_MODEL=Razer_DeathAdder_Chroma
E: ID_MODEL_ENC=Razer\x20DeathAdder\x20Chroma
E: ID_MODEL_ID=0043
E: ID_SERIAL=Razer_Razer_DeathAdder_Chroma
E: ID_VENDOR=Razer
E: ID_VENDOR_ENC=Razer
E: ID_VENDOR_ID=1532
E: ID_REVISION=0200
E: ID_USB_MODEL=Razer_DeathAdder_Chroma
E: ID_USB_MODEL_ENC=Razer\x20DeathAdder\x20Chroma
E: ID_USB_MODEL_ID=0043
E: ID_USB_SERIAL=Razer_Razer_DeathAdder_Chroma
E: ID_USB_VENDOR=Razer
E: ID_USB_VENDOR_ENC=Razer
E: ID_USB_VENDOR_ID=1532
E: ID_USB_REVISION=0200
E: ID_USB_INTERFACES=:030102:030000:030101:
E: ID_VENDOR_FROM_DATABASE=Razer USA, Ltd
E: ID_MODEL_FROM_DATABASE=DeathAdder Chroma
E: ID_PATH=pci-0000:02:00.0-usb-0:7
E: ID_PATH_TAG=pci-0000_02_00_0-usb-0_7
E: ID_FOR_SEAT=usb-pci-0000_02_00_0-usb-0_7
E: TAGS=:seat:uaccess:
E: CURRENT_TAGS=:seat:uaccess:
dimich wrote:

What if you set it manually from command line:

# echo disabled > /sys/bus/usb/devices/1-7/power/wakeup

and suspend the system? Does mouse still wake it up? What is content of power/wakeup after waking up?

This not only stops the mouse from waking the computer, it stops the keyboard too...... It remains "disabled" after wake up.

Offline

#8 2023-03-27 06:52:01

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 257

Re: Can't stop mouse from waking computer

Try this rule:

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0043", ATTR{power/wakeup}="disabled", RUN+="/usr/bin/logger -t udev 'Mouse attribute set to $attr{power/wakeup}'"

After reboot check journal:

# journalctl -b0 -t udev

Is attribute reported to be set to "disabled" but actual state is "enabled"?
If yes, probably some other udev rule or another piece of software (desktop environment?) overrides it.

train__wreck wrote:

This not only stops the mouse from waking the computer, it stops the keyboard too......

That's weird.

Last edited by dimich (2023-03-27 07:10:54)

Offline

#9 2023-03-27 07:38:24

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

Re: Can't stop mouse from waking computer

cat /proc/acpi/wakeup
lsusb -tv

Mouse and keyboard likely hang on the same hub and only the hub can be configured to wake the system.

I am trying to stop my mouse from waking my computer.

Is the problem that it causes spurious wakeups or that you want to be able to move (unplug?) it w/o having it wake the system?

Online

#10 2023-03-27 07:49:06

train__wreck
Member
Registered: 2020-08-23
Posts: 32

Re: Can't stop mouse from waking computer

dimich wrote:

Try this rule:

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0043", ATTR{power/wakeup}="disabled", RUN+="/usr/bin/logger -t udev 'Mouse attribute set to $attr{power/wakeup}'"

After reboot check journal:

# journalctl -b0 -t udev

Is attribute reported to be set to "disabled" but actual state is "enabled"?
If yes, probably some other udev rule or another piece of software (desktop environment?) overrides it.

train__wreck wrote:

This not only stops the mouse from waking the computer, it stops the keyboard too......

That's weird.

OK, I tried your udev rule. I get the expected output in the journal after boot:

Mar 27 02:45:06 HOSTNAME udev[439]: Mouse attribute set to disabled

But it still doesn't work, the mouse still wakes up the computer. "cat /sys/bus/usb/devices/1-7/power/wakeup" says enabled.....

Offline

#11 2023-03-27 07:52:49

train__wreck
Member
Registered: 2020-08-23
Posts: 32

Re: Can't stop mouse from waking computer

seth wrote:
cat /proc/acpi/wakeup
lsusb -tv

Mouse and keyboard likely hang on the same hub and only the hub can be configured to wake the system.

I am trying to stop my mouse from waking my computer.

Is the problem that it causes spurious wakeups or that you want to be able to move (unplug?) it w/o having it wake the system?

It is causing spurious wakeups, even the act of walking across the room vibrates the mouse enough that it wakes up the system. I want to stop this from happening. I would like to still have the keyboard wake the system.

If you're saying that the only way to accomplish this is by disabling the entire USB hub from wakeup, then I guess that's what I'll have to do.....

Offline

#12 2023-03-27 07:55:35

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,644

Re: Can't stop mouse from waking computer

Have you actually looked up the BIOS? There can be a switch there (I have one in mine) to enable or disable wakeup with mouse or keyboard.

Offline

#13 2023-03-27 08:01:22

train__wreck
Member
Registered: 2020-08-23
Posts: 32

Re: Can't stop mouse from waking computer

d_fajardo wrote:

Have you actually looked up the BIOS? There can be a switch there (I have one in mine) to enable or disable wakeup with mouse or keyboard.

I looked, I don't. The closest thing seemed to be a setting to allow "PCIE devices" to wake from sleep, I tried disabling that but the problem still persists.

Offline

#14 2023-03-27 08:07:47

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

Re: Can't stop mouse from waking computer

* lower the mouse's resolution
* put it onto a better surface (mousepad?)
* duct tape …

And post the output of the previous commands, maybe you can just use a different slot for the mouse or keyboard to keep them apart.

Online

#15 2023-03-27 09:51:39

NoSavvy
Member
From: Dorchester, Dorset, UK
Registered: 2013-01-23
Posts: 108

Re: Can't stop mouse from waking computer

My method.

cat /proc/acpi/wakeup

pick your mouse code,.

sudo echo "code" > /proc/acpi/wakeup. This may require trial and error with different codes, but no need to reboot

This is not permanent and gets reset on boot so create a batch file similar to below and a systemd file similar to :-

**ie no-wake.service

[Unit]
Description=Disable devices mouse as wakeup

[Service]
ExecStart=/bin/bash /usr/local/bin/disable-devices-as-wakeup.sh
Type=oneshot

[Install]
WantedBy=multi-user.target
**ie. disable-devices-as-wakeup.sh

#!/bin/bash

#sh -c "echo UHC6 > /proc/acpi/wakeup"


declare -a devices=(UHC6) # <-- Add your entries here
for device in "${devices[@]}"; do
    if grep -qw ^$device.*enabled /proc/acpi/wakeup; then
        sudo sh -c "echo $device > /proc/acpi/wakeup"
    fi
done

Offline

#16 2023-03-27 10:34:30

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 257

Re: Can't stop mouse from waking computer

ACPI behaviour may depend on hardware and BIOS settings. In my system "power/wakeup" for mouse is "disabled" by default. Even if i set it to "enabled", mouse move doesn't wake the system from suspend, only mouse button click does.

Offline

#17 2023-06-04 23:08:03

johannish
Member
Registered: 2023-06-04
Posts: 1

Re: Can't stop mouse from waking computer

Thanks for the answers and ideas here! Instead of a systemd service file to echo, and thanks to this other discussion and wiki page:
https://bbs.archlinux.org/viewtopic.php?id=164580
https://wiki.archlinux.org/title/System … rary_files

I ended up with the following file in /etc/tmpfiles.d/disable-wake.conf

#    Path                  Mode UID  GID  Age Argument
w    /proc/acpi/wakeup     -    -    -    -   XHC

Offline

#18 2023-12-18 18:00:09

testoasarapida
Member
Registered: 2023-12-18
Posts: 1

Re: Can't stop mouse from waking computer

train__wreck wrote:

OK, I tried your udev rule. I get the expected output in the journal after boot:

Mar 27 02:45:06 HOSTNAME udev[439]: Mouse attribute set to disabled

But it still doesn't work, the mouse still wakes up the computer. "cat /sys/bus/usb/devices/1-7/power/wakeup" says enabled.....

Hi, new guy around here with the same exact problem. My new mouse wouldn't stop from waking up the computer from even the slightest movement.
Made an account on here just to post my solution after working on it for two days. Modifying things in proc/acpi/wakeup as the last replies said didn't work for me, and this solution mixes together everything here:

The rule

ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTR{idVendor}=="1532", ATTR{idProduct}=="0043", ATTR{power/wakeup}="disabled"

is enough to modify the attribute of the 'wakeup' file, but after rebooting the computer some other rule which I wasn't able to figure out will re-modify the attribute to 'enabled'.

However, if you unplug and re-plug the mouse, our rule should nicely come into effect and change everything as we want. Since it's bothersome to to just that anytime you would reboot, we can bind and unbind the mouse in software after every reboot (in order for our rule to kick in). I used cronie for that:

# cat /proc/acpi/wakeup

As NoSavvy said, get your mouse code from here. For me it was the only one with XHC device.

Install cronie.

# systemctl enable cronie
# sudo crontab -e

Nano will open up, we have to list the commands we need cronie to run automatically at reboot:

@reboot bash -c "echo 0000:0c:00.3 > /sys/bus/pci/drivers/xhci_hcd/unbind" && bash -c "echo 0000:0c:00.3 > /sys/bus/pci/drivers/xhci_hcd/bind"

Save and exit. Replace 0000:0c:00.3 with your mouse code. Disabling only the USB device wouldn't work so we're unbinding and binding the whole Host Controller (xHCI). Hope this helps!

Offline

#19 2023-12-19 05:22:30

OpusOne
Member
Registered: 2023-05-31
Posts: 132

Re: Can't stop mouse from waking computer

train__wreck wrote:

It is causing spurious wakeups, even the act of walking across the room vibrates the mouse enough that it wakes up the system. I want to stop this from happening. I would like to still have the keyboard wake the system.

This is odd, I actually had to do the opposite in my case - enable wakeup for my mouse which was disabled by default. But the only way of waking up is to click on a mouse button, just moving it doesn't, fortunately. That would be very annoying indeed.
I'm guessing this is all due to how the mouse firmware is designed, so that it all depends on each mouse pretty much, what they decide will cause a USB wakeup event... I don't think there's any way you can configure that. So you can change mice. ;D

train__wreck wrote:

If you're saying that the only way to accomplish this is by disabling the entire USB hub from wakeup, then I guess that's what I'll have to do.....

That's possible. In my case, the mouse is directly connected to one of the motherboard's USB port, but internally, it *is* on a hub. Just an internal one. Maybe it makes a difference compared to an external hub. Not sure.
But I can certainly disable/enable  wakeup for each device selectively, and it does work without having to touch the hub itself.

And with all that said, the BIOS may have something to do with it as well indeed. In my case, for instance, while the keyboard is set to disabled for wakeup, if I press several times on the same key while in standby, this will wake up the computer anyway. It's handled by the BIOS. So that's another layer, you may have settings for this in your BIOS, or you may not.

Last edited by OpusOne (2023-12-19 05:31:20)

Offline

Board footer

Powered by FluxBB