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 11-22-2006, 02:57 PM   #1
design256
Connoisseur
design256 doesn't litterdesign256 doesn't litter
 
Posts: 78
Karma: 103
Join Date: Aug 2006
Location: Ipswich, UK
Device: Irex Iliad
Watchdog - automatically shut down your Iliad

Hi everyone,

Watchdog is my first attempt to write a useful utility for the Iliad.

It runs as a daemon, and if the Iliad has been idle for more than a certain amount of time (default 30 minutes), it shuts it down, thus saving batteries.

Version 0.1 is for those who can run it from the command line. If we're happy that it's working, then I'll ask Yokos if he can work his packaging magic with it.

Usage

watchdog [idle_time]

Watches the Iliad and will shutdown the Iliad if it has been idle for more than idle_time minutes (minimum 5). Will default to 30 minutes if you don't specify a time


stopwatchdog

Will stop a running watchdog. May take up to 2 minutes before watchdog quits (as it spends most of its time asleep).


How it works

I noticed that the syslog file is written to each time the screen is updated with an eink marker. Watchdog forks into the background then wakes up every minute and tails this file. If it doesn't find any eink markers within the specified period then it shuts the machine down.

Stopwatchdog simply sends it a quit message by way of the syslog file.


Caveats

I'm using /sbin/shutdown which will not perform some of the nice quit stuff you get if you push the power button. Maybe there's an event I can send everything to tell it to save and quit nicely (Ideas Scotty???)


Enjoy!

ps.. Source code is included in the zipfile. It compiles out of the box.
Attached Files
File Type: zip watchdog-0.1.zip (5.2 KB, 288 views)
design256 is offline   Reply With Quote
Old 11-22-2006, 03:18 PM   #2
astfgl
Member
astfgl began at the beginning.
 
Posts: 24
Karma: 10
Join Date: Jun 2006
Location: Townsville, AU
Device: Iliad & REB1100
Just a suggestion, but you could cut your files in half by making watchdog do all the work. "watchdog <timeout>" to run watchdog as a demon, "watchdog 0" to turn it off, and "watchdog shutdown" to shut down the iliad immediately.

Perhaps even "watchdog reboot" and also time delayed operations like "watchdog <shutdown|reboot> <delay>"

Cheers, glen.
astfgl is offline   Reply With Quote
Old 11-23-2006, 04:21 AM   #3
Mambo
Gadget fan
Mambo can teach chickens to fly.Mambo can teach chickens to fly.Mambo can teach chickens to fly.Mambo can teach chickens to fly.Mambo can teach chickens to fly.Mambo can teach chickens to fly.Mambo can teach chickens to fly.Mambo can teach chickens to fly.Mambo can teach chickens to fly.Mambo can teach chickens to fly.Mambo can teach chickens to fly.
 
Posts: 147
Karma: 3968
Join Date: Sep 2006
Location: London
Device: RM Tablet PC, iLiad, PRS 505, iPod Touch
Would be really useful tool. I hope it gets developed further.
Mambo is offline   Reply With Quote
Old 11-23-2006, 04:28 AM   #4
tribble
iLiad Maniac
tribble knows what time it istribble knows what time it istribble knows what time it istribble knows what time it istribble knows what time it istribble knows what time it istribble knows what time it istribble knows what time it istribble knows what time it istribble knows what time it istribble knows what time it is
 
tribble's Avatar
 
Posts: 1,382
Karma: 2369
Join Date: Apr 2006
Location: Germany
Device: Bookeen Opus (i love that thing) and iPad (what an irony)
Yap, i really need one of those

It would be great if we could somehow get it to start automatically.

Maybe the shell script could also put in a script into the startscript folder, that checks on presently inserted external memory for additional startscript in an autorun folder.

I hope Mattijs tells you, how they shut down gracefully, so that reading states are saved.

BTW, if we can get autorun scripts, we could make a script, that checks for the last shutdown time in the logs and check the manifest times for close atime of manifest.xml and then reopen that file
tribble is offline   Reply With Quote
Old 11-23-2006, 04:30 AM   #5
design256
Connoisseur
design256 doesn't litterdesign256 doesn't litter
 
Posts: 78
Karma: 103
Join Date: Aug 2006
Location: Ipswich, UK
Device: Irex Iliad
Quote:
Originally Posted by tribble
Yap, i really need one of those

It would be great if we could somehow get it to start automatically.

Maybe the shell script could also put in a script into the startscript folder, that checks on presently inserted external memory for additional startscript in an autorun folder.

I hope Mattijs tells you, how they shut down gracefully, so that reading states are saved.

BTW, if we can get autorun scripts, we could make a script, that checks for the last shutdown time in the logs and check the manifest times for close atime of manifest.xml and then reopen that file
Got it in one!! This is exactly what I hope to do next. It would be cool to switch on my Iliad and have it resume at the position that I left it.
design256 is offline   Reply With Quote
Old 11-23-2006, 06:43 AM   #6
CommanderROR
eink fanatic
CommanderROR is fluent in JavaScript as well as Klingon.CommanderROR is fluent in JavaScript as well as Klingon.CommanderROR is fluent in JavaScript as well as Klingon.CommanderROR is fluent in JavaScript as well as Klingon.CommanderROR is fluent in JavaScript as well as Klingon.CommanderROR is fluent in JavaScript as well as Klingon.CommanderROR is fluent in JavaScript as well as Klingon.CommanderROR is fluent in JavaScript as well as Klingon.CommanderROR is fluent in JavaScript as well as Klingon.CommanderROR is fluent in JavaScript as well as Klingon.CommanderROR is fluent in JavaScript as well as Klingon.
 
CommanderROR's Avatar
 
Posts: 2,022
Karma: 4924
Join Date: Mar 2006
Location: Germany
Device: STAReBOOK, iRex Iliad, Sony 505, Kindle 2
Yes...that would be the first step in the direction of suspend...:-)
CommanderROR is offline   Reply With Quote
Old 11-23-2006, 06:49 AM   #7
tribble
iLiad Maniac
tribble knows what time it istribble knows what time it istribble knows what time it istribble knows what time it istribble knows what time it istribble knows what time it istribble knows what time it istribble knows what time it istribble knows what time it istribble knows what time it istribble knows what time it is
 
tribble's Avatar
 
Posts: 1,382
Karma: 2369
Join Date: Apr 2006
Location: Germany
Device: Bookeen Opus (i love that thing) and iPad (what an irony)
Quote:
Originally Posted by CommanderROR
Yes...that would be the first step in the direction of suspend...:-)
Well, not close, but alot better, than what we have now.

Does the iRex shutdown script make the open application change the atime of the manifestfile when closing it?
tribble is offline   Reply With Quote
Old 11-23-2006, 06:54 AM   #8
design256
Connoisseur
design256 doesn't litterdesign256 doesn't litter
 
Posts: 78
Karma: 103
Join Date: Aug 2006
Location: Ipswich, UK
Device: Irex Iliad
Quote:
Originally Posted by tribble
Well, not close, but alot better, than what we have now.

Does the iRex shutdown script make the open application change the atime of the manifestfile when closing it?
Yes, it would appear to. So a relaunch is not too difficult - except that there's no easy way to make contentLister do this (see my earlier question about launching apps).
design256 is offline   Reply With Quote
Old 11-23-2006, 07:32 AM   #9
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
If you look you'll see they've been trying to store the last accessed document in /mnt/settings/er_registry.txt...

Technically this isn't "suspend" but it would be useful.

In between rounds of gnashing my teeth over the missing kmod support and getting things like the CD-ROM FS working. I've been exploring power management in the kernel and our good buddy the power switch (and the other buttons).

iRex is providing zero support in this area as they seem to think they have all the kernel work under control and they'd rather have Poppler whacked instead. No pay check, no NDA, no loaner iLiad, no permission to attach my JTAG debugger: no iRex strings == no iRex directives, I work on what I want this way.

I'll take a break and suss out the shutdown logic as I very much down M will drop anything about it. They've got him on an even shorter leash where the hardware internals are concerned.

By the way, if anyone that opened up their iLiad has the raw digital photos they would be useful. iRex has refused to supply any hardware details at all. They seem to feel they can deny the needed knowledge by simply withholding it.

For example, the Philips UCB13XX chip comes in 8 or 9 varieties. It would be helpful to know exactly which version iRex chose and as I mentioned: they refuse to say. This chip likely controls the buttons and is definitely the chip they haven't mastered to turn off the audio. It also runs the Wacom tablet and has support for a microphone. I wish they'd hooked that up...
scotty1024 is offline   Reply With Quote
Old 11-23-2006, 07:34 AM   #10
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
Quote:
Originally Posted by design256
Yes, it would appear to. So a relaunch is not too difficult - except that there's no easy way to make contentLister do this (see my earlier question about launching apps).
You can run ContentLister like a puppet via fakekey.
scotty1024 is offline   Reply With Quote
Old 11-23-2006, 10:07 AM   #11
arivero
Guru
arivero knows what time it isarivero knows what time it isarivero knows what time it isarivero knows what time it isarivero knows what time it isarivero knows what time it isarivero knows what time it isarivero knows what time it isarivero knows what time it isarivero knows what time it isarivero knows what time it is
 
arivero's Avatar
 
Posts: 607
Karma: 2157
Join Date: Oct 2005
Device: NCR3125, Nokia 770,...
Quote:
Originally Posted by scotty1024
If you look you'll see they've been trying to store the last accessed document in /mnt/settings/er_registry.txt...
.
That is not a good idea, if the er_registry.txt fails to save properly during shutdown, the iLiad does not starts anymore. And you store the last accessed document while shutdown.
arivero is offline   Reply With Quote
Old 11-23-2006, 10:10 AM   #12
arivero
Guru
arivero knows what time it isarivero knows what time it isarivero knows what time it isarivero knows what time it isarivero knows what time it isarivero knows what time it isarivero knows what time it isarivero knows what time it isarivero knows what time it isarivero knows what time it isarivero knows what time it is
 
arivero's Avatar
 
Posts: 607
Karma: 2157
Join Date: Oct 2005
Device: NCR3125, Nokia 770,...
http://www.flickr.com/photos/72166458@N00 and http://www.flickr.com/photos/45138438@N00 are the photos, from snoopy and myself. No idea if there are some others around.
arivero is offline   Reply With Quote
Old 11-23-2006, 01:12 PM   #13
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
Quote:
Originally Posted by arivero
That is not a good idea, if the er_registry.txt fails to save properly during shutdown, the iLiad does not starts anymore. And you store the last accessed document while shutdown.
They do a backup of the file when updating it.

But I agree with you, they are putting too much in such a critical file. They should have a volatile file that keeps track of last viewed books for each category as well as The Last Book.
scotty1024 is offline   Reply With Quote
Old 11-23-2006, 01:15 PM   #14
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
Quote:
Originally Posted by arivero
http://www.flickr.com/photos/72166458@N00 and http://www.flickr.com/photos/45138438@N00 are the photos, from snoopy and myself. No idea if there are some others around.
But does anyone have those in the original straight from the camera size?
scotty1024 is offline   Reply With Quote
Old 11-24-2006, 06:14 AM   #15
yokos
Pac-Man catched my iLiad.
yokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with others
 
yokos's Avatar
 
Posts: 720
Karma: 2571
Join Date: Apr 2006
Location: Germany; next to Baltic Sea
Device: 1st gen iRex iLiad with 2nd ed. battery/case
design256, thanks.
I run your watchdog [only 2 iLiad pages src ]with:
Code:
./watchdog 5
And iLiad [2 bars in battery logo or so] shut down in some way last night. After booting iLiad this morning the battery was empty - I got a low battery message after 7 min or so. So iLiad cosumes too much energy after shut down this way [crux mentioned in caveats].
[Edit]: Can anybody verify my observation of energy consumption?
Irex's hasn't answer design256 question on iRex's forum.
[Edit] iRex answered now.

Last edited by yokos; 11-24-2006 at 06:50 AM. Reason: iRex's answer
yokos is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Well, Shut My Mouth Fat Abe News 67 05-02-2010 06:14 PM
v3.0 has me shut down..... lmoore348 Sony Reader 1 09-06-2009 12:18 AM
Automatic shut off? Stacey34 Sony Reader 8 03-14-2009 06:11 AM
Shut-down? scrappnjoyce Sony Reader 9 01-09-2009 11:12 AM


All times are GMT -4. The time now is 12:23 AM.


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