Re: Re: first shoot for smartbattery

Zdzisław A. Kaleta
2005-01-10T14:24:57Z

Dnia niedziela 09 stycznia 2005 14:41, Johan Vromans napisał:
> Pedro Venda <pjvenda-pQd4kjVL+RHfqL7NgpvPWWD2FQJk+8+b@public.gmane.org> writes:
> > I actually read some of the pdf you pointed me to and implemented a
> > couple of functions on the smartbattery.c. It now gets much more
> > information from the battery. If you find it relevant, I'll clean it
> > up a bit and post a patch for you. I know it will soon be dumped,
> > but it may show useful when debugging other driver informations.
>
> The attached program produces a nice battery status display using your
> modified version of battstat. It may be temporary, but at least now I
> have decent battery info at hand.
>
> -- Johan
First thank to all (especially to Bruno) for moving "smart battery problem
ahead)
The module and smartbattery program has compiled at kernels 2.6.10 (vanilia
and with the ac8, bk7, bk11 and bk12 patches)
The effect was
sanskryt@kender:/usr/local/download/acpi/smartbattery$ smartbattery 1
status: charging
current: 1957 mA
time to full: 105 minutes
remain: 3020 mAh
charge state: 74%
temperature: 35.8 C
voltage: 16451 mV
So it look great.
Two problems:
First the /dev/i2c-1 node can be read only by root. I think that the battery
status has to be readably for ordinary user.
Second: I can't execute battstat program.
after installing Tk::ProgressBar from Cpan and linking smartbattery to
smartbattery2 in /usr/local/bin there are two mistakes:
"Global symbol "$smbus" requires explicit package name at ./battstat.pl line
70." I change $smbus for "1"
and then
"Use of uninitialized value in concatenation (.) or string at ./battstat.pl
line 96.
Use of uninitialized value in numeric lt (<) at ./battstat.pl line 77.
Use of uninitialized value in numeric gt (>) at ./battstat.pl line 87.
Use of uninitialized value in numeric lt (<) at ./battstat.pl line 87."

which I don't know what to do with.
The lines after I make some editing and commenting are
70 - "my $res = `smartbattery2 $smbus 2>&1`;"
77 - "$tp = $current < 0 ? 'empty' : 'full';
87 - "if ( $current > 0 ) { # charging"
96 - "$mw->title("Battery: $time ($status%)");"
May be You can advise how to solve this before the battery can be read form
normal /proc/acpi/battery and /proc/acpi/ac-adapter ;-/
--
z.a.kaleta (sanskryt), registered Linux User #279350