albright
2008-02-23, 17:52
There's another thread that shows how to use python
to control the LEDs; this can be easily integrated into
a battery monitor script so that when your battery gets
below a certain level the LEDs start blinking red.
For example, here's my battery monitor script:
#!/bin/sh
X=`battery-status | awk '{print $4}'`
if [ ${#X} -lt 5 ]
then
play-sound /usr/local/kde/share/sounds/KDE_Notify.wav &
kdialog --title "Battery Status" --msgbox ". . . . . . . . . $X . . . . . . . . ." &
python /home/user/blinkenlight &
fi
This runs every 10 minutes via cron (yes, if you look you
can find a cron that runs on the n810).
the python script looks like this (thanks to eber42):
#! /usr/bin/python
import time
import dbus
bus = dbus.SystemBus()
obj = bus.get_object('com.nokia.mce','/com/nokia/mce/request')
iface = dbus.Interface(obj,dbus_interface='com.nokia.mce.r equest')
led_pattern = 'PatternError'
# led on
iface.req_led_pattern_activate(led_pattern)
# wait 5s
time.sleep(5)
# led off
iface.req_led_pattern_deactivate(led_pattern)
Well, it's fun if nothing else ...
to control the LEDs; this can be easily integrated into
a battery monitor script so that when your battery gets
below a certain level the LEDs start blinking red.
For example, here's my battery monitor script:
#!/bin/sh
X=`battery-status | awk '{print $4}'`
if [ ${#X} -lt 5 ]
then
play-sound /usr/local/kde/share/sounds/KDE_Notify.wav &
kdialog --title "Battery Status" --msgbox ". . . . . . . . . $X . . . . . . . . ." &
python /home/user/blinkenlight &
fi
This runs every 10 minutes via cron (yes, if you look you
can find a cron that runs on the n810).
the python script looks like this (thanks to eber42):
#! /usr/bin/python
import time
import dbus
bus = dbus.SystemBus()
obj = bus.get_object('com.nokia.mce','/com/nokia/mce/request')
iface = dbus.Interface(obj,dbus_interface='com.nokia.mce.r equest')
led_pattern = 'PatternError'
# led on
iface.req_led_pattern_activate(led_pattern)
# wait 5s
time.sleep(5)
# led off
iface.req_led_pattern_deactivate(led_pattern)
Well, it's fun if nothing else ...