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 07-21-2012, 10:04 AM   #1
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
Question How to make the store button useful?

I have absolutely no need for the store button on the standard KT interface. I don't shop in the Amazon store and I haven't even registered my KT.

So how can I repurpose the store button?

A simple first step is to replace the store button image with one that is less ugly. Copy the attached image to your kindle and type this:
Code:
mntroot rw; cp space_invader.png /usr/share/webkit-1.0/pillow/assets/search_bar/store.png ; mntroot ro
Afterwards you have to restart cvm or just the complete Kindle and you'll get a stylish little glyph where the ugly shopping cart was.

But that doesn't change its function yet. Does anybody know how to do this?

I'm currently still on 5.0.4 so I guess using nativeBridge.dbgCmd would have been an option but as we all know this will disappear with 5.1.1.

As far as I have come I think we have to inject an application into the lipc event system on the KT. If you have a html/js application on the KT that's probably easy as you can use wafapp to load that app. But there is no possibility to call a Java or native app from that web application?

Does anybody know how to do a lipc conforming Java or native app?
Attached Images
  

Last edited by bhaak; 12-09-2012 at 12:35 PM. Reason: added the inverted png
bhaak is offline   Reply With Quote
Old 07-21-2012, 10:20 AM   #2
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
here

thomass is offline   Reply With Quote
 
Enthusiast
Old 07-21-2012, 10:28 AM   #3
ixtab
(offline)
ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.
 
ixtab's Avatar
 
Posts: 2,903
Karma: 6677485
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
Quote:
Originally Posted by bhaak View Post
I have absolutely no need for the store button on the standard KT interface. I don't shop in the Amazon store and I haven't even registered my KT.

So how can I repurpose the store button?

A simple first step is to replace the store button image with one that is less ugly. Copy the attached image to your kindle and type this:
Code:
mntroot rw; cp space_invader.png /usr/share/webkit-1.0/pillow/assets/search_bar/store.png ; mntroot ro
Afterwards you have to restart cvm or just the complete Kindle and you'll get a stylish little glyph where the ugly shopping cart was.
That's not enough for 5.1.*. There is an additional (inverted) store_active.png - but that's just a minor detail.

Quote:
Originally Posted by bhaak View Post
But that doesn't change its function yet. Does anybody know how to do this?
http://www.mobileread.com/forums/sho...d.php?t=178752

Quote:
Originally Posted by bhaak View Post
I'm currently still on 5.0.4 so I guess using nativeBridge.dbgCmd would have been an option but as we all know this will disappear with 5.1.1.
It already disappeared with 5.0.3

Quote:
Originally Posted by bhaak View Post
As far as I have come I think we have to inject an application into the lipc event system on the KT. If you have a html/js application on the KT that's probably easy as you can use wafapp to load that app. But there is no possibility to call a Java or native app from that web application?

Does anybody know how to do a lipc conforming Java or native app?
I personally don't have first-hand experience, but it doesn't seem terribly complicated. You can take a look at the LIPC registry stuff, and a bit further. For instance, com.lab126.draw is a WAF app. It is launched through the native wafapp with a few parameters. You could launch any other native application similarly.
Code:
INSERT INTO "properties" VALUES('com.lab126.draw','command','/usr/bin/wafapp -l com.lab126.draw -c /var/local/waf/draw/');
While a Java booklet (in this case the home booklet) can be launched like this:
Code:
INSERT INTO "properties" VALUES('com.lab126.booklet.home','lipcId','com.lab126.booklet.home');
INSERT INTO "properties" VALUES('com.lab126.booklet.home','jar','/opt/amazon/ebook/booklet/home.jar');
INSERT INTO "properties" VALUES('com.lab126.booklet.home','supportedOrientation','U');
INSERT INTO "properties" VALUES('com.lab126.booklet.home','maxLoadTime','40');
INSERT INTO "properties" VALUES('com.lab126.booklet.home','maxGoTime','30');
INSERT INTO "properties" VALUES('com.lab126.booklet.home','defaultContext','context=0');
Needs a bit of experimentation, I guess, but absolutely feasible. Good luck
ixtab is offline   Reply With Quote
Old 07-21-2012, 10:48 AM   #4
ixtab
(offline)
ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.
 
ixtab's Avatar
 
Posts: 2,903
Karma: 6677485
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
Some more:

Maybe the easiest Booklet to dissect would be the com.lab126.booklet.test, because it's pretty small (the entire jar is only 33kB, and it only contains a dozen or so classes (including inner classes)).

It can be started using lipc-set-prop com.lab126.appmgrd start app://com.lab126.booklet.test

I haven't figured out how to "operate" it, probably by interacting with it through lipc itself:
Code:
[root@kindle root]# (lipc-probe -a -v|grep -A 7 '^com.lab126.booklet.test') 2>/dev/null
com.lab126.booklet.test
	w 	Str	runtest
	w	Str	pause
	w	Str	unload
	w	Str	stoptest
	w	Str	load
	w	Str	go
	w	Str	startresult
And here are the relevant entries in the registry:
Spoiler:

INSERT INTO "handlerIds" VALUES('com.lab126.booklet.test');
INSERT INTO "properties" VALUES('com.lab126.booklet.test','lipcId','com.lab 126.booklet.test');
INSERT INTO "properties" VALUES('com.lab126.booklet.test','jar','/opt/amazon/ebook/booklet/KAFtest.jar');
INSERT INTO "mimetypes" VALUES('runtest','MT:application/x-amazon-testrunner');
INSERT INTO "extenstions" VALUES('runtest','MT:application/x-amazon-testrunner');
INSERT INTO "associations" VALUES('com.lab126.booklet.test','application','MT :application/x-amazon-testrunner','true');


HTH
ixtab is offline   Reply With Quote
Old 07-21-2012, 01:10 PM   #5
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 ixtab View Post
That's not enough for 5.1.*. There is an additional (inverted) store_active.png - but that's just a minor detail.
5.0.* already has that too, although commented out in search_bar.css. Apparently the there are 2 pseudoclasses that can be used:
Code:
/* Commenting out to test no XOR look feel
.store:enabled:active {
    background-image: url('../assets/search_bar/store_active.png');
}*/
I would have thought that you still don't NEED a second image.

Quote:
Originally Posted by ixtab View Post
I personally don't have first-hand experience, but it doesn't seem terribly complicated. You can take a look at the LIPC registry stuff, and a bit further. For instance, com.lab126.draw is a WAF app. It is launched through the native wafapp with a few parameters. You could launch any other native application similarly.
I forgot to mention that I already tried that with a native application. But then you get this in the log:
Code:
120721:190343 appmgrd[963]: W appmgr_history:timeout_check:lipc_id=com.lab126.store,state=EXECUTED:Timed out waiting for app to register a lipc id
and the app gets killed.

Thanks for the tip about com.lab126.booklet.test. I'll have a look at its decompiled source and try to use it.
bhaak is offline   Reply With Quote
Old 09-21-2012, 03:06 PM   #6
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
So, I finally had time to do something with this again.

For a minimal booklet it's actually quite simple. You just need to create a class that extends AbstractBooklet and adding Main-Class: your.package.path.and.BookletClass to META-INF/MANIFEST.MF and that gives you a simple empty window when started.

I hijacked the booklet com.lab126.booklet.testbooklet that should be contained in /opt/amazon/ebook/booklet/testBook.jar but this jar is missing from a non-debug KT. So I didn't even have to overwrite any original files. I used a symlink for testBook.jar, so I didn't had to always do a mntroot although I still had to restart cvm for every update.

Code:
mntroot rw
ln -s /mnt/us/testBook.jar /opt/amazon/ebook/booklet/testBook.jar
mntroot ro
lipc-set-prop com.lab126.appmgrd start app://com.lab126.booklet.testbooklet
There are many methods that you can implement, but so far I've only seen calls to the constructor and create(BookletContext bookletContext) when starting up for the first time, calls to start(URI contentURI) for every start and stop() when pressing the home button.

Here's a link to the class' source code. I'll also attach the jar.
https://gist.github.com/3762793

Wiring that booklet up to the store button is easy enough after this. Just changing in /usr/share/webkit-1.0/pillow/javascripts/search_bar.js the STORE_ID constant to app://com.lab126.booklet.testbooklet and voilà.

Now I only need to extend that booklet to launch HackedUpReader. Should not be too hard.
Attached Files
File Type: zip KindleCustomBooklet.zip (2.1 KB, 43 views)

Last edited by bhaak; 10-04-2012 at 06:47 AM. Reason: typo
bhaak is offline   Reply With Quote
Old 09-22-2012, 12:59 PM   #7
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
It was much less cumbersome than getting the booklet to work. I had to put the jar directly at /opt/amazon/ebook/booklet/testBook.jar as the security policies didn't allow the symlinked jar to work and I didn't feel like changing them.

I added some code that sends a QUIT signal to HackedUpReader when the booklet's stop() method gets called. So far I've only seen that when you press the home button. Also when you quit HackedUpReader the booklet sends the same event as when you press the back button.

I did this by calling the command line program ("lipc-set-prop com.lab126.appmgrd backward 0") as I didn't find out easily how you would do that within the Java framework.

It works fine so far although sometimes it hangs for a second or two while starting or stopping. I suspect some memory shortage and it has to discard some cached stuff first.

I don't think this is good enough for the general non-developing end user but it is good enough for me.

I've also put the source code onto github.
Attached Files
File Type: zip HackedUpReaderBooklet.zip (3.0 KB, 47 views)

Last edited by bhaak; 10-04-2012 at 06:51 AM. Reason: adding github link
bhaak is offline   Reply With Quote
Old 02-22-2014, 08:41 AM   #8
tbx1024
Junior Member
tbx1024 began at the beginning.
 
tbx1024's Avatar
 
Posts: 2
Karma: 10
Join Date: Feb 2014
Device: Kindle PW2
Question

Hi!
I have a similar problem here - i wanted to use the Store button to launch KTerm.
I added it to the database using the SQLite3 prompt:
Code:
INSERT INTO "handlerIds" VALUES('com.lab126.kterm');
and
Code:
INSERT INTO "properties" VALUES('com.lab126.kterm','command','/bin/sh /mnt/us/extensions/kterm/bin/kterm.sh');
I then changed the store button action to com.lab126.kterm: it now successfuly launched KTerm, but a few seconds after it launches, i get a dialog saying "Application Error: The selected application could not be started. Please try again". In the system log, i get the same error as bhaak :
Code:
140222:143540 appmgrd[2131]: W appmgr_history:timeout_check:lipc_id=com.lab126.kterm,state=EXECUTED:Timed out waiting for app to register a lipc id
Is it possible to get rid of the error dialog?
Thank you very much
tbx1024 is offline   Reply With Quote
Old 02-22-2014, 09:03 AM   #9
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,226
Karma: 5830430
Join Date: Feb 2012
Device: Too many.
Perhaps register a lipc id ?
(in kterm.sh that is)
knc1 is offline   Reply With Quote
Old 02-22-2014, 09:15 AM   #10
dsmid
Linux devotee
dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.dsmid ought to be getting tired of karma fortunes by now.
 
dsmid's Avatar
 
Posts: 553
Karma: 2053595
Join Date: Feb 2011
Device: Kindle 3, Kindle 4B, Kindle PW2
What about launching a dummy booklet from kterm.sh that will just register the ID and won't do anything else ?
dsmid is offline   Reply With Quote
Old 02-22-2014, 12:17 PM   #11
tbx1024
Junior Member
tbx1024 began at the beginning.
 
tbx1024's Avatar
 
Posts: 2
Karma: 10
Join Date: Feb 2014
Device: Kindle PW2
Question

Thank you very much for your quick answers!
I would like to keep this as simple as possible, as it's a simple tweak, so launching a dummy booklet sounds a bit like an overkill

Quote:
Originally Posted by knc1 View Post
Perhaps register a lipc id ?
(in kterm.sh that is)
How could i achieve this? Is there a LIPC documentation somewhere?
tbx1024 is offline   Reply With Quote
Old 02-22-2014, 01:41 PM   #12
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
@tbx1024, you can try to modify behavior of search bar's elements without modifying stock files. As an example, here is how I added reaction to swiping over Menu button.

Useful links: how to run any program with LIPC, maybe you'll need to add DISPLAY=:0 to run Kterm.

Or just use Kindle Menu (which includes KTerm).

EDIT: to answer you initial question, yes, it's possible to get rid of error dialog, but not without changing Kterm's sources and recompiling. Applications from appreg.db are launched by appmgrd. appmgrd pings launched applications over LIPC, so Kterm shoud know how to answer on its start and how to notify appmgrd about exit from Kterm.

Last edited by eureka; 02-22-2014 at 01:51 PM.
eureka 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
[KT]Turn store button on search bar to browser button aditya3098 Kindle Developer's Corner 68 06-07-2014 06:56 AM
Warning - Kindle Store button removed from Amazon app RCR Apple Devices 4 09-02-2011 03:35 PM
How to make use of print button xXxXxXxXxXx Recipes 2 05-19-2011 03:42 PM
They had almost two years to make the delete button work ErwinOtten Bookeen 19 01-23-2010 04:06 PM
Could you make a script for changing button shortcut for me? harpum iRex 42 07-13-2008 02:00 AM


All times are GMT -4. The time now is 12:04 PM.


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