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

fix(file_util::pick): ensure files are readable before picking them #3103

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

classabbyamp
Copy link
Contributor

@classabbyamp classabbyamp commented Mar 24, 2024

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

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Other: Replace this with a description of the type of this PR

Description

The firmware of the Lenovo X13s does not expose charge_now or charge_full, but the files still exist, so file_util::pick() will still choose that over energy_now/energy_full. This leads to the battery module erroneously outputting "0%" at all times. If charge_now or charge_full is read, it will return ENODATA, so simply reading 1 char and checking the status should determine if the file should actually be picked.

Related Issues & Documents

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

the firmware of the Lenovo X13s does not expose charge_now or
charge_full, but the files still exist, so file_util::pick() will still
choose that over energy_now/energy_full. This leads to the battery
module erroneously outputting "0%" at all times. If charge_now or
charge_full is read, it will return ENODATA, so simply reading 1 char
and checking the status should determine if the file should actually be
picked.
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