Re: Acustic 'empty battery warning' ?

2008-12-22 Thread john dowd
I'm sure someone has mentioned this application before but just in
case, have you ever heard of using the accelerometer to check the
batter status? The application that I heard about was: when the
application is running, you shake the FR just like you shake an opaque
water bottle to determine if its full or not, the application will
cause the phone to gurgle with the appropriate pitch in sound that
you would get if the FR's battery was full, half emtpy or empty.

This would be way kewl!!

Cheers!!

2008/12/20 François TOURDE fr...@tourde.org:
 Le 14230ième jour après Epoch,
 Lothar Behrens écrivait:

 Am 17.12.2008 um 13:16 schrieb Timo Juhani Lindfors:

 Lothar Behrens lothar.behr...@lollisoft.de writes:
 Is there a way to do this ?

 while true; do
  if [ `capacity` -lt 10 ]; then
  alert
  fi
  sleep 120
 done


 this is a starting point :-)

 I've a small script that works as a daemon, checking interval depends
 on the charge (described on a file), play sounds (except when
 charging) depending on the current charge.

 There is no doc, no install proc, it's not packaged, but it can be
 done easily...

 The config file (default values in the script) contains:

  # Les différents niveaux
  THRESHOLDS=100:20:1200: 20:10:600:low 10:5:150:critical 5:0:30:emergency

 Each group of check parms is max:min:delay:sound

 If level is between (_max_,_min_), the aplay _sound_.wav and wait _delay_
 for next check.

 Hope it helps.



 --
 PR: Le serveur (de news) de PacWan est en panne depuis le mois de juillet !
 AT: A mon avis ils vont finir par s'en apercevoir, mais il risque de manquer
des articles.
-+- in: Guide du Cabaliste Usenet - La Cabale se propage (mal) -+-

 ___
 Openmoko community mailing list
 community@lists.openmoko.org
 http://lists.openmoko.org/mailman/listinfo/community





-- 
  John Dowd
  jd...@slashdevslashnull.org
  133 Waverley St.
  Ottawa Ont. K2P 0V3
  Home: (613)234-7884
  Cell: (613)316-7884

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: Acustic 'empty battery warning' ?

2008-12-20 Thread François TOURDE
Le 14230ième jour après Epoch,
Lothar Behrens écrivait:

 Am 17.12.2008 um 13:16 schrieb Timo Juhani Lindfors:

 Lothar Behrens lothar.behr...@lollisoft.de writes:
 Is there a way to do this ?

 while true; do
  if [ `capacity` -lt 10 ]; then
  alert
  fi
  sleep 120
 done


 this is a starting point :-)

I've a small script that works as a daemon, checking interval depends
on the charge (described on a file), play sounds (except when
charging) depending on the current charge.

There is no doc, no install proc, it's not packaged, but it can be
done easily...

The config file (default values in the script) contains:

  # Les différents niveaux
  THRESHOLDS=100:20:1200: 20:10:600:low 10:5:150:critical 5:0:30:emergency

Each group of check parms is max:min:delay:sound

If level is between (_max_,_min_), the aplay _sound_.wav and wait _delay_
for next check.

Hope it helps.


#!/bin/sh
#
# Start or stop the bat alarm Daemon.
#
# Written by Francois TOURDE fr...@tourde.org
#


[ -f /etc/default/batalarm ]  . /etc/default/batalarm

case $1 in
start)
echo -n Starting batalarm daemon: 
start-stop-daemon -S -p /var/run/batalarm.pid -m -x /usr/bin/batalarm 
if [ $? = 0 ]; then
echo batalarm.
else
echo (failed.)
fi
;;
stop)
echo -n Stopping batalarm daemon: 
start-stop-daemon -K -p /var/run/batalarm.pid 
echo batalarm.
;;
restart|force-reload)
$0 stop
$0 start
exit
;;
*)
echo Usage: /etc/init.d/batalarm {start|stop|restart|force-reload}
exit 1
;;
esac

exit 0
#!/bin/sh
# -*- coding: utf-8 -*-
# Batalarm - An application to check bat
#
# Version 0.1
#
# Authors: Francois TOURDE fr...@tourde.org
#
# Copyright (c) 2008 François TOURDE
#
# batalarm is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# batalarm is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# TODO
#
# Change List
#
# 2008-11-17: First release

# First, the default values:
BAT_CAPACITY=/sys/devices/platform/bq27000-battery.0/power_supply/bat/capacity
BAT_PLUGGED=/sys/devices/platform/bq27000-battery.0/power_supply/bat/online
BAT_ALERT=/usr/share/batalarm/sounds/
SLEEP_INIT=600
#
# Les différents niveaux
THRESHOLDS=100:20:1200: 20:10:600:low 10:5:150:critical 5:0:30:emergency
[ -f /etc/default/batalarm ]  . /etc/default/batalarm

while true
do
  v=$(cat $BAT_CAPACITY)
  for t in $THRESHOLDS
  do
t=$(echo $t|sed -e 's/:/ /g')
max=$(echo $t|awk '{print $1}')
min=$(echo $t|awk '{print $2}')
next=$(echo $t|awk '{print $3}')
file=$(echo $t|awk '{print $4}')

if [ $v -le $max -a $v -gt $min ]
then
  SLEEP_VAL=$next
  ALERT_FILE=$file
  break;
fi
  done

  [ ! -z $ALERT_FILE ]  [ $(cat $BAT_PLUGGED) != 1 ]  aplay ${BAT_ALERT}${ALERT_FILE}.wav
  sleep $SLEEP_VAL
done

-- 
PR: Le serveur (de news) de PacWan est en panne depuis le mois de juillet !
AT: A mon avis ils vont finir par s'en apercevoir, mais il risque de manquer
des articles.
-+- in: Guide du Cabaliste Usenet - La Cabale se propage (mal) -+-
___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: Acustic 'empty battery warning' ?

2008-12-19 Thread Petr Vanek
With an FSO based system you could do this easily with help of oevents.
In the file /etc/freesmartphone/oevents/rules.yaml exists two entries
for actions to be taken when the battery is nearly empty. You could
easily edit these entries and do LED actions or play some sound files.
The relevant entries are these:

while: PowerStatus()
filters: HasAttr(status, critical)
actions: SetLed(gta02_power_orange, blink)

trigger: PowerStatus()
filters: HasAttr(status, empty)
actions: Command('poweroff')


Where could i learn more about actions? I can imagine i could disable
suspend/blackout by it while PowerStatus would be charging.

Thank you

Petr



___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: Acustic 'empty battery warning' ?

2008-12-19 Thread Fox Mulder
Petr Vanek wrote:
 With an FSO based system you could do this easily with help of oevents.
 In the file /etc/freesmartphone/oevents/rules.yaml exists two entries
 for actions to be taken when the battery is nearly empty. You could
 easily edit these entries and do LED actions or play some sound files.
 The relevant entries are these:

while: PowerStatus()
filters: HasAttr(status, critical)
actions: SetLed(gta02_power_orange, blink)

trigger: PowerStatus()
filters: HasAttr(status, empty)
actions: Command('poweroff')
 
 
 Where could i learn more about actions? I can imagine i could disable
 suspend/blackout by it while PowerStatus would be charging.

Good question.
I also don't know where to get all possible Attributes and Actions. At
the moment my modifications are based on intuition and tryerror. But i
would appreciate if anyone knows an url with all the needed information
what is possible. :)

Ciao,
 Rainer

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: Acustic 'empty battery warning' ?

2008-12-18 Thread Michael 'Mickey' Lauer
Depending on your distribution, that should be a one-liner in the rules.
See how we blink the red power led on critical status and add an
AudioActoin there.

:M:


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: Acustic 'empty battery warning' ?

2008-12-17 Thread Lothar Behrens

Hmm,

using the clock to wake me up in the morning would be an option to  
check the

battery.

It even wakes up, or boots, if I have shut down the phone :-)

If the clock is not at a really alarm time (to wake me up :-),
it could configure the next wakeup to check the battery.

Is that a solution if PMU doesn't support us with another solution ?

Lothar

Am 17.12.2008 um 13:35 schrieb William Kenworthy:


Doesnt it already do that - I know that in the middle of the night I
used to get regularly awakened by a sht sound from the Fr as the
battery ran out - oh wait, you mean before ...

:)

Its actually a good idea - I use a couple of perl scripts to flash the
leds in various colours/rates to indicate charge.  Doesnt help when  
shut

down though.  Perhaps a cron job to wake every hour and check the
charge, then go back to sleep?  Does cron work on the FR these days?

BillK


On Wed, 2008-12-17 at 14:16 +0200, Timo Juhani Lindfors wrote:

Lothar Behrens lothar.behr...@lollisoft.de writes:

Is there a way to do this ?


while true; do
 if [ `capacity` -lt 10 ]; then
 alert
 fi
 sleep 120
done

Is there also a way when the device is in suspend mode, to wakeup  
and

do this warning ?


I'm guessing yes but I do not know the PMU stuff well.


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community

--
William Kenworthy bi...@iinet.net.au
Home in Perth!


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community



-- | Rapid Prototyping | XSLT Codegeneration | http://www.lollisoft.de
Lothar Behrens
Heinrich-Scheufelen-Platz 2
73252 Lenningen








___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: Acustic 'empty battery warning' ?

2008-12-17 Thread William Kenworthy
Doesnt it already do that - I know that in the middle of the night I
used to get regularly awakened by a sht sound from the Fr as the
battery ran out - oh wait, you mean before ...

:)

Its actually a good idea - I use a couple of perl scripts to flash the
leds in various colours/rates to indicate charge.  Doesnt help when shut
down though.  Perhaps a cron job to wake every hour and check the
charge, then go back to sleep?  Does cron work on the FR these days?

BillK


On Wed, 2008-12-17 at 14:16 +0200, Timo Juhani Lindfors wrote:
 Lothar Behrens lothar.behr...@lollisoft.de writes:
  Is there a way to do this ?
 
 while true; do
   if [ `capacity` -lt 10 ]; then
   alert
   fi
   sleep 120
 done
 
  Is there also a way when the device is in suspend mode, to wakeup and
  do this warning ?
 
 I'm guessing yes but I do not know the PMU stuff well.
 
 
 ___
 Openmoko community mailing list
 community@lists.openmoko.org
 http://lists.openmoko.org/mailman/listinfo/community
-- 
William Kenworthy bi...@iinet.net.au
Home in Perth!


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: Acustic 'empty battery warning' ?

2008-12-17 Thread leonardo
Timo Juhani Lindfors ha scritto:
 Lothar Behrens lothar.behr...@lollisoft.de writes:
 Is there a way to do this ?
 
 while true; do
   if [ `capacity` -lt 10 ]; then
   alert
   fi
   sleep 120
 done
 

It has passed quite a long time since I upgraded the bootloader, does
the FR boots when the battery is totally down?
I'had seen this thread that seemed to have addressed this issue:
http://lists.openmoko.org/pipermail/devel/2008-October/002531.html

ciao,
leonardo.


-- 
http://leonardo.lilik.it
Key fingerprint = 2C20 A587 05AC 42E5 1292  D0D4 3EED CFB5 52FD AD1E

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: Acustic 'empty battery warning' ?

2008-12-17 Thread Lothar Behrens


Am 17.12.2008 um 13:16 schrieb Timo Juhani Lindfors:


Lothar Behrens lothar.behr...@lollisoft.de writes:

Is there a way to do this ?


while true; do
 if [ `capacity` -lt 10 ]; then
 alert
 fi
 sleep 120
done



this is a starting point :-)


Is there also a way when the device is in suspend mode, to wakeup and
do this warning ?


I'm guessing yes but I do not know the PMU stuff well.


Is there any documentation for PMU ?





___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community



-- | Rapid Prototyping | XSLT Codegeneration | http://www.lollisoft.de
Lothar Behrens
Heinrich-Scheufelen-Platz 2
73252 Lenningen








___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: Acustic 'empty battery warning' ?

2008-12-17 Thread Neil Jerram
2008/12/17 Lothar Behrens lothar.behr...@lollisoft.de:
 Hi,
 I am asking me if it is not possible to get an acustic 'empty battery'
 warning some time before my phone really get's down.
 Is there a way to do this ?

Qtopia 4.3.2 on FR does it, so I guess there must be a way.

   Neil

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: Acustic 'empty battery warning' ?

2008-12-17 Thread Timo Juhani Lindfors
Lothar Behrens lothar.behr...@lollisoft.de writes:
 Is there a way to do this ?

while true; do
  if [ `capacity` -lt 10 ]; then
  alert
  fi
  sleep 120
done

 Is there also a way when the device is in suspend mode, to wakeup and
 do this warning ?

I'm guessing yes but I do not know the PMU stuff well.


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Acustic 'empty battery warning' ?

2008-12-17 Thread Lothar Behrens

Hi,

I am asking me if it is not possible to get an acustic 'empty battery'  
warning some time before my phone really get's down.


Is there a way to do this ?

Is there also a way when the device is in suspend mode, to wakeup and  
do this warning ?


Hope there is a solution. Other mobile phones do this :-)

Thanks

Lothar

-- | Rapid Prototyping | XSLT Codegeneration | http://www.lollisoft.de
Lothar Behrens
Heinrich-Scheufelen-Platz 2
73252 Lenningen








___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: Acustic 'empty battery warning' ?

2008-12-17 Thread Timo Juhani Lindfors
Lothar Behrens lothar.behr...@lollisoft.de writes:
 Is that a solution if PMU doesn't support us with another solution ?

Sure, make the phone wake up every 2 hours to check battery level.


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: Acustic 'empty battery warning' ?

2008-12-17 Thread Fox Mulder
With an FSO based system you could do this easily with help of oevents.
In the file /etc/freesmartphone/oevents/rules.yaml exists two entries
for actions to be taken when the battery is nearly empty. You could
easily edit these entries and do LED actions or play some sound files.
The relevant entries are these:

while: PowerStatus()
filters: HasAttr(status, critical)
actions: SetLed(gta02_power_orange, blink)

trigger: PowerStatus()
filters: HasAttr(status, empty)
actions: Command('poweroff')

You can add your own actions as described at the beginning of this file.
For example the following line look good for your scenario:

# - PlaySound(file) : Action that starts to play an audio file

I already edited this file to start the red AUX LED blinking when on
battery to see if my freerunner is in standby or just the screen is
blanked. And i also edited the maximum brightness to be 60 and not 90 in
this file to save some energy (bright enough to still see everything
good). So you can do really nice things with help of the oevents rules. :)

Ciao,
 Rainer

Lothar Behrens wrote:
 Hi,
 
 I am asking me if it is not possible to get an acustic 'empty battery'
 warning some time before my phone really get's down.
 
 Is there a way to do this ?
 
 Is there also a way when the device is in suspend mode, to wakeup and do
 this warning ? 
 
 Hope there is a solution. Other mobile phones do this :-)
 
 Thanks
 
 Lothar
 
 -- | Rapid Prototyping | XSLT Codegeneration | http://www.lollisoft.de
 http://www.lollisoft.de
 Lothar Behrens
 Heinrich-Scheufelen-Platz 2
 73252 Lenningen
 
 
 
 
 
 
 
 
 
 
 
 ___
 Openmoko community mailing list
 community@lists.openmoko.org
 http://lists.openmoko.org/mailman/listinfo/community

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: Acustic 'empty battery warning' ?

2008-12-17 Thread W.Kenworthy
What distro? - clock doesnt work on 2008.9 through to the current
testing.

BillK


On Wed, 2008-12-17 at 14:12 +0100, Lothar Behrens wrote:
 Hmm,
 
 
 using the clock to wake me up in the morning would be an option to
 check the
 battery.
 
 
 It even wakes up, or boots, if I have shut down the phone :-)
 
 
 If the clock is not at a really alarm time (to wake me up :-), 
 it could configure the next wakeup to check the battery.
 
 
 Is that a solution if PMU doesn't support us with another solution ?
 
 
 Lothar
 
 
 Am 17.12.2008 um 13:35 schrieb William Kenworthy:
 
  Doesnt it already do that - I know that in the middle of the night I
  used to get regularly awakened by a sht sound from the Fr as
  the
  battery ran out - oh wait, you mean before ...
  
  :)
  
  Its actually a good idea - I use a couple of perl scripts to flash
  the
  leds in various colours/rates to indicate charge.  Doesnt help when
  shut
  down though.  Perhaps a cron job to wake every hour and check the
  charge, then go back to sleep?  Does cron work on the FR these days?
  
  BillK
  
  
  On Wed, 2008-12-17 at 14:16 +0200, Timo Juhani Lindfors wrote:
   Lothar Behrens lothar.behr...@lollisoft.de writes:
Is there a way to do this ?
   
   while true; do
if [ `capacity` -lt 10 ]; then
alert
fi
sleep 120
   done
   
Is there also a way when the device is in suspend mode, to
wakeup and
do this warning ?
   
   I'm guessing yes but I do not know the PMU stuff well.
   
   
   ___
   Openmoko community mailing list
   community@lists.openmoko.org
   http://lists.openmoko.org/mailman/listinfo/community
  -- 
  William Kenworthy bi...@iinet.net.au
  Home in Perth!
  
  
  ___
  Openmoko community mailing list
  community@lists.openmoko.org
  http://lists.openmoko.org/mailman/listinfo/community
  
 
 -- | Rapid Prototyping | XSLT Codegeneration | http://www.lollisoft.de
 Lothar Behrens
 Heinrich-Scheufelen-Platz 2
 73252 Lenningen
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 ___
 Openmoko community mailing list
 community@lists.openmoko.org
 http://lists.openmoko.org/mailman/listinfo/community


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: Acustic 'empty battery warning' ?

2008-12-17 Thread Lothar Behrens

It's only an idea. Indeed I currently have ASU 2008/9.

Lothar

Am 18.12.2008 um 01:10 schrieb W.Kenworthy:


What distro? - clock doesnt work on 2008.9 through to the current
testing.

BillK


On Wed, 2008-12-17 at 14:12 +0100, Lothar Behrens wrote:

Hmm,


using the clock to wake me up in the morning would be an option to
check the
battery.


It even wakes up, or boots, if I have shut down the phone :-)


If the clock is not at a really alarm time (to wake me up :-),
it could configure the next wakeup to check the battery.


Is that a solution if PMU doesn't support us with another solution ?


Lothar


Am 17.12.2008 um 13:35 schrieb William Kenworthy:


Doesnt it already do that - I know that in the middle of the night I
used to get regularly awakened by a sht sound from the Fr as
the
battery ran out - oh wait, you mean before ...

:)

Its actually a good idea - I use a couple of perl scripts to flash
the
leds in various colours/rates to indicate charge.  Doesnt help when
shut
down though.  Perhaps a cron job to wake every hour and check the
charge, then go back to sleep?  Does cron work on the FR these days?

BillK


On Wed, 2008-12-17 at 14:16 +0200, Timo Juhani Lindfors wrote:

Lothar Behrens lothar.behr...@lollisoft.de writes:

Is there a way to do this ?


while true; do
if [ `capacity` -lt 10 ]; then
alert
fi
sleep 120
done


Is there also a way when the device is in suspend mode, to
wakeup and
do this warning ?


I'm guessing yes but I do not know the PMU stuff well.


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community
--  
William Kenworthy bi...@iinet.net.au

Home in Perth!


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community



-- | Rapid Prototyping | XSLT Codegeneration | http:// 
www.lollisoft.de

Lothar Behrens
Heinrich-Scheufelen-Platz 2
73252 Lenningen














___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community



___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community



-- | Rapid Prototyping | XSLT Codegeneration | http://www.lollisoft.de
Lothar Behrens
Heinrich-Scheufelen-Platz 2
73252 Lenningen








___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community