Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 10-20-2013, 06:26 AM   #1
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
lipc-daemon usage infos and ideas

Hi there! I'm trying to understand how does lipc-deamon work. If a type lipc-daemon in kterm it says:

lipc-daemon provides a way to execute programs on specified events and a way to run program to publish properties easily

Usage:
lipc-daemon [-e <event-config-file>] [-p <property-confi-file>] [-f]
-f: Do not daemonize


For example you could run: /usr/bin/lipc-daemon -p /etc/lipc-daemon-props.conf -e /etc/lipc-daemon-events.conf, where those files are already present on system (and cointains further infos too). Anyway I don't know what happens if you do :P

I still can't figure out exactly how to use it xD
That's what I would like to do: listen on battery level update events (i.e. when battery loses 1%) and print out somewhere the updated value (my dream would be appening it to current app name in the topbar, even if by now I'm only able to replace it). Do you think is this possibile without consuming resources, maybe using lipc-daemon? I still can't resign myself to not have a battery percentage gauge around the screen ALWAYS xD

Thanks in advance.
Aeris is offline   Reply With Quote
Old 10-20-2013, 07:03 AM   #2
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by Aeris View Post
I still can't resign myself to not have a battery percentage gauge around the screen ALWAYS xD
There are such things as external battery charger packs.

For example, I have one here with 10x the storage capacity of the Kindle's internal battery and the Kindle sees it as an external charger (which it is).

This model has a tiny back lighted screen which shows the remaining storage capacity.

Do not let your Avatar read the following!
Spoiler:

The one in front of me is 'Pretty Pink' that would match your Avatar's outfit.
knc1 is offline   Reply With Quote
Advert
Old 10-20-2013, 07:22 AM   #3
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299993
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
subscribe to an event of your choice.
trigger something to happen when it fires.
twobob is offline   Reply With Quote
Old 10-20-2013, 07:25 AM   #4
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299993
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Quote:
lipc-daemon isn't the daemon that serves all LIPC communication. It's a wrong assumption. LIPC is a thin abstraction on top of D-Bus. And lipc-daemon uses this abstraction and only exposes properties as com.lab126.system publisher. So it's OK that other publishers are still accessible when lipc-daemon is stopped.
Eureka...
twobob is offline   Reply With Quote
Old 10-20-2013, 07:28 AM   #5
icantbebothered
Penguin
icantbebothered ought to be getting tired of karma fortunes by now.icantbebothered ought to be getting tired of karma fortunes by now.icantbebothered ought to be getting tired of karma fortunes by now.icantbebothered ought to be getting tired of karma fortunes by now.icantbebothered ought to be getting tired of karma fortunes by now.icantbebothered ought to be getting tired of karma fortunes by now.icantbebothered ought to be getting tired of karma fortunes by now.icantbebothered ought to be getting tired of karma fortunes by now.icantbebothered ought to be getting tired of karma fortunes by now.icantbebothered ought to be getting tired of karma fortunes by now.icantbebothered ought to be getting tired of karma fortunes by now.
 
icantbebothered's Avatar
 
Posts: 1,017
Karma: 4742434
Join Date: Jul 2012
Device: Kindle Touch 5.3.2.1
On a touch at least this you could get the battery level like this:

Code:
lipc-get-prop com.lab126.powerd battLevel
Doing that every minute or so could be enough to catch all the percentage changes roughly the time they happen.
icantbebothered is offline   Reply With Quote
Advert
Old 10-20-2013, 07:35 AM   #6
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299993
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
she was doing that already. but yeah and only print when value updates...
twobob is offline   Reply With Quote
Old 10-20-2013, 08:33 AM   #7
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
Quote:
Originally Posted by icantbebothered View Post
On a touch at least this you could get the battery level like this:

Code:
lipc-get-prop com.lab126.powerd battLevel
Doing that every minute or so could be enough to catch all the percentage changes roughly the time they happen.
Thanks to twobob I'm trying to listen on system event BattLevelChange, so I will not have to control the value multiple times
Aeris is offline   Reply With Quote
Old 10-20-2013, 02:09 PM   #8
eureka
but forgot what it's like
eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.
 
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
So here is a script to display battery charge as a number (percent) on top of battery icon in top bar (only when not charging and charge is more than 10 percent). It works on KT, but I didn't test it thoroughly, sorry for bugs.

It is a shell script, so copy it to file (for example) script.sh and run it as sh script.sh once after pillow (re)start.
Code:
#!/bin/sh
SCRIPT=`cat << 'JAVASCRIPT' | tr -d '\n' | sed -e 's,",\\\\",g'
(function () {
  var _batteryMeterId = BatteryState.batteryFillDiv,
      _batteryMeterEl = _batteryMeterId && document.getElementById(_batteryMeterId),
      _currentBatteryLevel = nativeBridge.getIntLipcProperty("com.lab126.powerd", "battLevel"),
      _originalResolveLabel = BatteryState.resolveLabel;

  if (!_batteryMeterEl || !_originalResolveLabel) {
    return;
  }

  /* Text should be black to be visible. */      
  _batteryMeterEl.style.color = "black";
  /* Hack style to set vertical alignment of text. */
  _batteryMeterEl.style.lineHeight = "3.9pt";
  /* Add style for smaller font size. */
  _batteryMeterEl.style.fontSize = "5pt";

  if (_currentBatteryLevel) {
    _batteryMeterEl.textContent = _currentBatteryLevel;
  }
      
  BatteryState.resolveLabel = function () {
    var batteryMeterId = BatteryState.batteryFillDiv,
        batteryMeterEl = batteryMeterId && document.getElementById(batteryMeterId);
        
    _originalResolveLabel();
    
    if (batteryMeterEl) {
      batteryMeterEl.textContent = BatteryState.percent;
    }
  };
})();
`

MESSAGE='{
  "pillowId": "default_status_bar",
  "function": "'${SCRIPT}'"
}'

lipc-set-prop -s com.lab126.pillow interrogatePillow "$MESSAGE"
eureka is offline   Reply With Quote
Old 10-20-2013, 02:57 PM   #9
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299993
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
works perfectly on a PW, just so you know.
twobob is offline   Reply With Quote
Old 10-20-2013, 03:49 PM   #10
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
Eureka!!! That's wonderful!!!! Thank you so much, didn't think it was possible to make a so perfect solution! Well done!


Thanks also to Twobob and Niluje for all the help that they gave me today

Now just have to test if when the charge is under 50% the number is still readable

Last edited by Aeris; 10-20-2013 at 04:05 PM.
Aeris is offline   Reply With Quote
Old 10-20-2013, 04:14 PM   #11
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
Btw I can't understand how could you make a such incredible code... do you work for amazon maybe? XD
Aeris is offline   Reply With Quote
Old 10-20-2013, 04:32 PM   #12
eureka
but forgot what it's like
eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.
 
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
Thanks. Number under 50 will certainly be unreadable, as it will be in black font on black background. Fix is possible (as well as displaying number when Kindle is charging or signaling about low charge), but it's tiresome enough to being out of my current fun zone, so I hope someone else will do it (help me! ).

Just look at /usr/share/webkit-1.0/pillow/default_status_bar.html and scripts included in this page.

In my shell script, text between SCRIPT line and last backquote before MESSAGE is plain JavaScript code executing in context of that HTML page. (Don't use line comments, as this code is glued in one big line before passing it to pillow.)
eureka is offline   Reply With Quote
Old 10-20-2013, 04:39 PM   #13
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
Great! Thanks for references I think I will try to make a white number percentage with black background (hiding the battery)
Aeris is offline   Reply With Quote
Old 01-15-2015, 08:36 AM   #14
Case
Junior Member
Case began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Nov 2014
Device: Kindle PW2
Thumbs up

Quote:
Originally Posted by eureka View Post
So here is a script to display battery charge as a number (percent) on top of battery icon in top bar (only when not charging and charge is more than 10 percent).
You Sir are a Wizard! Amazing work.

Case is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
LIPC: how to set a custom event? silver18 Kindle Developer's Corner 20 04-21-2025 10:36 AM
Adding USBNetworking Icon to StatusBar (catch lipc-set-prop event with nativeBridge) MaPePeR Kindle Developer's Corner 0 07-05-2012 02:10 PM
calibre server any way to have as daemon MasterCATZ Calibre 8 05-11-2012 02:00 PM
DR1000 I need 2 infos from dr1000s owners repods iRex 22 06-30-2010 07:09 PM
DR800 I would need 2 more infos about the reader.. repods iRex 24 06-24-2010 05:42 AM


All times are GMT -4. The time now is 03:40 PM.


MobileRead.com is a privately owned, operated and funded community.