Mouse still active when computer shuts down

Hello,
I have a framework 13 AMD laptop which is currently duel booting windows and linux (linux on a 1TB expansion card) and i’ve noticed that when i shut off my computer with the “shut down” command on ubuntu, the computer takes a minute and then shuts down, but my Razer mouse which has colours that light the mouse up stays on.

The weird thing is, when i shut down my computer on windows the mouse lights go off entirely. This may seem like a small thing, but when i sleep at night the light is somewhat bright in a dark room and i would rather not unplug my mouse every night to avoid this issue.

Thanks in advance for any help,
John

If I gave you a patch could you compile a kernel?

I have a guess what’s going on here.

I don’t have sufficient knowledge to do that to be honest, i’m willing to try if you have documentation for it and it isn’t too difficult but would you mind sharing why you think it may be happening?

I suspect that the PHY isn’t getting turned off at shutdown. Can you try to familiarize yourself with building a kernel?

Your distro will have some documentation that is localized to their packaging system.

Is there something in the logs or thst can be turned on for logging, to help confirm without need for a kernel rebuild?

No; not really. If one of you guys are hitting this and are willing to test, I’m fine to spend a little bit of time to spin up a patch to confirm my suspicion though.

You can try using udev rules or uhubctl.

I’ve been reading on how to build a kernel, but Be_Far’s solution seems much less time consuming so I’m gonna give that a try first and see if I can make a script that executes on shutdown to off my mouse usb.

Even if that helps, I would appreciate if we can get down to the real issue eventually. If the PHY really is staying powered at S5, it’s probably a generic USB driver problem and means that the laptop will use more power at S5 than it should.

I’m no stranger to this type of issue; I did have a patch series that attempted to generically fix something like it in the past:
https://lore.kernel.org/lkml/20231213182656.6165-1-mario.limonciello@amd.com/

Those patches might even help this issue, but I want to localize a fix to the USB driver if possible.

it is also possible that while your laptop is plugged in, the USB ports stay live. Windows has a driver that turns this off properly, but Linux is not.

Quick way to tell if this is the case is to power off under Ubuntu. When you notice that your mouse is still powered, unplug your Framework from the charger. You should see that the power goes off on the mouse.

If this is the case then this is what is happening. Mario might be able to help you get that sorted under Linux.

Another really useful data point on problematic hardware if you have a dual boot is to shut down the machine in Windows without using “fast startup” enabled.

Windows actually puts the machine into S4 when Fast Startup is enabled. By turning it off you’ll go into S5 and we can compare behavior.

1 Like

This did work, after about thirty seconds the mouse did shutoff

Yeah i understand what your saying Mario i think using the github repo is not really solving the actual problem, i’ll read more into how to build a kernel and maybe we can give it a test, do you have any good specific resources to learn how to do that well? If not its okay i’m currently reading a post about it but i was just wondering if you had a resource you found particularly helpful.

That is a very good point. Getting to it requires you to go to the legacy control panel power options to change it.