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 01-27-2013, 05:50 AM   #181
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,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:
Originally Posted by ondasalfa View Post
Thanks twobob. I don't really know how to get the busybox in my kindle dxg
[root@kindle root]# scp /bin/busybox me@192.168.2.201:/home/me/
done...

Quote:
BusyBox v1.7.2 (2011-01-13 18:01:58 PST) multi-call binary
Copyright (C) 1998-2006 *Erik Andersen, Rob Landley, and others.
Licensed under GPLv2. *See source distribution for full notice.

Spoiler:
Usage: busybox [function] [arguments]...
or: [function] [arguments]...

BusyBox is a multi-call binary that combines many common Unix
utilities into a single executable. Most people will create a
link to busybox for each function they wish to use and BusyBox
will act like whatever it was invoked as!

Currently defined functions:
[, [[, addgroup, adduser, adjtimex,
ash, awk, basename, bunzip2,
bzcat, cat, chgrp, chmod, chown,
chpasswd, chroot, clear, cmp,
cp, crond, crontab, cut, date,
dd, delgroup, deluser, df, dirname,
dmesg, du, echo, env, expr,
false, fbset, fdisk, fgrep,
find, freeramdisk, getty, grep,
gunzip, gzip, head, hexdump,
hostname, hwclock, id, ifconfig,
ifdown, ifup, install, ip, kill,
killall, klogd, less, ln, logger,
login, logname, losetup, ls,
makedevs, md5sum, mkdir, mkfifo,
mknod, mktemp, more, mv, nc,
netstat, nice, passwd, pidof,
ping, pipe_progress, pivot_root,
printf, pwd, rdate, readlink,
realpath, renice, reset, rm,
rmdir, route, run-parts, sed,
seq, sh, sleep, sort, start-stop-daemon,
stat, strings, stty, su, sync,
tail, tar, tee, telnet, test,
time, touch, tr, traceroute,
true, tty, udhcpc, uname, uniq,
unzip, uptime, usleep, vi, wc,
wget, which, who, whoami, xargs,
yes, zcat
Tested as working with my original parse script - with one amend by stepk - On a DX

[root@kindle lib]# uname -a
Quote:
Linux kindle 2.6.22.19-lab126 #3 PREEMPT Thu Jan 13 18:13:20 PST 2011 armv6l unknown
(so - just natively here, no extras, on the DX)
[root@kindle root]# ./parse.sh
Quote:
Helper : bin/start_update.sh ¬ /mnt/us/extensions/helper/bin/start_update.sh
Helper : bin/usbnetwork.sh ¬ /mnt/us/extensions/helper/bin/usbnetwork.sh
Helper : bin/ssprevent.sh ¬ /mnt/us/extensions/helper/bin/ssprevent.sh
Helper : bin/ssallow.sh ¬ /mnt/us/extensions/helper/bin/ssallow.sh
Helper : bin/411.sh ¬ /mnt/us/extensions/helper/bin/411.sh 711
Attached Files
File Type: zip busybox-dx.zip (228.6 KB, 374 views)

Last edited by twobob; 01-27-2013 at 09:15 PM.
twobob is offline   Reply With Quote
Old 01-27-2013, 06:14 AM   #182
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,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.. Tha bash I built works fine on the DX... thinking...

With just the single initial stepk adjustment the original parse.sh does run on all devices - Including the DX - as an interim solution...

Since this solution is NOT requiring additional software until the other parsing script supports the 1.7.2 we are forced to go with that for now.

Last edited by twobob; 01-27-2013 at 09:37 AM. Reason: 1.7.2 support confirmed with rubbish twobob script
twobob is offline   Reply With Quote
Advert
Old 01-27-2013, 08:13 AM   #183
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,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:
Originally Posted by ixtab View Post
The idea of this launcher has been to support as many Kindle Firmwares as possible. Practically, that means K3 - KPW, because that's the devices that twobob and I own. I can't say anything about about a DX, or a Kindle 2, or a Kindle 1, simply because I don't own these devices (and I assume that twobob is in the same situation).

Anyway, because the application depends on a few prerequisites: I'm attaching installers (and uninstallers) for those prerequisites for K3 and K4 devices. They have been tested and are proven to work on my personal devices, but I can't guarantee anything. If you experience any problems, please report back.
could we have: (would it work on the dx? I could just repack)

Quote:
-d, --device dx Kindle DX US
-d, --device dxi Kindle DX International
-d, --device dxg Kindle DX Graphite

and maybe all the Touch and PW models too? Does that make sense? Cheers
as well please? I think we can support them

For the 0.2.0 Release I will include what we have for now and continue to point to the touch prerequisites externally.

Last edited by twobob; 01-27-2013 at 10:10 AM.
twobob is offline   Reply With Quote
Old 01-27-2013, 10:56 AM   #184
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,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
0.2.0 Support for older devices.
Paged results
Old parser used again to support older ash
pre-requisite installers for some devices
warnings when pre-requisites are missing
twobob is offline   Reply With Quote
Old 01-27-2013, 11:42 AM   #185
stepk
Groupie
stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.
 
Posts: 165
Karma: 593460
Join Date: Oct 2012
Device: K5 B011 5.3.2.1
Quote:
Originally Posted by twobob View Post
For the 0.2.0 Release I will include what we have for now
makes sense. I'm still working on adapting the newer script, making good progress
stepk is offline   Reply With Quote
Advert
Old 01-27-2013, 11:45 AM   #186
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,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
excellent, I provided the oldest (DX) 1.7.2 ash I had. Perhap Niluje can wade in with something TRULY ancient ^^. That would be cool
twobob is offline   Reply With Quote
Old 01-27-2013, 12:57 PM   #187
stepk
Groupie
stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.
 
Posts: 165
Karma: 593460
Join Date: Oct 2012
Device: K5 B011 5.3.2.1
Quote:
Originally Posted by twobob View Post
excellent, I provided the oldest (DX) 1.7.2 ash I had. Perhap Niluje can wade in with something TRULY ancient ^^. That would be cool
Indeed. The DX ash you posted is the same version of the K3 ash, though the binary files differ.
stepk is offline   Reply With Quote
Old 01-27-2013, 01:15 PM   #188
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,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:
Originally Posted by stepk View Post
Indeed. The DX ash you posted is the same version of the K3 ash, though the binary files differ.
Which is good news for DX owners

The K2i people will have to hold their breathe : D
twobob is offline   Reply With Quote
Old 01-27-2013, 01:23 PM   #189
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,497
Karma: 26047188
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
AFAIR, the DX/K2/K2i firmware is pretty much identical, so it should work there too .
NiLuJe is offline   Reply With Quote
Old 01-27-2013, 01:35 PM   #190
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,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:
Originally Posted by NiLuJe View Post
AFAIR, the DX/K2/K2i firmware is pretty much identical, so it should work there too .
Top job. 1.7.2 is the baseline then. Good to know.
twobob is offline   Reply With Quote
Old 01-27-2013, 01:40 PM   #191
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,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
FIXME:
Looks like only one param (the 1st) is being passed rather than the full list from a script.

Symptoms:
This will make the Prevent Screensaver script not work from HELPER

Resolution:
Feel free to point fingers shell gurus If someone catches it I will push the update.
I'll get round to it when that happens, when I can or it will get "fixed" by the stepk update, whichever comes soonest.

Last edited by twobob; 01-27-2013 at 03:05 PM.
twobob is offline   Reply With Quote
Old 01-27-2013, 06:21 PM   #192
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
On Kpw 5.3.1 -

Grab the Kindle Paperwhite Jailbreak.
Follow readme directions to install.
According to log file - that took 36 seconds.

Grab the Amazon 5.3.1 -> 5.3.3 update.
Follow the Amazon update instructions.
(and expect that update to wipe-out the Kindlet Dev. Keys)

Grab the version-0.2 launcher.
Follow the directions in the readme file.
(Including creating the Kindle:/extensions folder.)

Touch the document "Kindle Launcher"
Launcher reports that the Kindlet (Developer Keys) Jailbreak are not installed.
(The expected result at this point.)

** at which point - we need an intermission of some very fine guitar picking**
Spoiler:

(2-1/2 minutes of Slash doing an Alice Cooper solo.)


Next, grab the Kindlet-Jailbreak : http://ge.tt/3ZRY9XE/v/71
Follow the readme instructions to install.

Bingo - A working launcher with a blank list that matches the empty extensions directory.

Next - try the "Helper" scripts - -
- - - FIXED for Kpw - - - but not tested at this point in the post.

Next - try kTerm https://www.mobileread.com/forums/sho...d.php?t=202794
Grabs 0.4 - Unzip - copy folder under extensions - eject device - tap launcher - tap kTerm - it just works.
Not much can be said against that! (This **IS** Kpw-5.3.3)!

Next - grab Collections Manager (2.3.3) -
Unzip - move the *.azw2 and the *.png to the documents directory - eject - find in home menu - tap - it just works.

Enough for tonight - scroll up - un-spoil Slash - get some good mood music in your ears.

**Next intermission - possibly the greatest keyboard riff ever recorded**
Spoiler:


After a bit of a break, like more than two days . . .

Remove the old version-0.2.0 launcher 'book' from documents and delete it's helper sub-directory under extensions.
Unpack the version-0.2.1 launcher - put in the documents folder.
Unpack the newer (fixed up) helper sub-directory under extensions.
Eject USB storage device.
Like magic, the diagnostic query(ies) now work on the Kpw-5.3.3 (that 711 thing).


Grab the kindle-usbnet-0.7.N.zip package from:
https://www.mobileread.com/forums/sho...d.php?t=186645
Don't believe that title - that thread is also the home of the USBnetwork package, scroll down to the attachments.

un-zip the package to a local directory on your PC.
Read the README_FIRST.txt file. This is a test, you must pass it.
Is there anything mentioned in there about networking administration you don't know? Well, like the author says, then don't use this package.

Place the 'install' package on root of USB storage, eject USB storage, un-plug the cable since you are about to mess with the cable's hardware interface . . . .
Do the usual: home -> menu -> settings -> menu -> update Kindle routine.

When the Kindle completes its update, still with the USB cable dis-connected, try:
Kindle Launcher -> 711 (Network Info.)
** Which now does not work - it worked just prior to this installation! **
There be a bug that needs squashing here (twobob is on it), see:
https://www.mobileread.com/forums/sho...&postcount=246

** Guess we need another intermission here. **
A little traveling music for the thinker:
Spoiler:


Setting up the USBnetwork interface is now described in a new thread:
https://www.mobileread.com/forums/sho...d.php?t=204450

Note: All music in this post is 'twobob approved' listening.

Last edited by knc1; 02-02-2013 at 09:21 AM.
knc1 is offline   Reply With Quote
Old 01-27-2013, 10:15 PM   #193
stepk
Groupie
stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.
 
Posts: 165
Karma: 593460
Join Date: Oct 2012
Device: K5 B011 5.3.2.1
updated parsing script

Updated parsing script, tested on K5 and K3 (supercedes older version in #140).
Get "0208", monolithic. "0127", modular, left attached for historical reasons.

Changelog:

20130208,a,stepk
- fix: prevent null label (Audio recorder and player for KT)
- fix: preserve '$' in labels
- fix: failed when config.xml path included spaces
! change: accept all characters in menu labels
. ':' '|' aren't stripped anymore
. white space runs are still squeezed to one space

Continue
Spoiler:

20130201,a,stepk (silent update)
! test applet: changed PRODUCTNAME to "Kindle Universal Launcher"

20130130,a,stepk
! monolithic KT/PW/K3/DX compatible script (busybox level 1.7.2)
! faster on all platforms
+ allow double quotes in json values, i.e., "params":"-a \"foo bar\""
- fix: did not clear command parameters in multi-entry menus, like Helper menu
- all previous fixes up to unreleased version 20130129,a included

20130129,a,stepk (unreleased: poor performance; branched out of 20130128,a)
. todo: backport: allow double quotes in json values
! monolithic KT/PW/K3/DX compatible script (busybox level 1.7.2)
! performace improved relative to interim monolithic mod (twobob)
- fix: mangled multiword label to single word, sanitize()
- fix: missing group menu name in RoadRunner-formatted menu
- minor fix: test_applet()
- minor tweaks

20130128,a,stepk (unreleased)
. begin: allow double quotes in json values; unfinished
! monolithic KT/PW/K3/DX compatible script (busybox level 1.7.2)
- fix: mangled multiword label to single word, compat-K[35].sh sanitize()
- fix: did not compact adjacent spaces sometimes, compat-K3.sh sanitize()
- fix: missing group menu name in TouchRunner-formatted menu
- minor fix: test_applet()
- minor tweaks
= clean up interim monolithic mod (twobob)
= all previous fixes up to 20130127,b,stepk included

--- KT/PW/K3/DX modular versions below

20130127,b,stepk (unreleased)
- fix: compat-K3.sh sanitize()
- fix: compat-K5.sh sanitize()

20130127,a,stepk
! colorizing is now disabled by default use -c=MAXCOLORS to enable, i.e. -c=2
+ modular compatibility layer for K3 busybox ash! Now aloop runs on K3 too.
K5 module ran roughly 350% faster than K3 module (real time, one sample)
+ option -l | --log
! explicit shebang ash (defensive)
- fix: test applet install loop (defensive)
* minor tweaks and fixes
* tested on K3 and K5 /bin/ash (both running on KT)

--- KT/PW only versions below ---

20130126,b,stepk
- fix: K3 ash compatibility https://www.mobileread.com/forums/sho...&postcount=160

20130125,a,stepk
+ auto fix DOS line endings
+ added $PRODUCTNAME="Unified Kindle Launcher"
+ -c=0 disables color index output
+ if no menu items found install a test applet (411)
- fix: bail out on unknown script option
+ documentation: added README-dev.txt

20130124,a,stepk
+ option -h | --help
+ option --format=debuginfo
+ options --format=twolevel and -c=|--colors=N
+ config.xml and menu.json can reside in different folders
! search extensions by config.xml (was by menu.json)
! extract group (top) menu name from json file (was from config.xml)
- silently reject invalid xml/json files
+ documented parser's limitations (corner cases)
* code factorization

20130122,c,stepk
+ options --sort and --format=touchrunner

20130122,a,stepk
= first version
Attached Files
File Type: zip aloop-20130208a.zip (18.3 KB, 387 views)
File Type: zip aloop-20130127a.zip (19.2 KB, 355 views)
File Type: zip KindleLauncher-20130226.zip (161.1 KB, 386 views)

Last edited by stepk; 03-08-2013 at 03:46 AM. Reason: delete attachment
stepk is offline   Reply With Quote
Old 01-27-2013, 11:27 PM   #194
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,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
Hi. Due to the way they will be called as a resource from inside the kindlet.

Whilst quite frankly brilliant, it would be simpler to provide only a lowest-common-denominator script. The vast %age of startup slowdown is kindlet instantiation and though 350% faster the complications of knitting dynamically loaded scripts outweigh the gains. Also the overhead and delay in processing the creation and destruction of multiple temp files would be a negative.

So. Just a single, lowest common denominator script please. Sorry. I feel really bad saying this... But the way scripts are fired makes this impractical. Script Names are also created dynamically as an extra complication...

Excellent work though by the way. (super script skills)

EDIT: I just stuck one together from what you provided.
nice and clean code by the way.

./parse.sh (lowest performance only version, monolithic script)
Spoiler:
PHP Code:
#!/bin/ash -
# aloop.sh - last update 20130127,a,stepk
# Tested on KT 5.1.2 /bin/busybox ash (it's ash not (ba)sh!), version banner:
#   BusyBox v1.17.1 (2012-07-17 16:29:54 PDT) multi-call binary
# and on K3 /bin/busybox sh running on KT 5.1.2, version banner:
#   BusyBox v1.7.2 (2012-09-01 14:15:22 PDT) multi-call binary.
# UTF-8 support untested.

usage () {
echo "Usage: ${0##*/} [options]
  parse menu files in $EXTENSIONDIR
  system: `uname -rsnm`"
cat << 'EOT'

Options:
 -h | --help
 -c=MAX | --colors=MAX   : max cyclical index when -f=twolevel (default 0=off)
 -f=NAME | -format=NAME   : select output format, NAME is one of:
   default     default format, also when -f isn't specified, sortable
   debuginfo   dump xml_* and json_* variables
   touchrunner compatible with TouchRunner launcher, sortable
   twolevel    default + group name and color index, sortable, see also -c
 -l | --log    : enable logging to stderr
 -s | --sort   : sort output by label
 
Limitations:
. Supports json menus only
. Supports one- or two-level menus only
. A menu entry must not extend across multiple lines. Example of a valid entry:
  {"name": "a label", "priority": 3, "action" : "foo.sh", "params": "p1,p2"}
  with or without a traling comma

EOT
}

set -f # prevent pathname expansion

# dev can adjust these four variables:
PRODUCTNAME="Unified Kindle Launcher"
EXTENSIONDIR=/mnt/us/extensions
SEPARATOR=`printf "\x01"`
COLORMAX=0 # for two_level() when --colors

case " $* " in
  *" -l "* | *" --log "*)
     opt_log=1; 
     alias log='echo >&2'" ${0##*/}: " # enabled
  ;;
  *) alias log='echo >/dev/null ' # disabled
  ;;
esac
log "system `uname -rsnm`"

# knc1's magic with minimal busybox syntax:
# IFS settings used for string parsing and auto-fixing DOS line endings.
# Whitespace == :Space:Tab:Line Feed:Carriage Return:
WSP_IFS=`printf "\x20\x09\x0A\x0D"`
# No Whitespace == :Line Feed:Carriage Return:
NO_WSP=`printf "\x0A\x0D"`
# Whitespace == :Space:Tab:
WSP=`printf "\x20\x09"`
# Quote == :Double Quote:
QUOTE=`printf "\x22"`

SPACE=' '
LT='<'
GT='>'

# usage: script_full_path [-p]
script_full_path () {
  # no need to worry about symlinks are they aren't allowed in /mnt/us
  local pth=$(2>/dev/null cd "${0%/*}" >&2; pwd -P)
  [[ "-p" = "$1" ]] || pth=$pth/${0##*/}
  echo -n "$pth" 
}

# usage: result=`str_replacechars SRC CHARS CHR`
# replace all occurrences of characters of CHARS in SRC with character CHR
str_replacechars () {
  local - IFS src=$1 chars=$2 chr=$3
  set -f
  IFS="$chars"
  set -- $src
  IFS="$chr"
  echo -n "$*"
}

#BBVER=`busybox_version`
#[[ 0 = $? ]] || exit 1
#log running K$BBVER busybox binary
alias sort='/bin/busybox sort' # GNU sort needs setting LC_ALL to work the same
alias find='/bin/busybox find' # why not

# source model-specific compatibility layer. Caveat: ash forgets function
# definitions sourced from within functions, so don't
#load=`script_full_path -p`/compat-K$BBVER.sh
#. "$load"
# NOW SOURCED INLINE...########################################################
#
# compat-K3.sh - SOURCED INLINE - last update 20130127,a,stepk
# Compatibility layer for busybox ash version
#   BusyBox v1.7.2 (2012-09-01 14:15:22 PDT) multi-call binary.
#
# json_var creates sh variable json_NAME from $1
json_var () {
  local IFS=${NO_WSP} x=$*
#echo "json_var_1($#)($x)"
  x=json_${x#?}
  x=`echo -n "$x" | sed "s/${QUOTE}//; s/[${WSP}]\+:/:/; s/:[${WSP}]\+/:/; s/:/=/;"`
#echo "json_var_2 x($x)"
  eval $x
}
#
#
# sanitize and shorten labels, improve readability
sanitize() {
  local r=$*
  r=`echo -n "$r" | sed "s/[\|${SEPARATOR}]//g; s/[:;]/ /g; s/[${WSP}]+/ /;"`
  echo -n "$r"
}
###################################################################################



# json_oline parses $1, a json object consisting of key/value pairs on a single
# line, like {"id":"value",...} 
json_oline () {
  local IFS implode prev s x v line=$1
    unset implode prev s
    line=${line#[\{\[]} # ltrim { and [ - [ isn't valid json but I've seen this typo in helper/menu.json
    until [[ "$s" = "$line" ]]; do
      s=$line
      line=${s%%[${WSP}\}\],]} # rtrim
    done
    # process comma-separated list of key/value pairs
    IFS=,
    for x in $line; do
      x=${x## } # cases '"id":"v"' / '"id":"v1' / 'v2"' (last 2 for "id":"v1,v2")
#echo "X($x)"
      case "$x" in
      ${QUOTE}*)
        [[ "$implode" ]] && json_var $implode && unset implode
        [[ "$prev" ]] && json_var $prev
        prev=$x
#echo "PREV($x)"
      ;;
      *)
        implode=${implode}${implode:+,}$x
#echo "IMP($implode)"
      ;;
      esac
    done
    if [[ "$prev" -a "$implode" ]]; then
#echo "FINPREVIMP($prev,$implode)"
      json_var $prev,$implode
    elif [[ "$implode" ]]; then
#echo "FINIMP($implode)"
      json_var $implode
    elif [[ "$prev" ]]; then
#echo "FINPREV($prev)"
      json_var $prev
    fi
}

# usage: json_parse /path/to/menu.json [PROC]
# stdout: PROC's formatted menu items
# return: # of successful PROC calls
# Note: unset variables json_* before calling json_parse
# For each input line that matches "action" this function creates a set of
# sh variables named json_N1, json_N2, ... where N1, N2, etc. are json key
# names.
# And for input line that matches "name" but not "action" it creates sh
# variable json_name_ (mind the dangling underscore), which is the top level
# menu name.
# Finally it calls function PROC, which outputs a formatted combination of
# of json_* (and previously-defined) xml_* variables to stdout.
json_parse () {
  local IFS=${WSP_IFS} line menu=$1 proc=$2 count=0
  shift 2     
  while read line; do
    line=${line##[${SPC}]}
    line=${line%%[${SPC}]}
    case $line in
    *"action"*)
      IFS=${NO_WSP}
      json_oline $line
      IFS=${WSP_IFS}
      # at this point any nice json file has already entered "name" below, so
      # we can call $proc with all variables defined
      $proc $* && count=$((++count))
    ;;
    # "name" must follow "action", it's the top menu name
    *"name"*)
      IFS=${NO_WSP}
      json_oline "{${line%,}}"
      IFS=${WSP_IFS}
      json_name_=$json_name
    ;;          
    esac
done < $menu
return $count
}

# usage: xml_var /path/to/config.xml NAME [NAME ...]
# xml_var creates one or more variables xml_NAME from an extension's config.xml
# file - the file must include tag "<extension>". Example:
#  xml_var config.xml author menu => xml_author(Mad Hatter) xml_menu(menu.json)
# Note: unset variables xml_NAME before calling xml_var
# Limitations:
# . opening and closing XML tags must be on the same line
# . XML value must not include double quotes
xml_var () {
  local line xml=$1 valid=0
  shift
  while read line; do
    case $line in
    *"<extension>"*) valid=1 ;; # it's an extension's xml file
    *) for v in $*; do
         case $line in
         *${LT}$v${GT}* | *${LT}$v${SPACE}*)
           line=${line#*${LT}$v}
           line=${line#*${GT}}
           line=${line%${LT}/$v${GT}*}
           [[ 1 = $valid ]] && eval "xml_$v=\$(printf %s \"$line\")"
           break
         ;;
         esac
       done
    ;;
    esac
  done < $xml
}

# dump xml_* and json_* variables
debug_info () {
#available in genuine bash only, prints all xml_* and json_* variables
#      local v
#      echo -n "${0##*/} parsed:"
#      for v in ${!xml_*};  do echo -n " $v(${!v})"; done
#      for v in ${!json_*}; do echo -n " $v(${!v})"; done
#      echo
  
#ash: variable names are hardwired
#The following variables are available; $1 is the extension's dir fullpath
 echo -n "path($1)"
 echo -n " xml_name($xml_name) json_name_($json_name_)"
 echo -n " json_name($json_name) json_action($json_action) json_params($json_params) json_priority($json_priority)"
 echo
}

# default_output displays json_name,action' 'json_params
default_output () {
  local label=$json_name apath=$json_action group
  # fully qualify action path
  [[ -e "$1/$json_action" ]] && apath=$1/$json_action
  # top level menu name
  label=`sanitize $label`
  
  echo "$label$SEPARATOR$apath $json_params"
}

# touch_runner displays action,json_params,group'.'json_name (separator ';')
touch_runner () {
  local label=$json_name apath=$json_action group
  # top level menu name
  [[ "${json_name_}" ]] && group=${json_name_} || group=${xml_name}
  # qualify label
  label=`str_replacechars "$group" '.' '_'` # was ${group//.}.$label
  label=`sanitize $label`
  
  echo "$1$SEPARATOR$apath$SEPARATOR${json_params:-NULL}$SEPARATOR$label"
}

# two_level displays cindex,group,json_name,action' 'json_params
two_level () {
  local label=$json_name apath=$json_action group
  # top level menu name
  [[ "${json_name_}" ]] && group=${json_name_} || group=${xml_name}
  # fully qualify action path
  [[ -e "$1/$json_action" ]] && apath=$1/$json_action
  label=`sanitize $label`
  group=`sanitize $group`
 
  echo "$group$SEPARATOR$label$SEPARATOR$apath $json_params"
}

# prepend cyclical color index when -f=twolevel
colorize () {
  # global COLORMAX SEPARATOR
  local IFS=${NO_WSP} cindex=-1 cstate='' line group
  while read line; do
    IFS=${SEPARATOR} ; set $line ; group=$1 ; IFS=${NO_WSP}
    if [[ "$cstate" != "$group" ]]; then
      cstate=$group
      cindex=$(( ($cindex + 1) % $COLORMAX ))
    fi
    echo "$cindex$SEPARATOR$line"
  done
}

# usage loop [ignorecount]
# find and process all config.xml files and their corresponding json menu files
loop () {
local f px pj nj count=0 ignorecount=0 t
case $1 in
  ignorecount) ignorecount=1 ;;
esac
for f in $(find $EXTENSIONDIR -name config.xml); do
  unset xml_name xml_menu
  xml_var $f name menu
#echo "xml_name($xml_name) xml_menu($xml_menu)"
  [[ "$xml_menu" ]] || continue # not an extension's config.xml file
  case "${xml_menu##*.}" in
    json) ;; # ok
    *) continue ;; # don't know how to handle this menu type
  esac
  px=${f%/*} # px path to config.xml
  # pj path to json menu
  case "$xml_menu" in
    /*) pj=${xml_menu%/*}
    ;;
    *) # is relative
       pj=$px/${xml_menu}
       pj=${pj%/*}
    ;;
  esac
  nj=${xml_menu##*/} # nj json menu filename
  if [[ -f $pj/$nj ]]; then
    unset json_name json_name_ json_action json_params json_priority
    json_parse $pj/$nj $proc $pj
    count=$(( $? + $count ))
  fi
done
# when extensions dir is empty
[[ 00 = $count$ignorecount ]] && test_applet install && loop ignorecount
return 0
}

# usage" test_applet install|uninstall
# adds/removes a simple test applet in $EXTENSIONDIR
# Installing clears and recreates an existing installation of the test applet
# return: non-zero on creation error
test_applet () {
  local prnm=`str_replacechars "$PRODUCTNAME" "${WSP}" '_'`
  local dir=$EXTENSIONDIR/$prnm
  local sh="$dir/test.sh" xml="$dir/config.xml" json="$dir/menu.json"
  [[ -d "$dir" ]] && rm -f "$sh" "$xml" "$json" && rmdir "$dir"
  case "$1" in
  uninstall)
    if [[ -d "$dir" ]]; then
      echo >&2 "${0##*/}: can't uninstall test applet"
      return 1
    fi
    log "test applet uninstalled"
  ;;
  install)
    mkdir -p "$dir"
    if ! { [[ -d "$dir" ]] \
    && echo "<?xml version="1.0" encoding="UTF-8"?>
<extension>
    <information>
        <name>$PRODUCTNAME</name>
        <version>1.0</version>
        <author>stepk</author>
        <id>Test $PRODUCTNAME</id>
    </information>
    <menus>
        <menu type=\"json\">menu.json</menu>
    </menus>
</extension>" > "$xml" \
    && echo "{
\"items\": [
    {
        \"name\": \"$PRODUCTNAME\",
        \"priority\": 1,
        \"items\": [
            {\"name\": \"Test $PRODUCTNAME\", \"priority\": 0, \"action\": \"test.sh\"}
        ]
    }
]
}" > "$json" \
    && echo "#/bin/sh -
exec /usr/bin/lipc-set-prop com.lab126.appmgrd start app://com.lab126.booklet.settings?diagnosticMode=\;411
" > "$sh" \
    && chmod +x "$sh" && log "test applet installed"
    }
    then
      echo >&2 "${0##*/}: can't install test applet"
      return 1
    fi
  ;;
  esac
  return 0
}

# main
main () {
# global opt_format opt_sort
local opt proc pipe t
# parse script options
# Note: both long AND short options require = to set option values
for opt in $*; do
  case $opt in
    -c=*|--colors=*) opt=${opt#*=}
       case $opt in [0-9]|[0-9][0-9]|[0-9][0-9][0-9]) COLORMAX=$(($opt)) ;; esac ;;
      -f=*|--format=*) opt_format=${opt#*=} ;;
    -h|--help) usage; exit ;;
    -l|--log) ;; # pre-parsed near top of file
    -s|--sort) opt_sort=label ;;
    *)
      echo >&2 "${0##*/}: unknown option $opt"
      exit 1
    ;;
  esac
done

case "$opt_format" in
  touchrunner) proc=touch_runner; SEPARATOR=';' ;;
  twolevel) proc=two_level; COLORIDX=-1 ; COLORSTATE="" ;;
  debuginfo) proc=debug_info ;;
  default|'') proc=default_output ;;
  *) echo 2>&1 ${0##*/}: unknown format \"$opt_format\"; usage; exit 1 ;;
esac

pipe=loop

if [[ "$opt_sort" = label ]]; then
  case $proc in
    default_output) pipe="$pipe | sort -f -s" ;;
    touch_runner) pipe="$pipe | sort -f -t \"\$SEPARATOR\" -k 4,4 -s" ;;
    two_level) [[ 0 -lt $COLORMAX ]] && t=' | colorize' || t=''
      pipe="$pipe | sort -f -t \"\$SEPARATOR\" -k 1,1 -s$t"
       ;;
  esac
else
  case $proc in
    two_level) [[ 0 -lt $COLORMAX ]] && t=' | colorize' || t=''
      pipe="$pipe$t"
       ;;
  esac
fi

test_applet uninstall
log "$pipe"
eval $pipe
log "exit($?)"
}

main $*

That would work

Last edited by twobob; 01-27-2013 at 11:57 PM.
twobob is offline   Reply With Quote
Old 01-27-2013, 11:53 PM   #195
norbusan
Zealot
norbusan can do the Funky Gibbon.norbusan can do the Funky Gibbon.norbusan can do the Funky Gibbon.norbusan can do the Funky Gibbon.norbusan can do the Funky Gibbon.norbusan can do the Funky Gibbon.norbusan can do the Funky Gibbon.norbusan can do the Funky Gibbon.norbusan can do the Funky Gibbon.norbusan can do the Funky Gibbon.norbusan can do the Funky Gibbon.
 
Posts: 140
Karma: 82382
Join Date: Jan 2013
Device: Kindle Paperwhite, Kobo Glo, Kobo GloHD
launcher shows "action" tag instead of "name" tag

Hi everyone,
I have one question: The Application Launcher only shows me the script name, but not the "title" that is defined in the config.xml. For example, here it lists:
Code:
Helper: bin/411.sh
Helper: bin/ssallow.sh
...
kterm: bin/kterm
I can launch kterm (the others I haven't tried), but I saw in the menu.json that there is a tag "name" but instead the tag "action" is shown.

Is this a known problem on my device?

(KPW 5.3.3, all the latest kindlets etc, transfer from a Unix file system by unpacking on the laptop and transfer with cp -a to the Kindle)

Thanks

Norbert

Last edited by norbusan; 01-27-2013 at 11:57 PM.
norbusan is offline   Reply With Quote
Reply

Tags
kindle touch, kindle touch hacks, kindlet, kual, launcher, launcher add-ons, paperwhite, sqlite, unified


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Launcher icon for KUAL? Aeris Kindle Developer's Corner 32 04-01-2021 08:57 PM
kite: kindle 3 application launcher fbdev Kindle Developer's Corner 86 10-18-2017 11:19 AM
[KUAL]Kindle reflective screen loader icantbebothered Kindle Developer's Corner 26 10-27-2013 10:08 AM
Kual shortcut for hidden image viewer (Kindle Touch & PW) Aeris Kindle Developer's Corner 0 10-12-2013 06:09 AM
application launcher for kindle 3 (kite) fbdev Kindle Developer's Corner 21 05-04-2012 07:02 PM


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


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