03-21-2013, 04:53 PM | #1 |
Junior Member
Posts: 4
Karma: 10
Join Date: Mar 2013
Device: Kindle 4
|
Adjust ONLY right or left margin
Hi,
I'm new to the forum. Recently my Kindle 4th gen developed a crack in the screen in the bottom right hand corner, making it impossible to read. What I'd like to do is increase the right margin, while decreasing the left margin - in essence shift the entirety of the test to the left. Is this possible? I know I can change the horizontal margin for both sides, but that only allows me to make them the same size. Thanks, A |
03-21-2013, 05:42 PM | #2 |
( ͡° ͜ʖ ͡°){ʇ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
|
kindle 4 huh...
I seem to recall Geekmaster had developed a solution that moved the whole thing up or down a bit... for the Kindle 3... perhaps that could be adapted. EDIT: Here... https://www.mobileread.com/forums/sho...d.php?t=158589 and the fixed up build of it by me here... https://www.mobileread.com/forums/sho...8&postcount=13 Would need adapting I guess. that in your skills range? Last edited by twobob; 03-21-2013 at 05:54 PM. |
03-21-2013, 11:08 PM | #3 | |
Junior Member
Posts: 4
Karma: 10
Join Date: Mar 2013
Device: Kindle 4
|
Quote:
Thanks. |
|
03-22-2013, 02:07 AM | #4 |
( ͡° ͜ʖ ͡°){ʇ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
|
well.. that's better than "Level 0"
I did (of course) have a quick look at the code... The good news? there isn't much of it. The bad news? IIRC the framebuffer is a tiny bit different on the 4... and it's in c... and the FB is one of the things I never got my head around yet.... but assuming it works like I THINK it works... it's a collection of of lines of X (width * the bit size) * Y height. That sound right? And I also suck so badly at c it's not funny... The code is below. Happy to hack on it with you. Others may jump in. the actual compilation is the easy part. TCC or simply a premade Toolchain can both do the job. (2007q3 is not a bad choice if you want that option or you could try the 2012.03 also) So.... Here's the code. Spoiler:
so.... Step one I guess would be to throw this on a 4 and see what breaks... OKAY... That was a shock... it just "worked" LOL! Vertically though.. not L -> R Step two... figure out HOW the fb if different Let me go remember how you get that info EDIT: ah yeah [root@kindle root]# cat /sys/class/graphics/fb0/ (presses tab and...) Code:
/sys/class/graphics/fb0/bits_per_pixel /sys/class/graphics/fb0/pan /sys/class/graphics/fb0/blank /sys/class/graphics/fb0/power/ /sys/class/graphics/fb0/console /sys/class/graphics/fb0/rotate /sys/class/graphics/fb0/cursor /sys/class/graphics/fb0/state /sys/class/graphics/fb0/dev /sys/class/graphics/fb0/stride /sys/class/graphics/fb0/device/ /sys/class/graphics/fb0/subsystem/ /sys/class/graphics/fb0/mode /sys/class/graphics/fb0/uevent /sys/class/graphics/fb0/modes /sys/class/graphics/fb0/virtual_size /sys/class/graphics/fb0/name Last edited by twobob; 03-22-2013 at 04:28 PM. Reason: added links to tools |
03-22-2013, 02:14 AM | #5 |
( ͡° ͜ʖ ͡°){ʇ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
|
hmm... okay here are the differences
Unlike K3 and older which default to 4 bits/pixel, the new K4 and Touch use 8 bits/pixel. Where the K3 and earlier 6-inch screen models used 300 bytes/row in 600x800 portrait mode, the K4 uses 600 bytes/row K4 (non-touch): Spoiler:
K3 (Keyboard): Spoiler:
Let me go check that on my 4 and 3. Last edited by twobob; 03-22-2013 at 02:22 AM. |
03-22-2013, 02:21 AM | #6 |
( ͡° ͜ʖ ͡°){ʇ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
|
so...
/sys/class/graphics/fb0/stride gives us our X width (I think...) on the 3 [root@kindle root]# cat /sys/class/graphics/fb0/stride 300 on the 4 [root@kindle root]# cat /sys/class/graphics/fb0/stride 600 So that looks right anyways... I guess at this point we either have to choose to shift everything Left by stepping "so many to the right" and copying them "So many to the left..." and just forget about the bit on the right... or actually "wrap around" values like on an old broken TV... Let's have a look back up at how GM was doing that... Oh! and it's 8 bits per pixel. Now IIRC Hawhill said on the Kindle 4 that the lower 4 bits are just copied into the upper 4 bits... so we need to see if there is any "nibble" switching that we need to fiddle with at some point too... (I think that is what he called it) EDIT. meh no I dont think so... just be careful to step in the correct increments I guess. Last edited by twobob; 03-22-2013 at 03:26 AM. |
03-22-2013, 03:03 AM | #7 |
( ͡° ͜ʖ ͡°){ʇ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
|
Code:
// copy swapped slices back to framebuffer y = height * pct / 100; memcpy(pfb + y * width_bytes, psave, (height - y) * width_bytes); memcpy(pfb, psave + (height - y) * width_bytes, y * width_bytes); So there you go... two lines to figure out what to do with... EDIT: I already did the work and shoved some cherries on top. look below Last edited by twobob; 03-22-2013 at 11:37 AM. |
03-22-2013, 03:33 AM | #8 |
( ͡° ͜ʖ ͡°){ʇ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
|
I guess we could make each line part of a list? but there is no EASY for-each...
http://stackoverflow.com/questions/4...loop-construct but ^-- There is a solution to that. Or we could grab each line of width_bytes? and just mungle the end over the beginning? (If the locations overlap there was some detail about needing memmove rather than memcopy) http://stackoverflow.com/questions/4...cpy-vs-memmove I'm not really awake yet. perhaps something will occur when I am. |
03-22-2013, 04:22 AM | #9 |
eBook Enthusiast
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
It's probably an awful lot easier to use the "Tweak Book" facility in Calibre to increase the width of the right margin.
|
03-22-2013, 04:57 AM | #10 | |
( ͡° ͜ʖ ͡°){ʇ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
|
Quote:
"Tweak Book. Use the calibre feature Tweak Book to explode an unfixed format. Fix any problems in the relevant files with any HyperText Markup Language (HTML) editor. Then in Tweak Book preview the results and subsequently cancel or commit the changes. This method requires knowledge of format structure, HTML, Cascading Style Sheets (CSS), and regular expressions. I am not skilled or knowledgable enough for successful use of Tweak Book." and... http://manual.calibre-ebook.com/cli/calibre-debug.html Cavets: But would need to be applied to each book... and so much less fun. Last edited by twobob; 03-22-2013 at 05:21 AM. |
|
03-22-2013, 06:30 AM | #11 |
( ͡° ͜ʖ ͡°){ʇ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
|
Spoiler:
That should do it... EDIT: I re-factored it to: SETTING ARG1: scroll percent (-100->100) (will go in reverse) 5% default SETTING ARG2: update type (0-2) 0 = no flash (fast, but slight ghosting) 1 = quality (full flash update, cleanest display) <- Default 2 = speed (very fast, black and white only) SETTING ARG4: support debug output SETTING ARG3: 0= X 1=Y (move in that axis) X is Default Now should auto-detect 4 or 8 bits per pixel. Will now ¨just work¨ on a 3 or a 4. Last edited by twobob; 03-29-2013 at 11:22 AM. Reason: updates , logic was wrong |
03-22-2013, 06:52 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
|
[root@kindle root]# waitforkey
104 1 (Left Page Forward) 191 1 (Right Page forward) 193 1 (Left Page Back) 109 1 (Right Page Back) I think I will try to make it so the RIGHT HAND SIDE auto scroll 5% left. Need to figure out what to monitor to do that... EDIT: I came up with this... I'll wrap it in a toggle... while :; do SCROLL=0; usleep 10000; OUTY=$(waitforkey | awk '{print substr($0,0,3)}'); if [ "$OUTY" == "191" ] ; then SCROLL=1; fi ;if [ "$OUTY" == "109" ] ; then SCROLL=1; fi ; if [ "$SCROLL" == "1" ] ; then usleep 50000; echo $SCROLL ; fi ; done Last edited by twobob; 03-22-2013 at 03:41 PM. |
03-22-2013, 08:24 AM | #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
|
okay that works... need to just check why I occasionally get an extra log hit...
EDIT: Meh. That should do it I think. Ill finish up the full script. Create a kual toggle button and publish it. Last edited by twobob; 03-22-2013 at 10:00 AM. |
03-22-2013, 02:39 PM | #14 | |
Junior Member
Posts: 4
Karma: 10
Join Date: Mar 2013
Device: Kindle 4
|
Quote:
I'm very much a newbie here. Is it possible for someone to help walk me through how I would get started with this. I've never jailbroken a kindle or anything like that and I'm at a loss for where to even start. |
|
03-22-2013, 03:42 PM | #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
|
I've finished.
Install KUAL. Toggle button that "just works" on 3 or 4 devices with configurable direction coming up. Future reader: thing is here: https://www.mobileread.com/forums/sho...2&postcount=31 Last edited by twobob; 03-22-2013 at 04:29 PM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Reducing left-margin indent | Siavahda | ePub | 1 | 02-10-2013 12:40 PM |
Extra large left margin? | peartree | Amazon Kindle | 5 | 02-23-2012 12:01 PM |
Classic Any way to change left-right margin spacing? | tanzer21 | Barnes & Noble NOOK | 7 | 02-14-2011 04:38 AM |
left margin again | gigapackiii | Sigil | 3 | 01-27-2011 11:55 AM |
2 cm left margin | jtarnvik | Calibre | 16 | 12-07-2010 03:28 AM |