11-25-2011, 02:05 PM | #1 |
Member
Posts: 19
Karma: 5364
Join Date: Nov 2011
Device: not sharing
|
Vertical margins / Change resolution / Letterbox?
Hello, I just bought a cheap Kindle 3 WiFi on ebay. The only problem with it is that a small portion of the upper left corner of the screen is cracked (this is why it was so cheap). Most of the time, this is not an issue, but some ebooks have the first word or two cut off. Rotating the display sideways helps, but I'm not very fond of this orientation.
Is there any way that I can change the vertical margins, change the resolution, or letterbox the output on the e-ink screen? I have installed usbnetwork and I have access to root. I've been rummaging through the init scripts but I don't really understand much of what I see (I'm only accustomed to basic X stuff). Any pointers in the right direction are welcome. |
11-25-2011, 08:09 PM | #2 |
Wizard
Posts: 1,379
Karma: 2155307
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
|
It *might* be that the Java framework, which is responsible for the UI, is fully agnostic to the resolution (but in fact, I'm a bit sceptical about this). If this was the case, you could try to create a modified Linux kernel that offers a framebuffer device with a resolution set to fix your problem. But it would be a hacky mess to get there, admittedly.
As I said, the other part would be the Java framework. You can decompile it, but it has the names mangled. So this is a hacky mess, too. Last option might be ebook settings. Maybe you can use Calibre or another tool to modify the ebooks instead of the device. However, I don't know if the Mobi format allows for individual settings of vertical margins. Maybe some format-guru knows more? |
Advert | |
|
11-25-2011, 09:41 PM | #3 |
Kindle Dissector
Posts: 662
Karma: 475607
Join Date: Jul 2010
Device: Amazon Kindle 3
|
You might want to take a look at /etc/fb.modes Don't know if it does anything, but it looks interesting.
|
11-27-2011, 05:56 AM | #4 |
Connoisseur
Posts: 79
Karma: 2718
Join Date: Aug 2011
Device: Kindle 3G
|
I can't offer any help with margins, but with launchpad there's a way to much more quickly rotate the screen--if you're having to do it a lot, you might as well have a shortcut for it like Shift R. If you've got launchpad installed and set up, just add this to one of your ini files:
Code:
R = !if [ "$(cat /sys/module/eink_fb_hal_broads/parameters/bs_orientation)" == "1" ]; then lipc-send-event -r 3 com.lab126.hal orientationUp & else lipc-send-event -r 3 com.lab126.hal orientationLeft & fi Last edited by ryran; 11-27-2011 at 06:03 AM. |
11-29-2011, 05:02 PM | #5 |
Carpe diem, c'est la vie.
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Or *somebody* could write a quick C program to "scroll" the framebuffer contents down 10% (using memcpy()).
I might do a quick one later today if nobody beats me to it. Or, the "scroller" could "shrink" the framebuffer height a little (resizing the existing contents). I am a little new at Kindle coding -- is the framebuffer always in 4 bpp mode? |
Advert | |
|
11-29-2011, 07:11 PM | #6 |
Wizard
Posts: 1,379
Karma: 2155307
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
|
I've not yet seen it in a different mode. So I'd say this would be a safe bet. However, for scrolling down, you can always rely on finfo.line_length, which will hold the line length in bytes.
Besides that: great idea. Would be simple to implement (but I have to go to sleep now). |
11-29-2011, 07:23 PM | #7 | |
Carpe diem, c'est la vie.
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
I am thinking of using the arrow keys to roll the screen up/down/left/right, so that pixels wrap around the screen edges. This means that no off-screen buffer is needed, and after the hack is installed, even a small portion of working screen could be used to view anything on the screen. I got a broken-screen kindle 3 wi-fi from eBay for free, plus $6 shipping. After I got "Voice Guide" turned on, it is actually somewhat useful even without a screen, but having even a portion of the screen active would be better... It would be tempting to add more features, such as squeezing whitespace (folding multiple white lines between rows of text into a single white line), and maybe add an on-screen magnifier that is easier to use than the magnify-thingy in the web browser. It should be easy to activate while reading, perhaps by pressing Next Page (Right>) and Previous Page (Right<) at the same time, and it should probably remember how far the previous page was rolled and start there for the next page too. Also, I would like to add a GUI shell to launchpad. Not enough time though. One problem with direct mmap to /dev/fb0 is that the framework sometimes overwrites it. Is there a way to pause the framework without a full "framework stop" and "framework start"? And for that matter, is it useful to do a "framework startx" instead of "framework start" to start the framework in running in xorg instead of framebuffer mode? Last edited by geekmaster; 11-29-2011 at 07:44 PM. |
|
11-30-2011, 01:39 AM | #8 |
Carpe diem, c'est la vie.
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Okay, I wrote a program to do the framebuffer scrolling with wraparound. It *was* thoroughly tested and working from a USB ssh command line. It also worked from launchpad (Shift S S), but launchpad wrote status info on the display AFTER it had scrolled.
Then I decided to publish the source code too, so I "cleaned" it. I was very tired when I did that, and I (unwisely) did the code cleanup in the mobileread online comment editor. The code is *simpler* now -- I removed "inotify" code that attempted to detect framebuffer changes but only saw open/close events, and other "dead" test code. Inotify does not see kindle framework activity, but I am tempted to put it back in to detect when launchpad messes up the display so I can clean it (probably running as a daemon). Now that I cleaned the code. it only works from my kindle debian environment (chroot from a loop mounted ext3 image). EDIT: It works in native jailbreak environment too, now that I initialized the unused buffer pointer. The (repaired) source code is below in this message. ----- This program accepts up to two parameters. The first optional parameter is percent of display height to scroll (value 0 to 100, default = 10). The second optional parameter is display update type (value 0 to 2, default = 1). Display update types are: 0 = no flash (fast, but slight ghosting) 1 = quality (full flash update, cleanest display) 2 = speed (very fast, black and white only) 21 = negative (readability aid?) This program can be mapped with various parameters to hotkeys using launchpad, but it scrolls launchpad residue onto the screen. It works much better from the command line. I may need to add my own hotkey processing to this program so the launchpad feed back does not pollute the screen. Does launchpad have a "quiet" parameter for silent operation? It would probably be faster without the visual feedback too. Anyway, 'scroll' works [worked] fine when run from a USB telnet or ssh command line, but needs a better way to launch it. I was thinking perhaps if both the Prev(Right<) and Next(Right>) keys were down, we could do the default scroll. To install this (preliminary) version, copy 'scroll' to the USB Drive (/mnt/us/bin), and copy scroll.ini to the launchpad folder. Here is scroll.ini: Spoiler:
Here is the C source code: Spoiler:
Downloadable archive with executable, source and .ini files: NOTE: the above code has been fixed to set ua.buffer = NULL, which got lost in the cleanup. The .gz file below still contains the old broken code. Last edited by geekmaster; 12-04-2011 at 03:28 PM. |
12-08-2011, 06:49 PM | #9 |
Member
Posts: 19
Karma: 5364
Join Date: Nov 2011
Device: not sharing
|
Geekmaster and the rest of you guys, thanks a lot for the help.
I've cross compiled that C program and it works great when run from root. I wasn't aware one could directly mess with the framebuffer like that. I'll mess around with that API and see if I can translate and rescale things. |
12-08-2011, 07:07 PM | #10 |
Carpe diem, c'est la vie.
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
asdfffdsa: feel free to expand on my code and use it however you wish. Giving me credit is welcome but not required. I do not like software licensing, as you can probably tell from my embedded "disclaimer". Users should exercise responsibility and not expect others to pay for their mistakes. You can use whatever license you feel comfortable with. A lot of people here seem to prefer GPL for some reason. To me, GPL seems a little like clapping your hands in applause after dipping them in cyanoacrylate adhesive.
One useful feature to add would be hotkey monitoring. I was thinking that reposition and/or resize could be done using the last adjusted settings, when the "next page" key is released. That gives time for a PDF (or other ebook format) to render the page and finish updating the framebuffer, controlled by how long the user holds the key. Also, it would be nice to have a continuous adjustment mode using the 5-way pad, using the "fast" mode while pressed, with full flash draw on release. And the ability to move and resize horizontally would be useful too. But most importantly, have fun with it! In another recent thread (here), a new program was provided that also directly reads the framebuffer. What is special about it is that it does OCR to convert the currently selected (underlined) book title back to text. I think this is the beginning of something great. Last edited by geekmaster; 12-08-2011 at 07:25 PM. |
01-02-2013, 07:07 PM | #11 | |
Junior Member
Posts: 2
Karma: 10
Join Date: Jan 2013
Device: Kindle
|
C Program
Quote:
Thanks! |
|
01-04-2013, 06:55 AM | #12 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
Posts: 6,586
Karma: 6299991
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
|
attached below. updated build with new code
Spoiler:
Last edited by twobob; 01-04-2013 at 12:12 PM. |
01-04-2013, 12:08 PM | #13 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
Posts: 6,586
Karma: 6299991
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
|
FROM GM: That binary still has a bug. Read the post.
okay... well this one is with the amended code (above) enjoy EDIT: THE FULL VERSION IS NOW HERE: https://www.mobileread.com/forums/sho...2&postcount=31 Last edited by twobob; 03-29-2013 at 12:25 PM. |
01-06-2013, 01:12 AM | #14 |
Junior Member
Posts: 2
Karma: 10
Join Date: Jan 2013
Device: Kindle
|
|
01-06-2013, 09:06 AM | #15 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
Posts: 6,586
Karma: 6299991
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
|
Welcome. it was Geekies work really. Happy to help splatter it together
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can't seem to change epub margins | Desertway | Calibre | 7 | 01-19-2012 05:28 AM |
change margins | holterzoff | Amazon Kindle | 3 | 05-21-2011 04:42 PM |
Change Margins With Calibre | Jafo | Conversion | 19 | 04-19-2011 09:39 PM |
unwanted table-change (vertical align) by calibre | NASCARaddicted | Calibre | 2 | 01-27-2010 04:35 AM |
PDF scaling gets lost when margins change | dna2z | Sony Reader | 5 | 11-29-2006 11:20 PM |