maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   Blink Notification led on Battery Low (https://talk.maemo.org/showthread.php?t=46363)

Creamy Goodness 2011-02-10 17:46

Re: Blink Notification led on Battery Low
 
oohh very useful app, thanks hawaii. I wanted to laugh at these guys with "low battery scripts" that cause a low battery...

dr_frost_dk 2011-02-10 17:53

Re: Blink Notification led on Battery Low
 
thanks, i added the dbus send to my battery script from my battery test thread, now i can really see when battery is LOW!!! :)
but mine is of course more accurate that relaying on the BME that sometimes goes nuts on my phone since i externally charge my battery while in the phone (again see first posts on the battery thread)
When disabling the battery icon on the desktop area you don't get any warning off low battery so this helps that i blinks to "patternerror" when my battery meter hits the low REAL 5%

hawaii 2011-02-10 19:14

Re: Blink Notification led on Battery Low
 
Ideally, like mentioned before - we could use 'breathing' to show levels of battery. This would also be better useful than advising when the device has such a low battery, that's is almost useless. 5% and you're screwed anyways.

White to a white yellow, then to a white red fading would be fine, trigger only when the device is locked and updated every 30 minutes. Easily achievable with EITHER dbuscron on camped triggers or using fcron on intervals.

figaro 2011-02-11 01:29

Re: Blink Notification led on Battery Low
 
Quote:

Originally Posted by hawaii (Post 941092)
A lot of these small daemons can be translated into scripts that run on dbuscron, it would be a lot easier to manage and might reduce ticks.

Just an observation.

Quote:

Originally Posted by Creamy Goodness (Post 941129)
oohh very useful app, thanks hawaii. I wanted to laugh at these guys with "low battery scripts" that cause a low battery...

oops, uh, yeah you're right
didn't notice it until you said it :D

xxxxts 2011-02-11 06:39

Re: Blink Notification led on Battery Low
 
Quote:

Originally Posted by hawaii (Post 941092)
A lot of these small daemons can be translated into scripts that run on dbuscron, it would be a lot easier to manage and might reduce ticks.

Just an observation.

That's what I wanted to try out in this thread;

http://talk.maemo.org/showthread.php?p=940892

xxxxts 2011-02-11 09:44

Re: Blink Notification led on Battery Low
 
Quote:

Originally Posted by pH5 (Post 941074)
I've implemented the script in Vala and packaged it as Low Battery LED (lowbatled).
If there is no PatternBatteryLow in mce.ini, the package postinst will add it using mceledpattern and restart MCE.

Well after dealing with the script and it not working, I have installed Low Battery LED - and so far it seems to be working perfectly.

A few questions though;

Is this the most efficient way of doing this?
Is this way more efficient than the script (or is it exactly the same)?
Does the daemon only activate when triggered by the low battery or is it always running?

Thanks.

J4ZZ 2011-02-11 10:21

Re: Blink Notification led on Battery Low
 
Quote:

Originally Posted by pH5 (Post 941074)
I've implemented the script in Vala and packaged it as Low Battery LED (lowbatled).
If there is no PatternBatteryLow in mce.ini, the package postinst will add it using mceledpattern and restart MCE.

Besten Dank,

works brilliant. ;)

Greetz,

..::J4ZZ::..

pH5 2011-02-12 18:16

Re: Blink Notification led on Battery Low
 
Quote:

Originally Posted by xxxxts (Post 941856)
Is this the most efficient way of doing this?

No. The most efficient way would be to add this to the libbattery.so module of the mce daemon because this is running anyway. And guess what, mce is now open source!
After downloading the MeeGo mce from http://meego.gitorious.org/meego-middleware/mce and applying the patch below, I ran "make modules/libbattery.so" and put the result into /usr/lib/mce/modules. It seems to work, but I'm still waiting for the next battery_low signal to verify.

Code:

diff --git a/modules/battery.c b/modules/battery.c
index cec3f0d..a1ab114 100644
--- a/modules/battery.c
+++ b/modules/battery.c
@@ -129,7 +129,7 @@ static gboolean battery_ok_dbus_cb(DBusMessage *const msg)
        mce_log(LL_DEBUG,
                "Received battery ok signal");
 
-//        execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_LOW, USE_INDATA);
+        execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_LOW, USE_INDATA);
 
        execute_datapipe(&battery_status_pipe,
                          GINT_TO_POINTER(BATTERY_STATUS_OK),
@@ -156,7 +156,7 @@ static gboolean battery_low_dbus_cb(DBusMessage *const msg)
        mce_log(LL_DEBUG,
                "Received battery low signal");
 
-//        execute_datapipe_output_triggers(&led_pattern_activate_pipe, MCE_LED_PATTERN_BATTERY_LOW, USE_INDATA);
+        execute_datapipe_output_triggers(&led_pattern_activate_pipe, MCE_LED_PATTERN_BATTERY_LOW, USE_INDATA);
 
        execute_datapipe(&battery_status_pipe,
                          GINT_TO_POINTER(BATTERY_STATUS_LOW),
@@ -263,7 +263,7 @@ static gboolean charger_charging_on_dbus_cb(DBusMessage *const msg)
 
        /* In case these are active; there's no harm to call them anyway */
        execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_FULL, USE_INDATA);
-//        execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_LOW, USE_INDATA);
+        execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_LOW, USE_INDATA);
 
        execute_datapipe_output_triggers(&led_pattern_activate_pipe, MCE_LED_PATTERN_BATTERY_CHARGING, USE_INDATA);

Quote:

Originally Posted by xxxxts (Post 941856)
Is this way more efficient than the script (or is it exactly the same)?
Does the daemon only activate when triggered by the low battery or is it always running?

The daemon is sleeping most of the time, it is only woken up by the D-Bus signals. And so is the script. Of course the daemon is way more efficient once the signal comes in, but given the expected frequency of battery_low signals this isn't worth all that much. It occupies less memory though.

xxxxts 2011-02-13 15:25

Re: Blink Notification led on Battery Low
 
Quote:

Originally Posted by pH5 (Post 944233)
No. The most efficient way would be to add this to the libbattery.so module of the mce daemon because this is running anyway. And guess what, mce is now open source!
After downloading the MeeGo mce from http://meego.gitorious.org/meego-middleware/mce and applying the patch below, I ran "make modules/libbattery.so" and put the result into /usr/lib/mce/modules. It seems to work, but I'm still waiting for the next battery_low signal to verify.

Code:

diff --git a/modules/battery.c b/modules/battery.c
index cec3f0d..a1ab114 100644
--- a/modules/battery.c
+++ b/modules/battery.c
@@ -129,7 +129,7 @@ static gboolean battery_ok_dbus_cb(DBusMessage *const msg)
        mce_log(LL_DEBUG,
                "Received battery ok signal");
 
-//        execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_LOW, USE_INDATA);
+        execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_LOW, USE_INDATA);
 
        execute_datapipe(&battery_status_pipe,
                          GINT_TO_POINTER(BATTERY_STATUS_OK),
@@ -156,7 +156,7 @@ static gboolean battery_low_dbus_cb(DBusMessage *const msg)
        mce_log(LL_DEBUG,
                "Received battery low signal");
 
-//        execute_datapipe_output_triggers(&led_pattern_activate_pipe, MCE_LED_PATTERN_BATTERY_LOW, USE_INDATA);
+        execute_datapipe_output_triggers(&led_pattern_activate_pipe, MCE_LED_PATTERN_BATTERY_LOW, USE_INDATA);
 
        execute_datapipe(&battery_status_pipe,
                          GINT_TO_POINTER(BATTERY_STATUS_LOW),
@@ -263,7 +263,7 @@ static gboolean charger_charging_on_dbus_cb(DBusMessage *const msg)
 
        /* In case these are active; there's no harm to call them anyway */
        execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_FULL, USE_INDATA);
-//        execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_LOW, USE_INDATA);
+        execute_datapipe_output_triggers(&led_pattern_deactivate_pipe, MCE_LED_PATTERN_BATTERY_LOW, USE_INDATA);
 
        execute_datapipe_output_triggers(&led_pattern_activate_pipe, MCE_LED_PATTERN_BATTERY_CHARGING, USE_INDATA);


The daemon is sleeping most of the time, it is only woken up by the D-Bus signals. And so is the script. Of course the daemon is way more efficient once the signal comes in, but given the expected frequency of battery_low signals this isn't worth all that much. It occupies less memory though.

I don't quite know what to do with this... a little confused and tired. Could you please put it into laymens terms.

xxxxts 2011-02-15 10:57

Re: Blink Notification led on Battery Low
 
bump on the question?:o


All times are GMT. The time now is 02:29.

vBulletin® Version 3.8.8