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 05-31-2016, 02:38 AM   #1
encol
Evangelist
encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.
 
Posts: 416
Karma: 765432
Join Date: Apr 2016
Location: Italy
Device: Kindle PW3 5.8.5.0.1
Detect page changing

Hello there is any lipc event to detect when the user changes the "page" of a book?

Last edited by encol; 05-31-2016 at 02:45 AM.
encol is offline   Reply With Quote
Old 05-31-2016, 12:39 PM   #2
encol
Evangelist
encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.
 
Posts: 416
Karma: 765432
Join Date: Apr 2016
Location: Italy
Device: Kindle PW3 5.8.5.0.1
None?
As alternative, any way to detect current page/position of the book?
encol is offline   Reply With Quote
Old 05-31-2016, 12:52 PM   #3
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773670
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
There may be such an event (lipc or otherwise, such as a /proc or /sys file), but it would probably be different for different kindle models, and perhaps different firmware versions within a given model (not unknown for lab126 to make such changes in the past).

You might be able to find what you seek in the GPL source code for your firmware version, or in the firmware update*.bin file (root filesystem extracted with Kindletool), or in the de-obfuscated (if required) .jar files within that rootfs.
geekmaster is offline   Reply With Quote
Old 06-02-2016, 02:19 AM   #4
Hanspeter
Connoisseur
Hanspeter doesn't litterHanspeter doesn't litter
 
Posts: 77
Karma: 150
Join Date: Jul 2014
Device: Kindel PW1, Voyager
or you can check /var/log/messages as it is used in the titlebar extension if there is a message for a page turn.
I also used this to trek the password dialogue on the screenserver. But as geekmaster said, that messages can/will change with different firmware versions.

HaPe
Hanspeter is offline   Reply With Quote
Old 06-02-2016, 04:38 AM   #5
encol
Evangelist
encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.
 
Posts: 416
Karma: 765432
Join Date: Apr 2016
Location: Italy
Device: Kindle PW3 5.8.5.0.1
Quote:
Originally Posted by Hanspeter View Post
or you can check /var/log/messages as it is used in the titlebar extension if there is a message for a page turn.
Wow!
I tried geekmaster's suggestions with no luck (even if i'm not sure if i looked everywhere ), but this works!:

This is what i get when i go to the next page:
Code:
160602:101443 cvm[4541]: I ContentPanel:UserActionInfo:PageTurnAction=NextPage:
160602:101443 cvm[4541]: I ReadingTimerController:Information::NextPage,Verdict:Processed,PageStartPos:MobiPosition: 330792,IntervalTime:29047,IntervalWords:80,IntervalWPM:165.24942334836646,ScreenStart:MobiPosition: 330072,ScreenEnd:MobiPosition: 330791,Interval%:0.001501664571158745,TotalTime:29120673,TotalWords:87503,TotalWPM:498.47944109174074,Total%:1.2977535599266443,BookInfoKnownWords:107098,BookInfoKnown%:1.6013863768321634,LogDataReturnCode:80,GlobalWPM:1996.070252681267,GlobalTime:29120673,GlobalWords:227962,CurrentPos:MobiPosition: 330792,EndPos:MobiPosition: 478702,PosLeft:147910,%Left:0.3089168382755293,CurrentPagePosDiff:661,TimeForPage:3.066024350485245,PosPassed:false,NewTimeLeft:2460,OldTimeLeft:6931,NextTOCEntry:null,CurrentPos:MobiPosition: 330792,EndPos:MobiPosition: 478702,PosLeft:147910,%Left:0.3089168382755293,CurrentPagePosDiff:661,TimeForPage:3.066024350485245,PosPassed:false,NewTimeLeft:2460,OldTimeLeft:6931,TimeLeftInBookString:Tempo alla fine del libro: 41 min.,TimeLeftInSectionString:Tempo alla fine del capitolo: 41 min.;
Thanks a lot!
encol is offline   Reply With Quote
Old 06-02-2016, 08:21 AM   #6
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773670
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Quote:
Originally Posted by encol View Post
Wow!
I tried geekmaster's suggestions with no luck (even if i'm not sure if i looked everywhere ), but this works!:
While monitoring /proc and /sys for status changes, I would also look in /var/log/messages (and other places as well). It did not occur to me to explicitly say to look in "other places as well" when I posted. Yes, there can be useful log messages, but as mentioned previously, such things can vary by firmware model, and especially by log level (i.e. ~debugOn), and the 'dmesg' log can even have a log level set where almost NOTHING gets posted there (useful when re-puposing the serial port, which also displays log messages).

I will try to be more explicit in the future, but the reason I mentioned /proc and /sys is that the "next page" 'keypress' or touchscreen event may be found there, and lab126 is fond of putting things you would think belong in userland into their device drivers (such as screensaver management in the eink display driver).

Not only can various log messages be prevented from being logged, but their format can change as well so even if logged, detecting them reliably could be tricky if you want your hack to continue to work across multiple devices and firmware versions, and not suffer "bit-rot" over time.

I prefer the simplest solution whenever possible, but it must also be robust and reliable.

Last edited by geekmaster; 06-02-2016 at 08:24 AM.
geekmaster is offline   Reply With Quote
Old 06-02-2016, 09:10 AM   #7
encol
Evangelist
encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.
 
Posts: 416
Karma: 765432
Join Date: Apr 2016
Location: Italy
Device: Kindle PW3 5.8.5.0.1
Don't worry, geekmaster.
I appreciated your suggestions, and perhaps i missed something in my search.
There was too many things for me to look into, and i wasn't able to deobfuscate completely jar files.
I don't know if there is a simplier/more efficient method, and i'd prefer a lipc event for my code, but Hanspeter's one is the only working method i have found for now
encol is offline   Reply With Quote
Old 06-02-2016, 11:02 AM   #8
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773670
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Anything that works is a great place to start. As long as it works for your needs, no need to make it portable to other devices. Still worth sharing your results though. Keep us posted.

Last edited by geekmaster; 06-02-2016 at 11:52 AM.
geekmaster is offline   Reply With Quote
Old 06-02-2016, 11:28 AM   #9
encol
Evangelist
encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.
 
Posts: 416
Karma: 765432
Join Date: Apr 2016
Location: Italy
Device: Kindle PW3 5.8.5.0.1
I'm working on a improved version of the "show time" extension, in order to call eips only when necessary.
As soon as i have a working version i'll post it

Meanwhile...
What's in your opinion the best way to check the /var/log/messages (better if only the lines added from the last check)?
encol is offline   Reply With Quote
Old 06-02-2016, 11:55 AM   #10
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773670
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Years ago, I tried "inotify" on a kindle, but it was mostly useless. Files changed without detection. Not sure if there is a reliable way other than to see if the logfile timestamp or size has changed, by periodic polling. Though you could try inotify again (but it may require linux kernel support). Others have discussed this issue as well:

How to notice log file changes with Linux standard tools?

In Linux, how do I run a shell script when a file or directory changes

https://en.wikipedia.org/wiki/Inotify

Like I said, inotify did not work for me (but that was years ago), so tools based on inotify are likely to be unreliable too. YMMV

Last edited by geekmaster; 06-02-2016 at 12:00 PM.
geekmaster is offline   Reply With Quote
Old 06-03-2016, 08:46 AM   #11
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,506
Karma: 26047202
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
Using inotify is a bit tricky because of both the USBMS handling and the fuse layer proxy.
You basically have to watch out for unmounts, and re-create your watches when the userstore becomes available again (that takes care of the USBMS issue), and you have to setup your watches on base-us and not us (that takes care of the fuse proxy).

See the <K5 screensavers hack for an example. Which also bundles the required inotifywait tools.

See also the same basic principle on the other side of the fence for another example of how to deal with USBMS, in C this time.

Last edited by NiLuJe; 06-03-2016 at 08:49 AM.
NiLuJe is offline   Reply With Quote
Old 06-05-2016, 03:23 AM   #12
sguerrini97
Enthusiast
sguerrini97 began at the beginning.
 
Posts: 27
Karma: 12
Join Date: Jan 2016
Device: KT2
I used dbus-monitor to detect some lipc events (like going in/out of screensaver, hide/show title bar, ...). Perhaps you can find the page turn event there too.

Code:
dbus-monitor --system
sguerrini97 is offline   Reply With Quote
Old 06-05-2016, 03:53 AM   #13
encol
Evangelist
encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.
 
Posts: 416
Karma: 765432
Join Date: Apr 2016
Location: Italy
Device: Kindle PW3 5.8.5.0.1
Quote:
Originally Posted by sguerrini97 View Post
I used dbus-monitor to detect some lipc events (like going in/out of screensaver, hide/show title bar, ...). Perhaps you can find the page turn event there too.

Code:
dbus-monitor --system
I tried but no events for page changing are raised
However... Nice trick to discover lipc events

Last edited by encol; 06-05-2016 at 04:27 AM.
encol is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PRS-T1 PRS-T1 - Changing page margins prevents 'touch' page turning Berzelius Sony Reader 2 08-24-2012 04:02 AM
Changing default starting page RTO Recipes 1 12-28-2011 10:21 PM
Nook And Kindle Page Changing Question NVash General Discussions 17 11-05-2010 12:55 PM
PRS-900 Changing the home page GatorLMHC Sony Reader 0 07-26-2010 07:30 PM
pdf page changing speed ? bugsbunny14 Sony Reader 15 10-19-2006 05:28 PM


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


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