It would help others help you if you could provide info on your hardware, too.
See how to best do that in the introductory threads under the label:
“How to provide good information”.
I’ve never heard of this expression before! It’s interesting. Let me reframe my question as a YX problem and give the required context.
X (the actual the problem): My laptop does not to go to sleep when I close the lid lid.
Y (the question I’m asking that I think will solve my problem): Is there a way to automatically unload a given module as before the system goes to sleep and then reload when the system wakes up? Alternatively Is there a way to run a script with root privileges right before the system goes to sleep and another after it wakes up?
The fact is, if I first open a terminal and unload the module and close my laptop lid, then my laptop goes to sleep. If I do not do this, the laptop stays on and my backpack gets very hot.
I just want my laptop to go to sleep when I close the lid, without having that extra step. I could give more info about my computer or paste injournalctl outputs, but I honestly don’t think this is useful. Basically, reading throught the output of journalctl when I close my laptop lid, I see that the system starts going into sleep but then something happens that prevents it from entering the sleep state. Unloading the module beforehand fixes the problem.
Could somebody please answer my Y question?
Also I have looked at this below, but I don’t understand it.
I think they were trying to get at the idea that you may want to disable some powersaving setting for the USB to autosleep or something similar, rather than unloading/reloading the module.
That said … I’m not sure exactly what would be the best solution.
I had some examples of wireless cards that would fail if I did not do a unload/reload dance for suspend.