Skip to content

fix: adjust error handling in suspend script#314

Merged
ro8inmorgan merged 14 commits intoLoveRetro:mainfrom
ben16w:suspend
May 15, 2025
Merged

fix: adjust error handling in suspend script#314
ro8inmorgan merged 14 commits intoLoveRetro:mainfrom
ben16w:suspend

Conversation

@ben16w
Copy link

@ben16w ben16w commented May 14, 2025

Opened a new PR from a branch this time. Same changes as #304, but now using trap to run the after/resume function on any error.

@ben16w
Copy link
Author

ben16w commented May 15, 2025

Included @ro8inmorgan changes from #323 so I can test them both together

@ro8inmorgan
Copy link
Collaborator

ro8inmorgan commented May 15, 2025

Ok I will close my PR and we can continue on this one

@ro8inmorgan
Copy link
Collaborator

Its not really clear where it runs resume() now only?

@ro8inmorgan
Copy link
Collaborator

The previous script would just run and then suspend and then when you wake up it would continue to run for the rest of the code where it does the resume stuff. But now I see it runs the main function which does the suspend stuff. But how is the resume function triggered?

@ro8inmorgan
Copy link
Collaborator

Ok no clue how it works, but it works just tested it. Its shell magic :D Both main and resume are being called. Looks also like wifi is coming back on more instant. I sleep/resumed now a couple of times and wifi came back on right away while before it could def take a while.

@ben16w
Copy link
Author

ben16w commented May 15, 2025

It's triggered using the "trap "resume" EXIT INT TERM HUP QUIT". It basically means the resume function will run regardless of how the script exits (even if there's an error).

@ben16w
Copy link
Author

ben16w commented May 15, 2025

Done it like this because the suspend script was sometimes failing at "echo mem >/sys/power/state" which causes the script to fail and exit. The after function then didn't run and WiFi/Bluetooth was not getting restored.

@ben16w
Copy link
Author

ben16w commented May 15, 2025

There's some more info on #304

@ro8inmorgan ro8inmorgan merged commit 48b4896 into LoveRetro:main May 15, 2025
24 of 25 checks passed
@ben16w ben16w deleted the suspend branch May 15, 2025 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants