New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
suspend-then-hibernate: Add support for ACPI _BTP so that the bios/hw will trigger a wakeup when battery is low #23895
Conversation
Sorry. Just saw the review here. I was checking only this #23640 . Thanks for review @poettering . These suggested changes will be part of #23640 so will make changes and push. This PR will be build on the success of #23640 . I should have waited for that to merge before raising this. |
85903d6
to
836f528
Compare
This comment was marked as resolved.
This comment was marked as resolved.
e08b333
to
61acb7e
Compare
3ebd75d
to
d386b14
Compare
src/shared/sleep-config.c
Outdated
return SMBIOS_WAKEUP_BIT_SET; | ||
} | ||
log_debug("DMI BIOS System Information does not indicate wakeup type bit is set."); | ||
return SMBIOS_WAKEUP_BIT_UNSET; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified: we are not interest in the exact bit set, only if it was timer or not. So instead of the enum, simply make this function return 1 if it was timer, 0 if it wasn't, and negative error at usual on errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In systems like Ubuntu 22.04 on Lenovo Thinqpad, which have btp support so alarm file exists but the architecture does not expose smbios dmi entries. so this will need to return 0 if wakeup bit is not set. If any system exposes dmi entries and wakeup bit is set no matter what value, we need to check its set at the time of suspend.
if bit corresponds to APM, timer then hibernate. So the bit has to be returned to check on suspend as well as on wakeup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@poettering do you know what's the story with these dmi entries not being available?
4347e0e
to
54702b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Only several minor comments.
Missed this: the kernel enables the alarm by default if it's supported. I don't think we should override it - a user might want to disable it (eg: hardware is broken but kernel doesn't blocklist it yet), and they can do so. If we always override it, they can't. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found a few nits, please address before merging
Please review this. I have moved the while loop as a seperate helper now. |
No description provided.