fix: adjust error handling in suspend script#304
fix: adjust error handling in suspend script#304ben16w wants to merge 0 commit intoLoveRetro:mainfrom
Conversation
|
Interesting, why would suspend fail? Arent we calling that in a loop until it succeeds? |
|
|
|
Did a quick Google search. It looks pretty command and the error can be ignored if it's still suspending successfully. Basically, the "Device or resource busy" error is reported by the kernel when some kernel driver or subsystem says that it is not ready for suspend. The system still suspends if the kernel determines it's not critical enough. |
|
I had a look at dmesg if anything was reporting busy with "dmesg | grep -i busy" and nothing jumped out at me, but I'm pretty sure that's what's causing it. |
I was thinking of this piece of code: https://github.com/LoveRetro/NextUI/blob/main/workspace/all/common/api.c#L2883 |
I'm wondering if this is something that needs some attention and if its related to the limbo/poweroff bug in any way. Not in this ticket, of course. |
|
Tbh something like that could well be blocking poweroff. In terms of that bit of code is that calling the suspend script multiple times? If so then the current state of WiFi/Bluetooth will be lost because of the same problem (i.e. if there's any error then WiFi/Bluetooth isn't restored) |
|
Instead, it might make more sense to put the code in the |
|
Are you bringing this one back? Currently trying to figure out why CI fails on it. |
|
I just forgot to make my changes in a branch so I couldn't pull from upstream. Going to open a new PR |
This PR updates the suspend script with these changes:
-o pipefailfrom the set command as it's not supported in sh./sys/power/statenon-fatal by appending || true, preventing the script from exiting if the suspend command fails.I've made these changes because when developing minui-power-control sometimes the WiFi doesn't restore after resuming from suspend. Looking at the logs, I found:
The suspend script is failing at
echo mem >/sys/power/state(even though the device does still suspend). This causes the script to fail and exit. Theafterfunction then doesn't run and WiFi/Bluetooth are not restored. This PR fixes that so that theafterfunction always runs regardless of erorrs withecho mem >/sys/power/state.