Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 485526

Summary: app-laptop/tpacpi-bat initscript uses invalid threshold, fails to actually change threshold
Product: Gentoo Linux Reporter: Michael Rowell <lambda.tango>
Component: Current packagesAssignee: Christoph Junghans (RETIRED) <junghans>
Status: RESOLVED FIXED    
Severity: normal CC: junghans
Priority: Normal Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Michael Rowell 2013-09-20 22:35:07 UTC
tpacpi-bat (both 1.0 and 9999) takes an argument for battery charge threshold percentages between 1 and 99. The default initscript, when called with the 'high' argument, attempts to set the upper threshold to 100. tpacpi-bat itself will complain, and the threshold will not be changed from its previous value. 

Using 99 instead of 100 (as described in the live program's documentation) solves the issue.
Comment 1 Christoph Junghans (RETIRED) gentoo-dev 2013-09-21 00:49:49 UTC
+*tpacpi-bat-1.0-r1 (21 Sep 2013)
+
+  21 Sep 2013; Christoph Junghans <ottxor@gentoo.org> +tpacpi-bat-1.0-r1.ebuild,
+  -tpacpi-bat-1.0.ebuild, files/tpacpi-bat.confd.0:
+  fixed TPACPI_BAT_HIGH_THRESH_STOP (bug #485526, thx to Michael)
+
Comment 2 Anton Bolshakov 2013-11-04 02:20:40 UTC
Sorry, I'm lazy to open an another bug. Could fix the init script (9999 for sure):
--- /etc/init.d/tpacpi-bat      2013-09-27 08:45:47.059504939 +0800
+++ /etc/init.d/._cfg0000_tpacpi-bat    2013-11-04 10:16:08.000000000 +0800
@@ -57,8 +57,8 @@
 
        for bat in ${BATS}; do
                ebegin "  setting thresholds for ${bat}: $tstart $tstop"
-               /usr/bin/tpacpi-bat startChargeThreshold ${bat} ${tstart}
-               /usr/bin/tpacpi-bat stopChargeThreshold ${bat} ${tstop}
+               /usr/bin/tpacpi-bat -s startThreshold ${bat} ${tstart}
+               /usr/bin/tpacpi-bat -s stopThreshold ${bat} ${tstop}
                eend $?
        done
 }
@@ -71,8 +71,8 @@
        require_started
 
        for bat in ${BATS}; do
-               tstart=$(/usr/bin/tpacpi-bat startChargeThreshold ${bat})
-               tstop=$(/usr/bin/tpacpi-bat stopChargeThreshold ${bat})
+               tstart=$(/usr/bin/tpacpi-bat -g startThreshold ${bat})
+               tstop=$(/usr/bin/tpacpi-bat -g stopThreshold ${bat})
                einfo "Battery ${bat}: ${tstart} ${tstop}"
        done
 }
Comment 3 Christoph Junghans (RETIRED) gentoo-dev 2013-11-04 04:08:33 UTC
(In reply to Anton Bolshakov from comment #2)
> Sorry, I'm lazy to open an another bug. Could fix the init script (9999 for
> sure):
> --- /etc/init.d/tpacpi-bat      2013-09-27 08:45:47.059504939 +0800
> +++ /etc/init.d/._cfg0000_tpacpi-bat    2013-11-04 10:16:08.000000000 +0800
> @@ -57,8 +57,8 @@
>  
>         for bat in ${BATS}; do
>                 ebegin "  setting thresholds for ${bat}: $tstart $tstop"
> -               /usr/bin/tpacpi-bat startChargeThreshold ${bat} ${tstart}
> -               /usr/bin/tpacpi-bat stopChargeThreshold ${bat} ${tstop}
> +               /usr/bin/tpacpi-bat -s startThreshold ${bat} ${tstart}
> +               /usr/bin/tpacpi-bat -s stopThreshold ${bat} ${tstop}
>                 eend $?
>         done
>  }
> @@ -71,8 +71,8 @@
>         require_started
>  
>         for bat in ${BATS}; do
> -               tstart=$(/usr/bin/tpacpi-bat startChargeThreshold ${bat})
> -               tstop=$(/usr/bin/tpacpi-bat stopChargeThreshold ${bat})
> +               tstart=$(/usr/bin/tpacpi-bat -g startThreshold ${bat})
> +               tstop=$(/usr/bin/tpacpi-bat -g stopThreshold ${bat})
>                 einfo "Battery ${bat}: ${tstart} ${tstop}"
>         done
>  }
Thanks, but please open a separate bug the next time, otherwise these things get lost in the already fixed bugs. 

+  04 Nov 2013; Christoph Junghans <ottxor@gentoo.org> +files/tpacpi-bat.initd.1,
+  tpacpi-bat-9999.ebuild:
+  fixes for new call syntax (bug #485526#c2)
+