22.04 lost mouse/touchpad control

Hi folks...
I've recently upgraded to 22.04 and I have an immediate issue. Well two actually.
The first is something I saw first with 20.04 and that was that I'd lose mouse and touchpad control if I left my machine to work with a program which would finish what it was doing and then idle till I came back to it. It would then lose control of functions of the touchpad and mouse to allow control of any window functions. I would have to manually invoke Shutdown and Restart. Everything would come back to normal. I never go word of a resolution when I reported this bug but after some updates along the way things sorted itself out. Well with 22.04 that problem is back.
I also use Compiz Window Manager along with Emerald Decorator and I've had little issue for years. I know it is no longer supported but, if I now use it I lose the ability to move windows with my mouse or touchpad. Any ideas are welcome.

Hi Deke,

I suspect your USB ports are powered down after a while by the energysaving features of the kernel, all for the good of energysaving and the longevity of your laptop battery.

so, yeah, well...a non working mouse or touchpad can be the side effect of it.

You could install 'powertop' to check this:
sudo apt install powertop

Start powertop in a terminal with: sudo powertop
On the tab-page 'tunables' you will see things like:

Good        Enable SATA link power management for host2
Good        Autosuspend for USB device MYSTIC LIGHT  [MSI]
Good        Autosuspend for USB device USB Receiver [Logitech]                                                     
Good        Runtime PM for I2C Adapter i2c-6 (AMDGPU DM i2c hw bus 3)
Good        Autosuspend for USB device Corsair Gaming K55 RGB Keyboard [Corsair]

look for your touchpad and mouse here.
You can toggle the powersaves on and off
This settings will have immediate effect but won't survive a reboot
But that is easy to solve, read on:

The moment that you toggle a setting, preferably the setting of your mouse,
powertop displays a command in the upper left corner more or less like this:
echo 'on' > '/sys/bus/usb/devices/1-5/power/control';

copy that command and paste it in /etc/rc.local, just above exit 0
repeat this for the setting of your touchpad

If you don't have /etc/rc.local, create it like this:

cat<<EOF | sudo tee /etc/rc.local
#!/bin/sh -e
#
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.


exit 0
EOF

Make it executable:

sudo chmod +x /etc/rc.local

And insert the forementioned lines
Now your mouse and touchpad should keep on working

There are more ways to get around this, see power management - How can I disable USB autosuspend for a specific device? - Ask Ubuntu

Thanks again for your replies. I think this has taken care of the problem but, I've done no DVD ripping recently to check in this way. I have been leaving the system active all night and getting into things again without fault in the mornings so I presume this has done the job. Just wish that the developers would take care of such things and not assume that we all work in the same manner.
I will now have to carry out this procedure every time I install a system until someone deems it illogical to setup the Power Management program the way they have...
I often install a fresh system because of my deep interest in using Linux and trying to find the most stable system (as I have done for years now) so this is going to be a pain.
Thanks anyways.

Just wish that the developers would take care of such things and not assume that we all work in the same manner.

Well, that is actually not the real problem. For instance, none of my computers ever had the problem you presented here.

I can reasonably assume that the OEM of your computer did a bit af a botch job on the BIOS/UEFI here (which is not unusual). You can't blame software developers for buggy hardware.

It is perfectly possible that a fix for the problem landed in a BIOS/UEFI update, so check the site of your OEM.

I will now have to carry out this procedure every time I install a system

No, only every time you install on this system. :slight_smile:

Thanks for your help.
It has been the same on an old Dell laptop as well as both of my Lenovos.
I praise the developers for their very hard work. It was bad of me to miscall them. It has been frustrating.
Thanks again for your insight and thoughts/help.