-
Notifications
You must be signed in to change notification settings - Fork 254
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
Add support for batteries outputting Time to empty on linux #378
Conversation
@@ -173,6 +173,8 @@ static bool slurp_battery_info(struct battery_info *batt_info, yajl_gen json_gen | |||
batt_info->present_rate = abs(atoi(walk + 1)); | |||
else if (BEGINS_WITH(last, "POWER_SUPPLY_VOLTAGE_NOW=")) | |||
voltage = abs(atoi(walk + 1)); | |||
else if (BEGINS_WITH(last, "POWER_SUPPLY_TIME_TO_EMPTY_NOW=")) |
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.
Could you maybe add a testcase for this?
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.
Yup, added test 026-battery-time-to-empty
The battery in the pinebook pro does not output the remaining charge in Wh or mAh, so i3 cannot calculate the time remaining. However, it does directly output the number of minutes remaining on in POWER_SUPPLY_TIME_TO_EMPTY. This adds support for reading this field and converting it to seconds_remaining.
44e6b4e
to
25ad137
Compare
What path do you have in your This is with a local build of the tsys 5.5.0 kernel. Does your kernel report battery capacity differently? |
@rillian I specify the full path to the battery, no substitution with %d:
|
Running into the same issue on my Pinebook Pro. Is there anything in particular I can do to aid this getting merged? |
damn I just forked to send this same PR! Oh well. |
Thank you! |
The battery in the pinebook pro does not output the remaining charge
in Wh or mAh, so i3 cannot calculate the time remaining. However, it
does directly output the number of minutes remaining on in
POWER_SUPPLY_TIME_TO_EMPTY. This adds support for reading this field
and converting it to seconds_remaining, so i3status can report the time remaining on the battery