LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 03-27-2024, 04:59 PM   #1
will41
Member
 
Registered: Jul 2020
Posts: 76

Rep: Reputation: Disabled
Mouse Awakens Laptop from Suspend


I have a Lenovo C940 with 16gb ram, 1tb ssd, running Fedora 39 Cinnamon desktop which is up to date. I am also using a wireless Logitech mouse with the dongle plugged into a type "A" usb port (there is only one type "A" port). This all works great except when the C940 is in suspend mode, the slightest movement of the mouse will awaken it. I have discovered that the following will prevent this from occurring:
Code:
sudo echo "XHC" > /proc/acpi/wakeup
However, this only works for the current session and at next boot it has to be run again. Is it possible to use the GUI "Startup Applications" to run a script containing this command? The issue there might be that to run it I need to be su. Will sudo and the subsequent password work in script? I'm not sure I want to do that even if it will. The other question is how to get the script into the "Startup Applications" list? I see no way to do that unless I edit one of the items already there.

Last edited by will41; 03-27-2024 at 05:07 PM.
 
Old 03-27-2024, 06:07 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,987

Rep: Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627
Does bios have any wake on settings?
 
Old 03-27-2024, 07:13 PM   #3
will41
Member
 
Registered: Jul 2020
Posts: 76

Original Poster
Rep: Reputation: Disabled
Doesn't appear so. The only usb related settings:
Enable/disable boot for usb = enabled
usb to lan device pxe boot =disabled
Always on usb = disabled
 
Old 04-06-2024, 01:33 PM   #4
Lurchicus
LQ Newbie
 
Registered: Mar 2024
Location: United States
Distribution: Ubuntu 23.10, Debian 12, Windows 11
Posts: 8

Rep: Reputation: 0
I'm not sure if this applies, but I also have a wireless Logitech mouse and dongle and it also wakes up my system if I move it (a really old XPS laptop running Debian 12). In my case, the mouse has a small switch on the bottom that turns the power to the mouse on and off (and if it's off, no amount of moving or clicking will wake up the system). Turn the switch back on, and any movement wakes the machine. The mouse is a "Logi" model M650 L. It uses a single replaceable AA battery (not rechargable by the way).

Hope this helps

Dan (aka Lurchicus)
 
Old 04-07-2024, 09:40 AM   #5
will41
Member
 
Registered: Jul 2020
Posts: 76

Original Poster
Rep: Reputation: Disabled
Yes. That does work as long as I remember to switch off the mouse before closing the lid. The command in post #1 works just fine until a reboot then it has to be run again. I'm wondering how to put that command into the list of "startup application" in the "menu" "system settings" (cinnamon desktop). Thanks.
 
Old 04-07-2024, 05:55 PM   #6
rokytnji
LQ Veteran
 
Registered: Mar 2008
Location: Waaaaay out West Texas
Distribution: antiX 23, MX 23
Posts: 7,117
Blog Entries: 21

Rep: Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474
Don't run Mint and not sure if this is what you want

video link
 
Old 04-08-2024, 06:28 PM   #7
will41
Member
 
Registered: Jul 2020
Posts: 76

Original Poster
Rep: Reputation: Disabled
Thanks. I'll check those out.
The first thing I notice is that the video references Linux Mint. Also, this video shows only how to add an existing application to the startup menu in Linux Mint (I'm using Fedora) but it appears to work the same in this case.
However my issue is, I think, that I need to add a custom command as su (not sudo). I ran across an old comment that said clicking on Startup Applications > + > Choose Application > Add Application the system will show every application available. So, if I add an executable file somewhere will it show up and be selectable here? That seems easy enough. However, I'm not sure how to deal with the fact that I need to be su to run the command. Also, where should the executable file be stored?

Maybe there is a better way to do it?

I searched the other 5 suggestions that rokytnji offered and found nothing that appears pertinent.

Last edited by will41; 04-08-2024 at 07:17 PM.
 
Old 04-11-2024, 02:13 PM   #8
will41
Member
 
Registered: Jul 2020
Posts: 76

Original Poster
Rep: Reputation: Disabled
I've found statements indicating that it is easy to add the command into the /etc/rc.local file which will run it at startup. These are the instructions I found:

Running a program automatically on Linux startup via rc.local

rc.local is a legacy script from the System V init system, executed before displaying a login screen for the desktop environment or terminal login prompt. It is typically a Bash shell script capable of running any commands.

To configure your rc.local script, follow these steps:

As the root user, open or create the /etc/rc.local file using your preferred editor if it doesn't exist.


Code:
$ sudo vi /etc/rc.local

    Add placeholder code to the file.

    #!/bin/bash

    exit 0
It must start with interpreter (/bin/bash) and ends with an exit code (0 is for success)
Insert commands and logic as needed.


Code:
#!/bin/bash

    /sbin/ip addr | grep inet\ | tail -n1 | awk '{ print $2 }' > /etc/issue
    echo "" >> /etc/issue

    exit 0
Set the file to executable.

Code:
$ sudo chmod a+x /etc/rc.local
The file will be executed as the root user during system boot

Here is the resulting rc.local file:

Code:
#!/bin/bash
echo "XHC" > /proc/acpi/wakeup
exit 0
I was logged in as su when creating the file and it is set to be executable. However, it does not work. Any suggestions?

Last edited by will41; 04-12-2024 at 11:59 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] System self-awakens after powerdown upnort Slackware 27 02-07-2019 11:28 AM
Feedback on TV antenna and on Star Wars: The Force Awakens Fixit7 General 1 12-23-2015 08:20 AM
How to disable automatic login 10.04 everytime computer awakens? gunrun705 Linux - Newbie 2 05-10-2010 11:22 AM
LXer: The Android Awakens LXer Syndicated Linux News 0 09-24-2008 12:30 AM
LXer: Asterisk awakens open source love in telecom entrepreneur LXer Syndicated Linux News 0 01-03-2008 12:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 07:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration