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 04-30-2014, 09:05 AM   #1
bulsa
Enthusiast
bulsa began at the beginning.
 
Posts: 28
Karma: 13
Join Date: Apr 2014
Device: Kindle PW
How to control e-ink refresh?

Hi,

I am playing a little with writing in C for the Kindle PW (using gtk).
It works generally fine, but I cannot find a way to do a full e-ink refresh.

I dug a little in the obfuscated class files for kindlets (KRepaintManager) and I found that it calls setSensitivity in KindleFrameFactory before and after repaint, but there I got stuck. It calls setWindowParameter with some parameter "S", but I have no idea what that does (I was not able to decompile parseWindowParams).

Of course I can just open the frame buffer and do it like I would on my old K3, but surely there has to be a better way?
bulsa is offline   Reply With Quote
Old 05-08-2014, 05:35 PM   #2
bulsa
Enthusiast
bulsa began at the beginning.
 
Posts: 28
Karma: 13
Join Date: Apr 2014
Device: Kindle PW
Is there relly nobody who knows how to do this? Or is it just impossible?
bulsa is offline   Reply With Quote
Advert
Old 05-09-2014, 05:35 AM   #3
hawhill
Wizard
hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.
 
hawhill's Avatar
 
Posts: 1,379
Karma: 2155307
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
No, you didn't descibe enough of what you're doing ("playing a little with writing in C"). I'm also unsure why you're searching in the Java code when you're going the native code route. The interesting parts for you would be in the native libraries for the Java framework, not the Java code.

Opening the framebuffer and doing the proper ioctl() ought to work just fine, though. I'm not sure if there's an API for the X11 layer, though. Anyway, you didn't tell whether you are using that.
hawhill is offline   Reply With Quote
Old 05-09-2014, 07:01 AM   #4
bulsa
Enthusiast
bulsa began at the beginning.
 
Posts: 28
Karma: 13
Join Date: Apr 2014
Device: Kindle PW
Yes I was looking for some way to do it in X11. My problem being that strictly speaking if I do refreshing via ioctl I have a race condition between X drawing and the eink screen rereshing.

As far as the Amazon framework is concerned, I have not dug deep enough to even discover which native methods it calls. Also I think I have already seen the effect of such a race condition in the Amazon reader, where it first does a full refresh and then draws different contents.
bulsa is offline   Reply With Quote
Old 05-09-2014, 08:54 AM   #5
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 bulsa View Post
Also I think I have already seen the effect of such a race condition in the Amazon reader, where it first does a full refresh and then draws different contents.
That is designed-in (on purpose in this case) -
It minimizes "ghosting" and improves contrast on the e-ink screen.

Some models / firmware versions allow user control of this feature.

- - - -

You may want to read up on the lipc and eips controls -
and/or
Read through how other people are doing screen controls -
yeah - I mean read other people's code - it is one of the reasons everyone here publishes their code.(*)

For instance - the posts of twobob - he has done a lot of work with the Kindle display handling in the applications he has ported.

(*) If you are doing an application for the Kindle, people who help you here will be expecting that you will post your code somewhere, with an OpenSource license.
It is rare that anyone will get any help from the members here on building closed source software.
(Well, intentionally that is, the Doukan Project and Lab126 take lessons here - without giving credit.)

Last edited by knc1; 05-09-2014 at 09:24 AM.
knc1 is offline   Reply With Quote
Advert
Old 05-09-2014, 09:42 AM   #6
bulsa
Enthusiast
bulsa began at the beginning.
 
Posts: 28
Karma: 13
Join Date: Apr 2014
Device: Kindle PW
Quote:
Originally Posted by knc1 View Post
You may want to read up on the lipc and eips controls -
I don't see anything there that would help me avoid the problem of the full refresh happening BEFORE the stuff I draw with X lands in the framebuffer.

Quote:
Originally Posted by knc1 View Post
Read through how other people are doing screen controls -
yeah - I mean read other people's code - it is one of the reasons everyone here publishes their code.(*)
I've done a little of that already, however I could use some pointers here...
Specifically I have looked at koreader, which thoroughly ignores X as far as I can see and draws directly to the framebuffer, and at kterm, which does no eink specific repainting at all.

Quote:
Originally Posted by knc1 View Post
For instance - the posts of twobob - he has done a lot of work with the Kindle display handling in the applications he has ported.
If there was a function that lists a users posts here, I would gladly follow your advice ... Am I blind?
bulsa is offline   Reply With Quote
Old 05-09-2014, 09:59 AM   #7
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 bulsa View Post
- - - -
If there was a function that lists a users posts here, I would gladly follow your advice ... Am I blind?
https://www.mobileread.com/forums/sho...d.php?t=237083
knc1 is offline   Reply With Quote
Old 05-09-2014, 01:24 PM   #8
bulsa
Enthusiast
bulsa began at the beginning.
 
Posts: 28
Karma: 13
Join Date: Apr 2014
Device: Kindle PW
So I have read through a lot of stuff... I know now yet another racy way to repaint the screen:
Code:
echo 1> /sys/devices/platform/mxc_epdc_fb/mxc_epdc_update
But still as I have no idea when the X server is writing my stuff to the framebuffer, when should I call this?

Can you point me to any code that a) uses GTK/Qt/etc. for drawing and b) does full eink refreshes without race conditions? I have not seen such code anywhere.

An interesting thing I came across was this einkdamage tool, but I gather nobody really knows what it does, is that correct?
bulsa is offline   Reply With Quote
Old 05-09-2014, 01:40 PM   #9
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
You may want to give up on writing to X11 and use the GTK (or QT) framebuffer driver.

The major challenge is the fact that the e-ink display is meta-stable (I.E: not scanned/refreshed at a fixed rate the way a dynamic display is run).

Last edited by knc1; 05-09-2014 at 01:43 PM.
knc1 is offline   Reply With Quote
Old 05-12-2014, 08:01 AM   #10
hawhill
Wizard
hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.
 
hawhill's Avatar
 
Posts: 1,379
Karma: 2155307
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
And yep, Koreader ignores X11 completely. The reason is mainly historically: There wasn't X11 in the Kindle models up to and including Kindle 4.

In fact, I wouldn't be surprised if there wasn't any X11 protocol based API at all. I think Amazon's tech staff just introduced X11 for convenience (GTK, webkit, window management all readily there). But adding e-ink to the game - I wouldn't be surprised if they'd chosen the dirty way.

On a theoretical level, looking from the application's perspective, it's probably a race condition. But when you look at it from the framebuffer driver's perspective, it isn't. You can refresh, you can repaint pixel-wise - both things will be done atomically. There's no order guaranteed, so there's no "right point in time" specification-wise. In a practical sense, however, there is. We're talking single CPU, so a single threaded application will paint, then sync. X11 is special, and probably a game-changer in this regard.

I think analysis hasn't been done yet for this. If I were to start it, I think I would make the framework use TCP as transport protocol, then dump the traffic using tcpdump and use wireshark to look at it (it has a X11 protocol dissector). Maybe there isn't anything to see, though. So alternatively, I'd attach strace to a client and look for refresh ioctl()s.
hawhill is offline   Reply With Quote
Old 05-12-2014, 08:48 AM   #11
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
Looking at twobob's port of gcalculator (its also in the Kindle Menu package) may help.
(It is a gtk app.)
- - - -

PS: Unless things have changed recently, the QT framebuffer driver has not been maintained for a long time. (The Buildroot project dropped it for that reason.)
knc1 is offline   Reply With Quote
Old 05-16-2014, 05:00 AM   #12
bulsa
Enthusiast
bulsa began at the beginning.
 
Posts: 28
Karma: 13
Join Date: Apr 2014
Device: Kindle PW
Quote:
Originally Posted by hawhill View Post
So alternatively, I'd attach strace to a client and look for refresh ioctl()s.
I've already done that before and was unable to find any process that refreshes via ioctl for the framework, that is what lead me to asking here.

Edit: Concerning gcalculator, I'd love to have a look, but I cannot find the source modifications twobob made anywhere (distributing binary without source notice is technically speaking is a violation of the GPL).

Last edited by bulsa; 05-16-2014 at 07:22 AM.
bulsa is offline   Reply With Quote
Old 05-16-2014, 10:05 AM   #13
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
He mentioned he only changed the glade settings.

Have you checked his public repositories on the various repository sites.
It is not like twobob to fail to post sources.
knc1 is offline   Reply With Quote
Old 05-16-2014, 10:48 AM   #14
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 knc1 View Post
He mentioned he only changed the glade settings.

Have you checked his public repositories on the various repository sites.
It is not like twobob to fail to post sources.
Made a fresh review of the posts - -

There is no mystery to the refresh for GTK apps on the Kindle - that has been built into the GTK build supplied on the Kindle by Amazon.

Just use (link against) the Kindle libraries - -
https://www.mobileread.com/forums/sho...d.php?t=189372
knc1 is offline   Reply With Quote
Old 05-17-2014, 06:39 PM   #15
bulsa
Enthusiast
bulsa began at the beginning.
 
Posts: 28
Karma: 13
Join Date: Apr 2014
Device: Kindle PW
Quote:
Originally Posted by knc1 View Post
There is no mystery to the refresh for GTK apps on the Kindle - that has been built into the GTK build supplied on the Kindle by Amazon.
Do you mean a full (flashing) refresh our just a normal 'update'?
Because the former still is a mystery to me (when not done manually with sysfs/ioctl).
bulsa is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pest Control for Organic Gardening: Natural Methods for Pest and Disease Control joyfuldesigns Self-Promotions by Authors and Publishers 0 08-12-2013 09:12 PM
E-Ink and Epson working on a 300ppi e-ink screen! m-reader News 13 05-18-2011 11:38 AM
At Last: *Front-Lit* E-Ink, Flexible E-Ink and ... E-Ink Watches! NatCh News 1 10-27-2007 10:50 AM
E Ink launches next-gen electronic ink: Vizplex Alexander Turcic News 34 07-17-2007 09:25 AM
the latest generation of E Ink's microencapsulated ink imaging film. Jason News 0 05-09-2007 10:01 AM


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


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