View Single Post
b666m's Avatar
Posts: 1,090 | Thanked: 476 times | Joined on Jan 2010 @ Ingolstadt, Germany
#144
Originally Posted by Spotfist View Post
any ideas on how to get my hands on the raw data?
mhm... using the line from desktop command execution widget for reading the current load in mAh:

Code:
hal-device bme | grep battery.reporting | awk -F. '{print $3}' | sort | awk '$1 == "current" { current = $3}; $1== "design" {print current "/" $3}'
if you want to store it in a file use > (overwrites) or >> (appends).

possible script:
Code:
#!/bin/bash

# creating endless loop
while [ 1 ]; do

  # print date and time
  echo -n $(date) >> /home/user/MyDocs/battery_raw.txt
  # print some text in between
  echo -n " - mAh: " >> /home/user/MyDocs/battery_raw.txt
  # print "current/full-charge"
  echo $(hal-device bme | grep battery.reporting | awk -F. '{print $3}' | sort | awk '$1 == "current" { current = $3}; $1== "design" {print current "/" $3}') >> /home/user/MyDocs/battery_raw.txt

  # sleep some time (in seconds) - for example 5 minutes
  sleep 300

done
this should make a file called battery_raw.txt (extension txt just for easy use in windows ^^) which you can copy over to your pc when the phone is connected via usb. (:

the battery_raw.txt file should look something like:
Code:
Thu Mar 4 00:24:06 CET 2010 - mAh: 1022/1265
Thu Mar 4 00:24:11 CET 2010 - mAh: 1022/1265
Thu Mar 4 00:24:16 CET 2010 - mAh: 1022/1265
Thu Mar 4 00:24:21 CET 2010 - mAh: 1022/1265
for test/preview purposes i changed the sleep time to 5 seconds ^^
(and yep... you could write all commands in one line... but i wanted to comment what the commands are doing *g*)

copy the battery_raw.sh over to your phone - for example in the documents-folder.
then you can open xterm and run it via
Code:
sh MyDocs/.documents/battery_raw.sh
minimize it and it will make one line every 5 minutes
(of course you can change the sleep time *g*)

edit: attached the file ^^
Attached Files
File Type: zip battery_raw.sh.zip (421 Bytes, 88 views)

Last edited by b666m; 2010-03-03 at 23:37.
 

The Following User Says Thank You to b666m For This Useful Post: