Torsmo


Forum: Apps
Topic: Torsmo
started by: clivesay

Posted by clivesay on Dec. 26 2005,18:00
Thought I might start a thread for questions and tips since this is now part of the DSL base.

I have a question about the Battery. I did some googling but can't get it to work. I installed the latest RC on a laptop but the battery field is blank. I did not boot with any special boot codes except vga=normal. I tried some tweaking with no luck.

Any ideas?

Chris

Posted by roberts on Dec. 26 2005,20:56
Battery meter working fine on my apm capable laptops.
My dmesg shows:
apm: BIOS version 1.2 Flags 0x03 (Driver version 1.16)

And a ps shows:
dsl@box:~$ ps aux | grep apm
root       991  0.0  0.0     0    0 ?        SW   13:43   0:00 [kapmd]

A friend of miine, who has a much newer laptop, had use the boot option of noacpi

Posted by clivesay on Dec. 26 2005,22:19
I tried the things you mentioned. I see apm in dmesg but it says override by acpi even though I have noacpi in the boot code? Any other ideas?
Posted by roberts on Dec. 27 2005,00:59
Adjust your bios?
Posted by clivesay on Dec. 27 2005,20:17
No power management in the bios. I tried the acpi dockapp but tells me no battery detected and the apm dockapp tells me apm is not supported in the kernel. Maybe a bios upgrade is in order (Inspiron 2500)

Chris

Posted by Vince on Feb. 15 2006,08:37
I have an Inspiron 4000 and I just noticed the same thing tonight when I did a
HD install of DSL. No battery showing. Any help appreciated. Also, how do I set this as an icon as I wish to possibly tweak the way it looks...if that is possible.

But the bigger question is how would one do a Bios update? And would that screw with the current DSL that I have installed? I just want to see my battery needs.

Thanks ahead of time..

Vince

Posted by roberts on Feb. 15 2006,10:53
The battery meter work fine on older laptops, those that support apm.
You may have to adjust your defult boot settings or bios to use the older apm if possible.

Posted by doobit on Feb. 15 2006,15:26
It works great on my Toshiba Sat Pro 480CDT also.
Posted by marimo on Feb. 16 2006,04:09
Just went into my bios and there is no setting to change to APM. I I have an Inspiron 4000 laptop. I wonder what's up. Any other suggestions to get the battery monitor working? How about any other simple battery monitors?

Thanks ahead of time.
Marimo

Posted by hs7sv on Feb. 16 2006,05:23
I'm using DSL-2.1b and wmacpi_1.99r7.dsl on my laptop :D
Posted by marimo on Mar. 01 2006,05:46
Quote (hs7sv @ Feb. 16 2006,00:23)
I'm using DSL-2.1b and wmacpi_1.99r7.dsl on my laptop :D

I just added the wmacpi .dsl file and nothing appeared on my desktop. Also no icon appeared. Do I need to manually go into the flux box menu or the .ixinitrc  file to edit it to make it come up at boot in a certain place on the screen? I have had no luck in trying to get 'wavemon' or other things to come up at boot when I have edited this file before. I have used the 'exec' command and the "&" at the end of the line. A tad confusing. Is there a tutorial or FAQ somewhere on this?.

Also, while we're talking icons, I notice that everytime I reboot, my icons disappear. I then have to manually go in and select 'fully enhanced desktop' from the menu.
Suggestions?

And last one: how the hect do i get a bios update for my 1999 computer? Can I do it over the internet? Or do I have to have to send this Inspiron 4000 back to Dell (fat chance that i pony up $$ for that...) Bios was updated in 2001 when my internal harddrive failed and they replaced it.
Any suggestions? I have heard the term 'flashing' a bios ...but I alwasys thougth that was something that could be done by myself...

Thanks.
Marimo

Posted by hs7sv on Mar. 01 2006,06:53
marimo, Please read < this thread >. Option: apm=off acpi=force are needed in menu.lst or lilo.conf. I added these commands in /opt/bootlocal.sh
Code Sample
sudo modprobe battery
sudo modprobe button
sudo modprobe fan  
sudo modprobe processor
sudo modprobe thermal
sudo modprobe ac

For dMix problem, please read < this thread >. I'm using this command in .xinitrc:-
Code Sample
sleep 3; wmswallow -geometry 64x64 docked &

Note:
Quote (hs7sv @ Feb. 18 2006,10:19)
For the better time remaining calculating and 2 batteries support, I replaced wmacpi_1.99r7.dsl with wmbatteries.

Posted by marimo on Mar. 04 2006,20:04
Quote (hs7sv @ Feb. 28 2006,22:53)
marimo, Please read < this thread >. Option: apm=off acpi=force are needed in menu.list or lilo.conf. I added these commands in /opt/bootlocal.sh
Code Sample
sudo modprobe battery
sudo modprobe button
sudo modprobe fan  
sudo modprobe processor
sudo modprobe thermal
sudo modprobe ac

For dMix problem, please read < this thread >. I'm using this command in .xinitrc:-
Code Sample
sleep 3; wmswallow -geometry 64x64 docked &

Note:
Quote (hs7sv @ Feb. 18 2006,10:19)
For the better time remaining calculating and 2 batteries support, I replaced wmacpi_1.99r7.dsl with wmbatteries.

I am using grub as my loader. Should I be putting the
Option: apm=off acpi=force
somewhere else instead of a Lilo.conf file...for example is there a Grub.conf file? Just looking before I leap on this one. I already added the line of sudo modprobe commands. Also I just looked at the menu.list file--what does that do?

Noobie says thank you...
Marimo

Posted by hs7sv on Mar. 06 2006,03:34
I am using:-

hda1 - DSL image (100MB)
hda2 - MyDSL, Backup/Restore and Data

Below is a code sample in /mnt/hda1/boot/grub/menu.lst
Code Sample
title DSL fb1024x768
kernel /boot/linux24 root=/dev/hda1 quiet apm=off acpi=force vga=791 noapic noapm dma noscsi frugal mydsl=hda2 restore=hda2
initrd /boot/minirt24.gz  

You can use Emelfm as SuperUser for mounting and edit menu.lst in Beaver. Good luck   :D

Posted by hs7sv on Mar. 07 2006,02:38
I searched for torsmo ACPI and found < ACPI Battery stats for the command line >. It is written in perl script. I tested it on my laptop. It works! :D

This script is a modified version of battstate.pl that I'm using:-
Code Sample
#!/usr/bin/perl
#
# This is somem messy Perl script, but hey,
# it works. If you somehow stuble upon this
# code, then please note that you may have to
# change certain paths, such as BAT0, depending
# on how many batteries you have. Also, note
# that this script has only been tested with
# ACPI and not APM.
#
# Enjoy! :-)
#
# written by ateam (derek@backdrifts.net)
#
# modified for DSL-2.1b by hs7sv (paphons@gmail.com)

chop (@info = `cat /proc/acpi/battery/BAT0/state`);
chop (@capacity = `cat /proc/acpi/battery/BAT0/info`);

chop ($left = @info[4]);
chop ($left = `echo \"$left\" | awk '{ print \$3 }'`);

$state = @info[2];
chop ($state = `echo \"$state\" | awk '{ print \$3 }'`);

chop ($full = @capacity[1]);
chop ($full = `echo \"$full\" | awk '{ print \$3 }'`);

$remain = $left / $full * 100;
$remain = int ($remain);

chop (@time = `cat /proc/acpi/battery/BAT0/state`);
chop (@time2 = `cat /proc/acpi/battery/BAT0/info`);

$rcap = @time[4];
chop ($rcap = `echo \"$rcap\" | awk '{ print \$3 }'`);

$prate = @time[3];
chop ($prate = `echo \"$prate\" | awk '{ print \$3 }'`);

if ($prate > 0)
{
  if ($state eq "discharging")
  {
        $seconds = $rcap / $prate * 60 * 60;
  }

  elsif ($state eq "charging")
  {
        $seconds = ($full - $rcap) / $prate * 60 * 60;
  }

   $minutes = sprintf("%.2f", $minutes);

   $hours = $seconds / 60 / 60;
   $hours = sprintf("%.2f", $hours);

   chop ($singhour = $hours);
   chop ($singhour);
   chop ($singhour);

   $hourmins = $hours;

   $hourmins =~ s/^.//;
   $hourmins =~ s/^.//;

   $hourmins = $hourmins * .6;
   $hourmins = sprintf("%.0f", $hourmins);
}
else
{
   $seconds = 0;
}

if ($singhour >= 1)
{
   print " $singhour";
}

if ($hourmins >= 1)
{
   if ($singhour < 1)
   {
       print " 0";
   }

   if ($hourmins < 10)
   {
       print ":0$hourmins";
   }
   else
   {
       print ":$hourmins";
   }
   print " remains"
}
else
{
   print " A:C";
}

print "\n";

if ($state eq "charged")
{
   $printstate = "AC on-line";
}
elsif ($state eq "discharging" and $rcap eq $full)
{
   $printstate = "AC on-line";
}
elsif ($state eq "charging")
{
   $printstate = "AC on-line and charging";
}
elsif ($state eq "discharging")
{
   $printstate = "AC unplugged";
}

print " $remain%, $printstate";

It can be executed in your ~/.torsmorc file quite simply. :D
Code Sample
${color grey}Battery:  $color${exec perl /home/dsl/battstate.pl}

Posted by cbagger01 on Mar. 07 2006,18:30
Cool.

I like getting info like this from short scripts instead of additional binaries.

Seems like it could be used a number of ways.

You can run it from the commandline if you are a console or xterm junkie

You can incorporate it into Torsmo

You can build a little FLUA dockapp to report this info.

I like the Torsmo approach because all the other sysinfo is already sitting there so it is a consistent place to store this info.

Posted by doobit on Mar. 07 2006,19:00
that is a very nice script. :)
Posted by jot on May 19 2006,23:41
Is there a need to monitor xmms status or simple rss headline viewer or gmail mail headlines in torsmo ?

If You wish I can provide my scripts.

P.S.
Well I found some of them , and modified, actually :)

Posted by teitoku on Aug. 09 2006,01:03
Hey, your script doesn't work correctly with DSL 3.0.1.  

First off, torsmo already has a battery line that doesn't work.  I fiddled with it, left it, and put in the line to call your script.   It shows this:

Battery:             A:C
,84%

Yep, A:C and it's on two lines.    Any formatting tips?

Posted by hs7sv on Feb. 07 2007,14:27
This is charging state checking that I'm using:-

Code Sample

.
.
}
else
{
  print ":00";
}
print " remains\n";

if ($state eq "discharging" and $prate == 0)
{
  $printstate = "AC on-line";
}
elsif ($state eq "charging")
{
  $printstate = "AC on-line and charging";
}
elsif ($state eq "discharging")
{
     $printstate = "AC unplugged";
}
print " $remain%, $printstate";

You can check battery state by:-
Code Sample
cat /proc/acpi/battery/BAT0/state

and calculate remain time by this formula:  remain capacity / present rate

Posted by hs7sv on Feb. 14 2007,12:09
This is a modified version of battstate.pl for 2 batteries support:-
Code Sample
#!/usr/bin/perl
#
# This is somem messy Perl script, but hey,
# it works. If you somehow stuble upon this
# code, then please note that you may have to
# change certain paths, such as BAT0, depending
# on how many batteries you have. Also, note
# that this script has only been tested with
# ACPI and not APM.
#
# Enjoy! :-)
#
# written by ateam (derek@backdrifts.net)
#
# modified for 2 batteries support by hs7sv (paphons@gmail.com)

##### Remain Capacity 1 #####

chop (@info = `cat /proc/acpi/battery/BAT0/state`);
chop (@capacity = `cat /proc/acpi/battery/BAT0/info`);

$state = @info[2];
chop ($state1 = `echo \"$state\" | awk '{ print \$3 }'`);

chop ($left = @info[4]);
chop ($left1 = `echo \"$left\" | awk '{ print \$3 }'`);

chop ($full = @capacity[1]);
chop ($full1 = `echo \"$full\" | awk '{ print \$3 }'`);

##### Remain Capacity 2 #####

chop (@info = `cat /proc/acpi/battery/BAT1/state`);
chop (@capacity = `cat /proc/acpi/battery/BAT1/info`);

$state = @info[2];
chop ($state2 = `echo \"$state\" | awk '{ print \$3 }'`);

chop ($left = @info[4]);
chop ($left2 = `echo \"$left\" | awk '{ print \$3 }'`);

chop ($full = @capacity[1]);
chop ($full2 = `echo \"$full\" | awk '{ print \$3 }'`);

##### Remain Time 1 #####

chop (@time = `cat /proc/acpi/battery/BAT0/state`);

$rcap = @time[4];
chop ($rcap1 = `echo \"$rcap\" | awk '{ print \$3 }'`);

$prate = @time[3];
chop ($prate1 = `echo \"$prate\" | awk '{ print \$3 }'`);

##### Remain Time 2 #####

chop (@time = `cat /proc/acpi/battery/BAT1/state`);

$rcap = @time[4];
chop ($rcap2 = `echo \"$rcap\" | awk '{ print \$3 }'`);

$prate = @time[3];
chop ($prate2 = `echo \"$prate\" | awk '{ print \$3 }'`);

##### Combination #####

if ($state1 eq "charging" or $state2 eq "charging")
{
  $state = "charging";
}
else
{
  $state = "discharging";
}

$left = $left1 + $left2;
$full = $full1 + $full2;

$remain = $left / $full * 100;
$remain = int ($remain);

$rcap = $rcap1 + $rcap2;
$prate = $prate1 + $prate2;

##### Remain Time Calculation #####

if ($prate > 0)
{
  if ($state eq "discharging")
  {
     $seconds = $rcap / $prate * 60 * 60;
     if ($remain < 10)
     {
        $charge = "remaining LOW";
     }
     else
     {
        $charge = "remaining";
     }
  }
  else
  {
       $seconds = ($full - $rcap) / $prate * 60 * 60;
       $charge = "until charged";
  }

  $minutes = sprintf("%.2f", $minutes);

  $hours = $seconds / 60 / 60;
  $hours = sprintf("%.2f", $hours);

  chop ($singhour = $hours);
  chop ($singhour);
  chop ($singhour);

  $hourmins = $hours;

  $hourmins =~ s/^.//;
  $hourmins =~ s/^.//;

  $hourmins = $hourmins * .6;
  $hourmins = sprintf("%.0f", $hourmins);
}
else
{
  $seconds = 0;
}

if ($singhour >= 1)
{
  print " $singhour";
}

if ($hourmins >= 1)
{
  if ($singhour < 1)
  {
      print " 0";
  }

  if ($hourmins < 10)
  {
      print ":0$hourmins";
  }
  else
  {
      print ":$hourmins";
  }
  print " $charge";
}
elsif ($state eq "discharging" and $prate == 0)
{
  print " A:C";
}
else
{
  print ":00 $charge";
}

print "\n";

if ($state eq "discharging" and $prate == 0)
{
  $printstate = "AC on-line";
}
elsif ($state eq "charging")
{
  $printstate = "AC on-line and charging";
}
elsif ($state eq "discharging")
{
     $printstate = "AC unplugged";
}
print " $remain%, $printstate";

This program works for a battery also.  :D

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.