Skip to content

Fix battery name add logging and uninstall#5

Open
earthPerson-001 wants to merge 6 commits intolhl:mainfrom
earthPerson-001:fix-battery-name-add-logging-and-uninstall
Open

Fix battery name add logging and uninstall#5
earthPerson-001 wants to merge 6 commits intolhl:mainfrom
earthPerson-001:fix-battery-name-add-logging-and-uninstall

Conversation

@earthPerson-001
Copy link

  • Fix the battery name by using the output of glob instead of hardcoding to BAT1 in /sys/class/power_supply/BAT1/charge_full. (Determined by BAT0 begin the default name in my case)
  • Copying the contents of the local repository instead of moving it. This makes it easier for development as we don't have to clone the repo again after installation.
  • Renaming the file in /usr/lib/systemd/system-sleep to batterylog.sleep to follow the convention present in files there.
  • Added a few log messages on the system-sleep script to help in debugging if the scripts are running properly.
  • Added UNINSTALL.sh script for easier development ( requires some correction while running directly from /opt/batterylog).

…he name.

Previously, the battery name was hard-coded to BAT1 which mightn't be the battery designation for every device, so using the battery name generated from glob pattern while opening the file charge_full.

Additionally, it can be further improved to collect separate data for each batteries in case of multiple batteries (if required).
- For development purposes, it mightn't be feasible to get root access to edit the files inside of /opt/batterylog which is the folder of installation to which every file got moved prior to this. So, instead of moving the whole repository keeping a local copy as to make it easier for development.

- Also adding log messages for installation as to debug installation errors (if any).

- Adding .sleep to the extension of batterylog script used pior to suspend
and after resuming to keep it consistent with other files in
/usr/lib/systemd/system-sleep/.
…ng properly.

- Use string 'pre' and 'post' for comparison to remove ambiguity in the comparison.
Prior to this, user wouldn't totally know the location of added files as separate files are added to different locations, so to make it easier to properly remove the added files and restore the system to prior state, adding UNINSTALL.sh script.
@lhl
Copy link
Owner

lhl commented Aug 21, 2023

Hey thanks for the PR, been traveling but I'll take a look at it this week.

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.

2 participants