Skip to content
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

battery: auto-detect battery if none specified #2735

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Zaphoood
Copy link
Contributor

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Other

Description

When no battery is specified, /sys/class/power_supply/ is scanned and the first entry is used. If no battery is found or if the present file doesn't read 1, the new formatting format-absent, which is PR introduces, is displayed.

Related Issues & Documents

Implements part of #2572

Documentation (check all applicable)

  • This PR requires changes to the Wiki documentation (describe the changes)
  • This PR requires changes to the documentation inside the git repo (please add them to the PR).
  • Does not require documentation changes

In Module: battery the lines

; Use the following command to list batteries and adapters:
; $ ls -1 /sys/class/power_supply/
battery = BAT0
adapter = ADP1

should be changed to

; Use the following command to list batteries and adapters:
; $ ls -1 /sys/class/power_supply/
; Default: First usable battery in /sys/class/power_supply/
battery = BAT0
adapter = ADP1

In addition, the following lines should be inserted after the section for format-low

; Format used when no battery is present
; Available tags:
;   <label-absent> (default)
;format-absent = <label-absent>

@codecov
Copy link

codecov bot commented May 29, 2022

Codecov Report

Merging #2735 (bdce01d) into master (f0dbb4c) will decrease coverage by 0.03%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #2735      +/-   ##
==========================================
- Coverage   13.56%   13.53%   -0.04%     
==========================================
  Files         152      152              
  Lines       11357    11384      +27     
==========================================
  Hits         1541     1541              
- Misses       9816     9843      +27     
Flag Coverage Δ
unittests 13.53% <0.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
include/modules/battery.hpp 0.00% <ø> (ø)
src/modules/battery.cpp 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f0dbb4c...bdce01d. Read the comment docs.

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.

None yet

1 participant