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

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

Notices

Reply
 
Thread Tools Search this Thread
Old 12-09-2012, 06:43 PM   #811
geekmaster
Всё гениальное просто.
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: 5,066
Karma: 6789001
Join Date: Nov 2011
Location: Щедрость не имеет пределов.
Device: *.*
Quote:
Originally Posted by eureka View Post
BTW, upto 5.1.0 (not including 5.1.0), KT had slightly different screen update structure:ioctl command value for updating also was different, I believe: 0x4040462e (or, at least, it's so in geekmaster's video player).

I don't think there are still owners of pre-5.1.0 devices, so it's just an interesting fact. But if you want to differentiate pre-5.1.0 devices: firmware version could be read from /etc/prettyversion.txt on device.

P.S. Oh, I see this "old" structure is already present in include/mxcfb.h as mxcfb_update_data.
I copied the relevant portions of eink_fb.h (for K3 support) and multiple versions of mxc_fb.h (5.0.x and 5.1.x) into my code. You cannot include all files, because they define DIFFERENT incompatible versions of the SAME ioctl structure name...

By copying parts of both includes and including neither of them, my code was able to support for 5.0.x and 5.1.x ioctl calls (and also K3, and K4 main and diags).

More details can be seen at the "discovering" link provided by eureka above.

I also made my code fall back to an eips call if the ioctl() calls fail, just in case the eink ioctl structures change again in some future firmware version. It adds a little robustness to the program, to postpone bit-rot awhile longer...

Last edited by geekmaster; 12-09-2012 at 06:50 PM.
geekmaster is offline   Reply With Quote
Old 12-09-2012, 09:50 PM   #812
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: 711
Karma: 2290994
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
Quote:
Originally Posted by eureka View Post
ioctl command value for updating also was different, I believe: 0x4040462e (or, at least, it's so in geekmaster's video player).
This value 0x4040462e is perfectly fit to value of macro MXCFB_SEND_UPDATE, defined in include/mxcfb.h. It's not the discovery, but now I know why ioctl value was changed in 5.1.0: just because of changed update structure size.

I suggest to update include/mxcfb.h with the following addition (belonged to public domain):
Code:
// Starting from firmware version 5.1.0, framebuffer update structure
// (actual for Kindle Touch and then Kindle Paperwhite) was changed
// and so appropriate update ioctl value.
#define MXCFB_SEND_UPDATE51 _IOW('F', 0x2E, struct mxcfb_update_data51)
Then just use MXCFB_SEND_UPDATE51 instead of raw value 0x4048462e in function kindlePWeinkUpdate().

(Related macros -- _IOW etc. -- could be found in include/asm-generic/ioctl.h from Kindle kernel source, or online. Two new __u32 members of update structure, i.e. 8 bytes, lead to change of 40 to 48).

UPD: OK, now I understand why you are using raw value -- to avoid dependency on that ioctl.h from kernel source. Still, it would be useful at least add comment about how this raw value was calculated.

Last edited by eureka; 12-09-2012 at 10:11 PM. Reason: add online view of include/asm-generic/ioctl.h
eureka is offline   Reply With Quote
Old 12-10-2012, 03:24 AM   #813
bhaak
Groupie
bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.
 
bhaak's Avatar
 
Posts: 161
Karma: 164959
Join Date: Dec 2011
Device: Palm IIIx, (iPhone|Kindle) Touch
Quote:
Originally Posted by dave2008 View Post
Aha, that makes sense now. I previously thought mxcfb_update_data is for KT, so I was somehow suprised to see kindlePWeinkUpdate works in your KT.

I probably won't support version before 5.1.0 for now, until any pre-5.1.0 user come here and complain ;p
I don't think it makes sense to support pre-5.1.0 KTs. To my knowledge there is no reason not to upgrade to 5.1.0+ and from a coding perspective all 5.1.x firmwares should be practically the same.
bhaak is offline   Reply With Quote
Old 12-10-2012, 06:34 PM   #814
dave2008
Addict
dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.
 
Posts: 230
Karma: 183457
Join Date: Jan 2012
Device: k3G(broken), KDXG, paperwhite
Quote:
Originally Posted by geekmaster View Post
I copied the relevant portions of eink_fb.h (for K3 support) and multiple versions of mxc_fb.h (5.0.x and 5.1.x) into my code. You cannot include all files, because they define DIFFERENT incompatible versions of the SAME ioctl structure name...

By copying parts of both includes and including neither of them, my code was able to support for 5.0.x and 5.1.x ioctl calls (and also K3, and K4 main and diags).
Yes, that's what I did. Actually my code was adapted from your video player. Baiscally, when I want to know how to communicate with kindle in low-level, I will first look for your code and I can always find what I want


Quote:
Originally Posted by eureka View Post
TOK, now I understand why you are using raw value -- to avoid dependency on that ioctl.h from kernel source. Still, it would be useful at least add comment about how this raw value was calculated.
In fact, the reason why I use raw value is I don't know it can be constructed in that way ;P Now I know it, thanks. I tried your patch and it compiles without any error even though ioctl.h is not included (at least I cannot find it in the build environment). That's strange...

But the real problem is the actual size of mxcfb_update_data51 is 0x4c here, not 0x48 (mxcfb_update_data is also 4 bytes larger). I double checked the definition of the structure, it is the same as the one in geekmaster's video player. Any thought?

Quote:
Originally Posted by bhaak View Post
I don't think it makes sense to support pre-5.1.0 KTs. To my knowledge there is no reason not to upgrade to 5.1.0+ and from a coding perspective all 5.1.x firmwares should be practically the same.
thanks, so HUR also only supports 5.1 firmware?

Last edited by dave2008; 12-10-2012 at 06:50 PM.
dave2008 is offline   Reply With Quote
Old 12-10-2012, 07:09 PM   #815
knc1
Embedded Cheerleader
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: 6,347
Karma: 5840124
Join Date: Feb 2012
Device: Too many.
Compiler version and/or flags affecting structure member alignment.
knc1 is offline   Reply With Quote
Old 12-10-2012, 07:23 PM   #816
dave2008
Addict
dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.
 
Posts: 230
Karma: 183457
Join Date: Jan 2012
Device: k3G(broken), KDXG, paperwhite
Quote:
Originally Posted by knc1 View Post
Compiler version and/or flags affecting structure member alignment.
I tried to calculate the size by hand, seems that the miminal size is 0x4c. Could it be Compiler version and/or flags affecting size of the members?
dave2008 is offline   Reply With Quote
Old 12-10-2012, 07:37 PM   #817
knc1
Embedded Cheerleader
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: 6,347
Karma: 5840124
Join Date: Feb 2012
Device: Too many.
Quote:
Originally Posted by dave2008 View Post
I tried to calculate the size by hand, seems that the miminal size is 0x4c. Could it be Compiler version and/or flags affecting size of the members?
Yes.
Read the release notes and bug reports for arm on that compiler version.

(If you built it yourself, you may have to write those notes. )
knc1 is offline   Reply With Quote
Old 12-10-2012, 07:43 PM   #818
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: 711
Karma: 2290994
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
Quote:
Originally Posted by dave2008 View Post
In fact, the reason why I use raw value is I don't know it can be constructed in that way ;P Now I know it, thanks. I tried your patch and it compiles without any error even though ioctl.h is not included (at least I cannot find it in the build environment). That's strange...
There is #include <sys/ioctl.h> in einkfb.c, so host system ioctl.h is used in compilation. Full chain is sys/ioctl.h -> bits/ioctl-types.h -> asm/ioctls.h -> asm-generic/ioctls.h -> linux/ioctl.h -> asm/ioctl.h -> asm-generic/ioctl.h -> _IOW found. Don't know, whether it's OK or bad (to use host system ioctl.h header)...

Quote:
Originally Posted by dave2008 View Post
But the real problem is the actual size of mxcfb_update_data51 is 0x4c here, not 0x48 (mxcfb_update_data is also 4 bytes larger). I double checked the definition of the structure, it is the same as the one in geekmaster's video player. Any thought?
Ha-ha, really size is 0x4c. I didn't even try to calculate real size, just checked that other components are exactly the same.

It means, one 4-byte field is superfluous.

Here is definition of mxcfb_alt_buffer_data from include/linux/mxcfb.h from 5.3.0 kernel source:
Code:
struct mxcfb_alt_buffer_data {
  __u32 phys_addr;
  __u32 width;  /* width of entire buffer */
  __u32 height;  /* height of entire buffer */
  struct mxcfb_rect alt_update_region;  /* region within buffer to update */
};
UPD: I also think that it's better to rename mxcfb_update_data51 to mxcfb_update_data and current mxcfb_update_data to mxcfb_update_data_50x (or to something like this) and add comment to mxcfb_update_data_50x (about it's validity only in 5.0.x firmwares). And add MXCFB_SEND_UPDATE_50X for usage with mxcfb_update_data_data_50x. Reason: KPV doesn't have legacy of supporting 5.0.x and, probably, will never have, so suffix 51 is excessive.

Last edited by eureka; 12-10-2012 at 08:05 PM. Reason: cosmetic fixes
eureka is offline   Reply With Quote
Old 12-10-2012, 08:31 PM   #819
dave2008
Addict
dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.
 
Posts: 230
Karma: 183457
Join Date: Jan 2012
Device: k3G(broken), KDXG, paperwhite
Thanks @eureka and @knc1, the eink module is done

I will handle the touch coordinates now. It's wierd that it generates ranges from 0 to 4095
dave2008 is offline   Reply With Quote
Old 12-10-2012, 09:04 PM   #820
dave2008
Addict
dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.
 
Posts: 230
Karma: 183457
Join Date: Jan 2012
Device: k3G(broken), KDXG, paperwhite
Ok, touch coordinates are handled now. Let me know if it works or not
dave2008 is offline   Reply With Quote
Old 12-10-2012, 11:35 PM   #821
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: 711
Karma: 2290994
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
Quote:
Originally Posted by dave2008 View Post
Ok, touch coordinates are handled now. Let me know if it works or not
Works fine with the small patch:
Code:
diff --git a/frontend/ui/inputevent.lua b/frontend/ui/inputevent.lua
index daa21ec..4c5712d 100644
--- a/frontend/ui/inputevent.lua
+++ b/frontend/ui/inputevent.lua
@@ -272,11 +272,12 @@ function Input:init()
                                        --@TODO handle coordinates properly after
                                        --screen rotate.    (houqp)
                                        if ev.code == ABS_MT_POSITION_X then
-                                               ev.code = math.round(ev.code * (600/4095))
+                                               ev.value = math.round(ev.value * (600/4095))
                                        elseif ev.code == ABS_MT_POSITION_Y then
-                                               ev.code = math.round(ev.code * (800/4095))
+                                               ev.value = math.round(ev.value * (800/4095))
                                        end
                                end
+                               return ev
                        end
                        print("Auto-detected Kindle Touch")
                elseif dev_mod == "Kindle4" then
E Ink module is also works filne on KT now.
eureka is offline   Reply With Quote
Old 12-11-2012, 12:16 AM   #822
dave2008
Addict
dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.dave2008 can program the VCR without an owner's manual.
 
Posts: 230
Karma: 183457
Join Date: Jan 2012
Device: k3G(broken), KDXG, paperwhite
Cant believe I made such a stupid mistake...

Anyway, thanks a lot! Finally full kindle devices support
dave2008 is offline   Reply With Quote
Old 12-11-2012, 01:44 AM   #823
bhaak
Groupie
bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.bhaak can program the VCR without an owner's manual.
 
bhaak's Avatar
 
Posts: 161
Karma: 164959
Join Date: Dec 2011
Device: Palm IIIx, (iPhone|Kindle) Touch
Quote:
Originally Posted by dave2008 View Post
thanks, so HUR also only supports 5.1 firmware?
HUR should also support 5.0.x but just because there were no high level changes in the firmware that would have made it incompatible with the older firmwares.

IIRC not even the GUI launcher extension in Java needed an update. But the GUI launcher itself did as with 5.1.0 the Java obfuscator was used more aggressively again.

If there were issues I would have supported 2 different version only if it were feasible. Sometimes it's just not possible without much work to support different versions and Amazon doesn't make it easier with all the hurdles they've built.

Also, let's face it, the KT was on the market for such a short time that the number of people with 5.0.x firmware is already negligible compared to the KPW numbers and maybe even the KT itself will be too if Amazon doesn't give out a 5.3.x firmware for it (what they easily could do as the hardware is almost identical besides the larger screen and the missing home button).
bhaak is offline   Reply With Quote
Old 12-11-2012, 04:29 AM   #824
thomass
Wizard
thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.
 
Posts: 1,635
Karma: 1915537
Join Date: Mar 2011
Location: Türkiye
Device: Kindle 5.3.7
Quote:
Originally Posted by aranwe View Post
... i don't have working cross-compiling setup and i would really like to try this
see this post
(I also don't know and will try )
thomass is offline   Reply With Quote
Old 12-11-2012, 07:10 AM   #825
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,552
Karma: 6021142
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
lua config error: ./rendertext.lua:30: attempt to index local 'face' (a nil value)

think somehow my fonts it dont like? err or something? - nightly build, but the previous one had same error.
twobob 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
Native KOReader: a document reader for PDF, DJVU, EPUB, FB2, HTML, ... (GPLv3) hawhill Kindle Developer's Corner 506 Today 02:33 PM
Yet another PDF viewer (muPDF based) melihron PocketBook 64 05-28-2014 07:33 AM
Librerator - multi-format e-reader, fork of KPV Kai771 Kindle Developer's Corner 326 04-18-2014 05:59 AM
Text-based PDF to Mobi, etc./Kindle 3 kidblue Calibre 41 07-20-2012 03:19 PM
muPDF on Kindle DX!! DairyKnight Kindle Developer's Corner 8 03-21-2010 03:39 AM


All times are GMT -4. The time now is 08:02 PM.


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