Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > More E-Book Readers > iRex > iRex Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 08-27-2010, 02:47 PM   #61
Iņigo
Guru
Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.
 
Posts: 730
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, iRex DR800S. K4NT. Kobo Aura, Aura One, Libra 2.
Quote:
Originally Posted by CoolDragon View Post
I don't like the idea of a 4-6 sec timer either, such a waste. It is just an experiment to "guess" how the hardware/firmware/os works with regard to timers and timer's timeout events.
Ah, ok, ok.

Quote:
Originally Posted by CoolDragon View Post
Anyway, I'll say go ahead with a public release with eripc, 1 min, and tt font. Seems to be stable enough on my device (although I have one more toolbar icon and smaller gap between clock and icons :-) ).
My running version is not this either.
I try to publish the most popular options... F.e. I also prefer a smaller gap
I've never been into mainstream...

Quote:
Originally Posted by CoolDragon View Post
By the way, you don't need to pass "button" to statusbar_timeout_clock, g_menu_button is static, just register the function and call it after g_menu_button is assigned.
I know, but I'm a member of IGAGV (International Group Against Global Variables)
In fact, that was the purpose of passing args to callbacks!

EDIT: wow, 5th page!

Last edited by Iņigo; 08-27-2010 at 02:52 PM.
Iņigo is offline   Reply With Quote
Old 08-27-2010, 03:14 PM   #62
Mohammad Reza
Member
Mohammad Reza began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Feb 2010
Device: IREX-DR800SG
Quote:
Originally Posted by Iņigo View Post
Which bitbucket revision are you using?

Btw, which look&feel do you prefer? https://www.mobileread.com/forums/sho...4&postcount=23
Option f) is font with fixed size
I don't know about which bitbucket revision I used ! I just replaced the "popupmenu" with the "popupmenu" in your "Port of some DR1000 features to the DR800" package and reinstalled the whole package.

And I think this one that I am using know is "e". I like it
Mohammad Reza is offline   Reply With Quote
Advert
Old 08-27-2010, 03:18 PM   #63
Iņigo
Guru
Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.
 
Posts: 730
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, iRex DR800S. K4NT. Kobo Aura, Aura One, Libra 2.
Quote:
Originally Posted by Mohammad Reza View Post
I don't know about which bitbucket revision I used ! I just replaced the "popupmenu" with the "popupmenu" in your "Port of some DR1000 features to the DR800" package and reinstalled the whole package.

And I think this one that I am using know is "e". I like it
AH, ok... we were talking about the clock you will enjoy in next version, available only in source code by now.
Iņigo is offline   Reply With Quote
Old 08-27-2010, 05:59 PM   #64
CoolDragon
Addict
CoolDragon doesn't litterCoolDragon doesn't litter
 
Posts: 244
Karma: 124
Join Date: Feb 2010
Device: none
Quote:
Originally Posted by Mackx View Post
Hi Iņigo,

I think it has to do with the idle/suspend behaviour. After 5 seconds of idle behaviour (I.e. no 'busy background' and no windows-events for 5 seconds) a suspend mode is triggered, which stops the cpu-clock (as far as I understand the code/script correctly). I assume that the cpu wakes up from this when a button is pressed, stylus is used, battery is empty, usb is connected, ... These are all 'externally' triggered events that (presumably) trigger an interrupt to wake-up the CPU (i.e. start cpu-clock). The purpose of this all is to limit power consumption. The downside is that the timers like you use them will not fire until an external event occurs.
Can you try to set the timeout to smaller then 5 seconds? That would 'confirm' my ideas on the internal workings of the firmware/hardware.
You already told that the clock is not even updated when you turn-pages, that would contradict with my idea above...

As another experiment you could show mm:ss instead of hh:mm and update every second, 2s, 5s, 10s, 30s to see if you get updates at all.
Hi Mackx,

Where is the code/script related to this analysis?
CoolDragon is offline   Reply With Quote
Old 08-27-2010, 07:35 PM   #65
CoolDragon
Addict
CoolDragon doesn't litterCoolDragon doesn't litter
 
Posts: 244
Karma: 124
Join Date: Feb 2010
Device: none
Does anybody know where is the code that updates the pagebar?

OK, the pagebar is part of UDS.

Last edited by CoolDragon; 08-27-2010 at 08:06 PM.
CoolDragon is offline   Reply With Quote
Advert
Old 08-28-2010, 10:39 AM   #66
Mackx
Guru
Mackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to behold
 
Posts: 999
Karma: 19985
Join Date: Dec 2008
Location: Netherlands
Device: iRex DR1000S
Quote:
Originally Posted by CoolDragon View Post
Hi Mackx,

Where is the code/script related to this analysis?
The behaviour is in: \4.0\iRex\sysd\src\system.c.
103: #define IDLE_TIMEOUT_SEC 5

296: g_idle_time_source = g_timeout_add_seconds(IDLE_TIMEOUT_SEC, on_idle_timeout, NULL);

2324: static gboolean on_idle_timeout(gpointer data)
2361: do_idle();

2653: // call idle script and wait for it to return
2654: gchar *command = g_strdup_printf("idle.sh %d", min_before_standby);
2655: sys_spawn_sync(command);

idle.sh can be found here: \4.0\iRex\sysd\data\idle.sh
Which contains:
10: hwclock -s -u

I assume that this command stops the cpu clock, stalling all processing. It will presumally also trigger a special DRAM refresh mode to preserve the ram-content. Since the cpu stopped, power consumption is very low. An external processor (I assume there is a separate display processor that controls the eInk-screen, pre-processes the wacom layer events and checks the keys.) can get the main cpu out of the low-power mode by triggering an external interrupt on the main cpu.

Note that this is all based on interpreting the code/scripts and some knowledge on consumer electronics hardware.

Hope this helps.
Mackx is offline   Reply With Quote
Old 08-30-2010, 04:48 AM   #67
Gertjan
ex-IRX developer
Gertjan doesn't litterGertjan doesn't litterGertjan doesn't litter
 
Gertjan's Avatar
 
Posts: 158
Karma: 224
Join Date: Oct 2008
Device: Irex DR800S, DR1000S, iLiad
Quote:
Originally Posted by Mackx View Post
10: hwclock -s -u

I assume that this command stops the cpu clock, stalling all processing. It will presumally also trigger a special DRAM refresh mode to preserve the ram-content. Since the cpu stopped, power consumption is very low. An external processor (I assume there is a separate display processor that controls the eInk-screen, pre-processes the wacom layer events and checks the keys.) can get the main cpu out of the low-power mode by triggering an external interrupt on the main cpu.
You're close. The device is put into low power mode after 5 seconds of idle by a call to idle.sh. There is a standby microprocessor in the device which controls power to various components, key input etc (it does not drive the display though). The hwclock-line is called when operation is resumed to sync the Linux clock as it does not get updated while in idle mode.
Gertjan is offline   Reply With Quote
Old 08-30-2010, 08:55 AM   #68
Mackx
Guru
Mackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to behold
 
Posts: 999
Karma: 19985
Join Date: Dec 2008
Location: Netherlands
Device: iRex DR1000S
Thanks for the info Gertjan!
Mackx is offline   Reply With Quote
Old 08-30-2010, 09:52 AM   #69
pthwaite
Fanatic
pthwaite has a complete set of Star Wars action figures.pthwaite has a complete set of Star Wars action figures.pthwaite has a complete set of Star Wars action figures.pthwaite has a complete set of Star Wars action figures.pthwaite has a complete set of Star Wars action figures.
 
pthwaite's Avatar
 
Posts: 597
Karma: 430
Join Date: Aug 2008
Location: Ellesmere Port, UK
Device: DR1000S Sony PRS505 iPad iPhone
Good to here from you again Gertjan. I hope things work out well for you and your colleagues.

Howard
pthwaite is offline   Reply With Quote
Old 08-30-2010, 11:41 AM   #70
CoolDragon
Addict
CoolDragon doesn't litterCoolDragon doesn't litter
 
Posts: 244
Karma: 124
Join Date: Feb 2010
Device: none
Quote:
Originally Posted by Gertjan View Post
You're close. The device is put into low power mode after 5 seconds of idle by a call to idle.sh. There is a standby microprocessor in the device which controls power to various components, key input etc (it does not drive the display though). The hwclock-line is called when operation is resumed to sync the Linux clock as it does not get updated while in idle mode.
Thanks Gertjan, now it makes sense. I was wondering what this "serio" actually means, since it takes an "idle" command:
Code:
SERIO=`find /sys/devices -name "serio*"`
#echo -n "1 0" > $SERIO/rgbled
if [[ "$1" == "" ]]; then
    echo -n "idle 0" > $SERIO/power_mode
else
    echo -n "idle $1" > $SERIO/power_mode
fi
And according to i.MX31L's document, it can enter into different level's power saving mode. I believe you are referring to the "wait" or even "doze" mode when the CPU clock is gated.

So now it is clear that user defined CPU timer is "paused" after this idle mode is activated, and will be "resumed" after this mode is terminated.

Regarding the clock implementation, the only way to make it self-updated is to set its timer in sync with the idle timer (5 sec) so that the idle mode is never enabled. I have tested this on my device and it works this way. However, not going to idle mode will significantly reduce battery time, so it is not worth it.

So setting the clock timeout to be between 5 and 10 is more usable. In this case, the clock timer is likely to be suspended on the idle timer, and times out during the next idle window to update the clock. Currently I am using 7 on my device, and works fine without noticeable battery problem. Of course, if the device is busy (flipping pages in less than 5 seconds, or using the stylus all the time etc etc), there is some overhead to have a 7 seconds timers.

What I don't understand yet is why adding an eripc call in the clock timeout function will SOMETIMES update the clock after about 30 seconds of page turn, which is much longer than the idle timeout.

Another way is to only update the clock on a page turn event. Unfortunately, there is no obvious event that can be used after using DR1000's uds, since the "page counter" in the popupmenu is disabled in document viewer, and the "pagebar" is embedded in the uds. Using dbus-monitor shows some signals being sent when flipbar is flipped left or right for a PDF doc, will have to do more experiments in other cases to identify a usable signal.
CoolDragon is offline   Reply With Quote
Old 08-30-2010, 03:00 PM   #71
bran
Enthusiast
bran began at the beginning.
 
Posts: 42
Karma: 10
Join Date: Aug 2010
Device: IREX DR800S
Quote:
Originally Posted by Gertjan View Post
You're close. The device is put into low power mode after 5 seconds of idle by a call to idle.sh. There is a standby microprocessor in the device which controls power to various components, key input etc (it does not drive the display though). The hwclock-line is called when operation is resumed to sync the Linux clock as it does not get updated while in idle mode.
Gertjan,

Thank you for not abanding us!

Regards Bran
bran is offline   Reply With Quote
Old 08-30-2010, 04:27 PM   #72
dima_tr
Groupie
dima_tr has learned how to read e-booksdima_tr has learned how to read e-booksdima_tr has learned how to read e-booksdima_tr has learned how to read e-booksdima_tr has learned how to read e-booksdima_tr has learned how to read e-booksdima_tr has learned how to read e-books
 
Posts: 175
Karma: 863
Join Date: Oct 2009
Location: Germany, Karlsruhe
Device: Iliad v2, DR800S (inlove)
Came back from short vacation and realized that I've missed all the fun.. Anyways, the new info is interesting, gives a food for understanding the hardware+software design.
dima_tr is offline   Reply With Quote
Old 08-31-2010, 02:15 AM   #73
Mackx
Guru
Mackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to behold
 
Posts: 999
Karma: 19985
Join Date: Dec 2008
Location: Netherlands
Device: iRex DR1000S
Quote:
Originally Posted by CoolDragon View Post
What I don't understand yet is why adding an eripc call in the clock timeout function will SOMETIMES update the clock after about 30 seconds of page turn, which is much longer than the idle timeout.
When the UDS is pre-rendering pages, it can delay idle mode by using the background busy ipc-call ("sysSetBgBusy"). This would allow the clock updates to continue until pre-rendering is finished. I think that is what you are seeing. The extra eripc-call makes sure that the change is 'significant-enough' to trigger a screen-update I guess.
Mackx is offline   Reply With Quote
Old 08-31-2010, 10:11 AM   #74
CoolDragon
Addict
CoolDragon doesn't litterCoolDragon doesn't litter
 
Posts: 244
Karma: 124
Join Date: Feb 2010
Device: none
My clock solution

Quote:
Originally Posted by Mackx View Post
When the UDS is pre-rendering pages, it can delay idle mode by using the background busy ipc-call ("sysSetBgBusy"). This would allow the clock updates to continue until pre-rendering is finished. I think that is what you are seeing. The extra eripc-call makes sure that the change is 'significant-enough' to trigger a screen-update I guess.
Ahhhhh, the pre-rendering...... that makes perfect sense

I don't understand how can the eripc call trigger a screen update if the CPU clock is disabled. Anyway, it doesn't matter now. So here is the solution:

Since it is not worth the battery to update the clock by itself, we will leave the clock timeout to be anyway between 30s-60s. If the device is busy for more than this period, the clock will be updated automatically, and the power overhead should be minimal.

Add this line to the end of /usr/bin/idle.sh:
Code:
dbus-send --print-reply --dest='com.irexnet.popupmenu' /com/irexnet/popupmenu com.irexnet.popupmenu.updatesFinished
So after resume from idle, do a clock sync with hwclock, and update the clock. Any external event will trigger this resume: flipbar click, page turn, menu popup, stylus click....

Of course we need to change the code a little bit:
1. At the beginning of statusbar_update_toolbar() (statusbar.c), call toolbar_timeout_clock()
2. To avoid potential re-entry problem of toolbar_timeout_clock(), though very unlikely, add a semaphore around it.

Code:
static gboolean in_clock = FALSE

static gboolean toolbar_timeout_clock()
{
    if ( in_clock )
       return TRUE;
    in_clock = TRUE;
    ..... //update clock
    in_clock = FALSE;
    return TRUE;
}
This has been working great on my device!
CoolDragon is offline   Reply With Quote
Old 09-01-2010, 12:15 PM   #75
CoolDragon
Addict
CoolDragon doesn't litterCoolDragon doesn't litter
 
Posts: 244
Karma: 124
Join Date: Feb 2010
Device: none
I have attached the binary along with the statusbar.c source code (need to learn Mercurial for submitting changes), you are welcome to test it. Don't forget to change the installation script to also copy idle.sh.dr800+ to /usr/bin/idel.sh. It has been very stable on my device so far.
Attached Files
File Type: zip popupmenu_clock.zip (36.1 KB, 417 views)
CoolDragon is offline   Reply With Quote
Reply

Tags
devel, dr800+, features

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DR800 ANN: DR800+. Port of some DR1000 features to the DR800 Iņigo iRex 274 04-05-2013 02:24 PM
DR800 usbnet (USB networking to make development easier) for DR800 GregorRichards iRex 40 07-20-2011 09:38 PM
DR800 Plugin development for DR800/DR1000 yuri_b iRex Developer's Corner 0 09-18-2010 09:46 AM
DR800 parryl iRex 1 08-06-2010 03:00 PM


All times are GMT -4. The time now is 06:50 AM.


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