Fix bug
This commit is contained in:
parent
f2c0820ef2
commit
b9b96dcc07
2
Makefile
2
Makefile
|
@ -13,7 +13,7 @@ $(INSTALL_PATH): cbattery
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
@echo "Removing cbattery from $(DESTDIR)"
|
@echo "Removing cbattery from $(DESTDIR)"
|
||||||
@su $(USER) -c '$(DESTDIR)/cbattery revert' || (echo "Reverting cbattery configurations failed"; exit 1)
|
@$(DESTDIR)/cbattery revert || (echo "Reverting cbattery configurations failed"; exit 1)
|
||||||
@rm -f $(INSTALL_PATH)
|
@rm -f $(INSTALL_PATH)
|
||||||
|
|
||||||
help:
|
help:
|
||||||
|
|
6
cbattery
6
cbattery
|
@ -39,14 +39,12 @@ enable_charging() {
|
||||||
sudo smc -k CH0B -w 00
|
sudo smc -k CH0B -w 00
|
||||||
sudo smc -k CH0C -w 00
|
sudo smc -k CH0C -w 00
|
||||||
disable_discharging
|
disable_discharging
|
||||||
write_cache "enabled"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
disable_charging() {
|
disable_charging() {
|
||||||
echo "Disabling battery charging"
|
echo "Disabling battery charging"
|
||||||
sudo smc -k CH0B -w 02
|
sudo smc -k CH0B -w 02
|
||||||
sudo smc -k CH0C -w 02
|
sudo smc -k CH0C -w 02
|
||||||
write_cache "disabled"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_smc_charging_hex() {
|
get_smc_charging_hex() {
|
||||||
|
@ -106,8 +104,8 @@ runScript() {
|
||||||
"charging")
|
"charging")
|
||||||
echo "Setting $action to $setting"
|
echo "Setting $action to $setting"
|
||||||
case "$setting" in
|
case "$setting" in
|
||||||
"on") enable_charging ;;
|
"on") enable_charging && write_cache "enabled" ;;
|
||||||
"off") disable_charging ;;
|
"off") disable_charging && write_cache "disabled" ;;
|
||||||
*) echo "Invalid option: $setting" ;;
|
*) echo "Invalid option: $setting" ;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in New Issue