procfetch
procfetch copied to clipboard
Issue #127 fixed!
The issue #127 is hereby fixed as can be seen in the attached screenshot.
It is also made dynamic for the folder in /sys/class/power_supply. The code basically checks for any folder inside this one that starts with 'BA'. The required files of status and capacity are generally located in BAT0 or BAT1 folder here. The other case maybe of BAPM.
Thus the battery folder will always begin with 'BA' substring. The other folder will be for the adapter which doesn't start with 'BA' at all!
Hope this helps.
Revert back if any changes are required.
Thank you :)
Codecov Report
Attention: Patch coverage is 26.66667% with 22 lines in your changes are missing coverage. Please review.
Project coverage is 29.83%. Comparing base (
fad07dd) to head (7bd06e0).
:exclamation: Current head 7bd06e0 differs from pull request most recent head 2ad14fe
Please upload reports for the commit 2ad14fe to get more accurate results.
| Files | Patch % | Lines |
|---|---|---|
| src/fetch.cpp | 0.00% | 21 Missing :warning: |
| src/main.cpp | 0.00% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #135 +/- ##
===========================================
- Coverage 40.30% 29.83% -10.48%
===========================================
Files 4 4
Lines 583 533 -50
===========================================
- Hits 235 159 -76
- Misses 348 374 +26
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
The following will automatically format the source code, so try it out.
$ make -C src format
Hey @akshaykhoje! Can you pull the changes and see if it works?
Heyy @TanmayPatil105 The changes made seem to work now.
Attaching a screenshot for the same.
Just to add some notes for future references, I am adding a quick check used to bring about the effective change.
In the printBattery() function in fetch.cpp, the following block of code has been added which searches for the substring "BA" instead of "BAT1" or "BAT0". It is so because while researching, I came across a few other folders in the /sys/class/power_supply/ folder, whose common initial string was still "BA", but the third letter differed.
Attaching the code image hereby.