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 07-10-2012, 11:54 AM   #1
mmatej
Connoisseur
mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.
 
Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
Small screen printing framework

Hi all!
I've created a small printing framework based on the "eips" utility in the Kindle. It's written as a shell script which you can source and use its functions.
Features:
  • prints on the screen
  • auto new-lineing
  • auto scrolling
  • small formatting utility
  • you can print "-i" on the screen with it! (try it with eips... no good)
Limitations:
This tool is limited by eips, so:
  1. certain characters are replaced by similar ones / totally OT ones
  2. the "\" character is not replaced (stupid shell.. don't know why )
Function list:
  • mp_reset -> resets screen+options
  • print <text> -> prints text with no newline at the end
  • printn <text> -> prints text with newline at the end
  • pcenter <text> -> prints text centered on the line
  • psetpos <x> <y> -> sets cursor position on the screen
  • pback -> moves back one character on the line
  • pbackf -> erases character under cursor and moves back one character on the line
  • pbackline -> if the X cursor position is zero, moves to previous line, else sets x=0
  • pbacklinef -> like pbackline + erases line
  • pscroll <num> [from] -> scrolls num lines (if from is set, skips from lines from the up)
  • pprintf <text> -> prints text with formatting
  • pprintfn <text> -> like pprintf but with the newline at the end
The last two options allow you to print some program output to the screen like this:
Code:
pprintfn "$(ls)"
which prints dir listing to the screen.
Configurables: (enabled means set to 1)
  • mp_h -> if enabled, text is printed out highlighted
  • mp_scroll -> sets num lines to autoscroll;0=erase entire screen
  • mp_scroll_from -> num of lines which won't be erased when scrolling/erasing (from up)
Download:
http://jailbreak-kt.tk/bin/pfw
How to use:
Code:
source /path/to/pfw
# it will init automatically
printn "Hello world!"
This one started as screen printing helper in web jailbreak, but I decided it would be good to refine it and share. Hope my effort was useful!

Last edited by mmatej; 07-10-2012 at 11:57 AM.
mmatej is offline   Reply With Quote
Old 07-10-2012, 12:01 PM   #2
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: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
You can add some more interesting eips wrapper code by sourcing the built-in FUNCTIONS script. That even does centering and other stuff. Also, there is an eips command to scroll the screen (used in some of my published scripts) -- no need to use dd for that...
geekmaster is offline   Reply With Quote
Old 07-10-2012, 12:12 PM   #3
mmatej
Connoisseur
mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.
 
Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
Quote:
Originally Posted by geekmaster View Post
You can add some more interesting eips wrapper code by sourcing the built-in FUNCTIONS script. That even does centering and other stuff. Also, there is an eips command to scroll the screen (used in some of my published scripts) -- no need to use dd for that...
I've found some eips-related things in /etc/upstart/functions, but I don't see centering here. Could you tell me where the functions script is? Also, I was not able to scroll entire screen with eips - it always skips first line.
mmatej is offline   Reply With Quote
Old 07-10-2012, 12:16 PM   #4
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
So put a status bar or menu bar or some such on the first line and don't bother with it.
knc1 is offline   Reply With Quote
Old 07-10-2012, 12:18 PM   #5
mmatej
Connoisseur
mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.
 
Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
Quote:
Originally Posted by knc1 View Post
So put a status bar or menu bar or some such on the first line and don't bother with it.
When I don't want to?
mmatej is offline   Reply With Quote
Old 07-10-2012, 12:47 PM   #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: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Quote:
Originally Posted by mmatej View Post
I've found some eips-related things in /etc/upstart/functions, but I don't see centering here. Could you tell me where the functions script is? Also, I was not able to scroll entire screen with eips - it always skips first line.
Yeah. I used it for a title line and a "user input" line in my tiny eips-based terminal script. Using eips limits you to not using a LOT of characters needed by linux, so the next "terminal" used "dd" to blit character images (the tiny tty "titty" script).

There was an eips replacement program posted awhile back (eprint, I think) that should do more characters. It is in an thread by fbdev, as I recall.

The functions script that did centering was on my K3. There were other useful eink functions too. I did not look closely at it on newer kindles. Perhaps the "good stuff" is missing in the latest firmware.

Last edited by geekmaster; 07-10-2012 at 12:52 PM.
geekmaster is offline   Reply With Quote
Old 07-10-2012, 02:00 PM   #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 mmatej View Post
When I don't want to?
Call the Amazon support desk or write your own replacement.
knc1 is offline   Reply With Quote
Old 07-10-2012, 02:19 PM   #8
mmatej
Connoisseur
mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.
 
Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
Quote:
Originally Posted by knc1 View Post
Call the Amazon support desk or write your own replacement.
Great idea! I cannot think of the reason why this didn't come to my mind. I must be very stupid.
I gave you the max karma I could. You really deserve it.
mmatej is offline   Reply With Quote
Old 07-10-2012, 03:08 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
Quote:
Originally Posted by mmatej View Post
Great idea! I cannot think of the reason why this didn't come to my mind. I must be very stupid.
I gave you the max karma I could. You really deserve it.
knc1 is offline   Reply With Quote
Old 07-10-2012, 06:22 PM   #10
mmatej
Connoisseur
mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.
 
Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
BTW, if someone used this script, post or PM me. If not, at least I know I shouldn't bother with things like this when no one really cares.
mmatej is offline   Reply With Quote
Old 07-10-2012, 06:34 PM   #11
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: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Quote:
Originally Posted by mmatej View Post
BTW, if someone used this script, post or PM me. If not, at least I know I shouldn't bother with things like this when no one really cares.
It takes awhile to get noticed. Even my kindle video took a long time before I got any feedback. Be patient.

EDIT: If nothing else, YOU learned something by creating it, and sharing it will (eventually) help others. Thank you for sharing. I am sure somebody will find a use for it.

Last edited by geekmaster; 07-10-2012 at 06:37 PM.
geekmaster is offline   Reply With Quote
Old 07-11-2012, 02:45 AM   #12
mmatej
Connoisseur
mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.
 
Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
Quote:
Originally Posted by geekmaster View Post
It takes awhile to get noticed. Even my kindle video took a long time before I got any feedback. Be patient.

EDIT: If nothing else, YOU learned something by creating it, and sharing it will (eventually) help others. Thank you for sharing. I am sure somebody will find a use for it.
Oh yes, I don't expect to be noticed immediately. But some responses here are far away from my expectations.
mmatej is offline   Reply With Quote
Old 07-11-2012, 02:50 AM   #13
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,477
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
@mmatej: Welcome to the Internet? Joking aside, it really is appreciated, and I'd suggest to just ignore the grumpy people ;-).
NiLuJe is offline   Reply With Quote
Old 07-11-2012, 03:09 AM   #14
mmatej
Connoisseur
mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.
 
Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
Quote:
Originally Posted by NiLuJe View Post
@mmatej: Welcome to the Internet? Joking aside, it really is appreciated, and I'd suggest to just ignore the grumpy people ;-).
Yeah, let's not allow our party to be stopped!
mmatej is offline   Reply With Quote
Old 07-11-2012, 03:30 AM   #15
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: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Sadly, the best programmers tend to have some degree of OCD, which is often accompanied by mood swings. It gets worse as we get older (i.e. Grumpy Old Men). Just be patient and forgiving with us, because we have a lot to offer...
geekmaster is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Blotchy Kindle screen printing? samonakuba Amazon Kindle 2 08-09-2011 05:51 PM
My images are disappearing on small screen devices sbrwake Kindle Formats 2 01-10-2009 09:01 PM
Subtitute font when rending PDF on small screen caritas PDF 2 06-30-2008 07:41 AM
Subtitute font when rending PDF in small screen caritas Sony Reader 0 06-28-2008 08:09 AM


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


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