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 10-12-2012, 08:43 AM   #826
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 arikfunke View Post
Sounds easy enough. I will give it a try. Am I right to assume that bootstrap/stage1.class won't be needed in this case? It produces compile errors due to the missing osgi dependencies.
Yep, right
ixtab is offline   Reply With Quote
Old 10-12-2012, 10:52 AM   #827
arikfunke
Enthusiast
arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.
 
Posts: 32
Karma: 41848
Join Date: Mar 2011
Device: iRex
I finally got everything to compile at least. One issue I was the following:

conf\ConfigurableSetting.java:36: error: cannot find symbol
public abstract SettingPanel getPanel(SettingChangeListener listener);
^
symbol: class SettingChangeListener
location: class ConfigurableSetting


The problem is:
- JBPatch core files depend on "ConfigurableSettings",
- which in turn depends on "ConfigurableSetting",
- which depends on the UI component of the conf component,
- which of course I removed as it won't work on K3.

How do I cleanly decouple the UI part from the configuration part of the code? Is it ok to just comment out the following line? (Plus the corresponding imports at the top of the code...)

Code:
public abstract SettingPanel getPanel(SettingChangeListener listener);
Or will this have unforeseen consequences down the line? If that is ok, I am ready to try it out on the K3.

Last edited by arikfunke; 10-12-2012 at 11:40 AM.
arikfunke is offline   Reply With Quote
Old 10-12-2012, 11:42 AM   #828
arikfunke
Enthusiast
arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.
 
Posts: 32
Karma: 41848
Join Date: Mar 2011
Device: iRex
Good news: it appears JBPatch works with some minor adjustments to the code on K3.

/tmp/jbpatch.log:
Code:
Log start timestamp: Fri Oct 12 15:36:54 GMT 2012
Bootstrap OK, PatchingClassLoader instantiated
   Packages still handled by original ClassLoader:
   - com.mobileread.ixtab.jbpatch.bootstrap

JBPatch version 2.4.0: initializing patches

I: Directory synchronization thread started
I: (builtin) DeviceInfo registered for com.amazon.kindle.settings.dialog.Device
InfoDialog
I: Patch policy initialized
@ixtab: How does this look to you? Can I get started writing a patch for the K3?
arikfunke is offline   Reply With Quote
Old 10-12-2012, 11:43 AM   #829
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 arikfunke View Post
I finally got everything to compile at least. One issue I was the following:

conf\ConfigurableSetting.java:36: error: cannot find symbol
public abstract SettingPanel getPanel(SettingChangeListener listener);
^
symbol: class SettingChangeListener
location: class ConfigurableSetting


The problem is:
- JBPatch core files depend on "ConfigurableSettings",
- which in turn depends on "ConfigurableSetting",
- which depends on the UI component of the conf component,
- which of course I removed as it won't work on K3.

How do I cleanly decouple the UI part from the configuration part of the code? Is it ok to just comment out the following line? (Plus the corresponding imports at the top of the code...)

Code:
public abstract SettingPanel getPanel(SettingChangeListener listener);
Or will this have unforeseen consequences down the line?
In fact, you don't have to leave anything out. If the UI part of the patches compiles, let it compile and be happy.

Java loads classes on demand (=when they are first requested). If nobody requests the UI part of JBPatch, the corresponding classes will never actually be loaded.


Quote:
Originally Posted by arikfunke View Post


If that is ok, I am ready to try it out on the K3. Regarding the startup script your wrote:


This sounds like there is a very real chance that the framework won't start and I will be locked out of the kindle. How will I recover from that?
No, I didn't want to scare you away. Chances are that everything just works. I'm not just posting random code - in fact, I believe that it will work. But I won't guarantee that it will (quite simply: I couldn't test it), and there is always some risk, until somebody actually tries it. From what I understand, you are willing to try it - and I assume that you also know the risks, and that you can handle them (and that you know how to get your device back into a working state, in case something fails). But this is your duty, not mine.
ixtab is offline   Reply With Quote
Old 10-12-2012, 02:21 PM   #830
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,552
Karma: 6021142
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.. well at the risk of being a Kindle Martyr

@arikfunke I will test it if you would like... Batter up. Sling me a copy.
KK at the ready.

Last edited by twobob; 10-12-2012 at 02:24 PM. Reason: @arikfunke
twobob is offline   Reply With Quote
Old 10-12-2012, 02:40 PM   #831
arikfunke
Enthusiast
arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.
 
Posts: 32
Karma: 41848
Join Date: Mar 2011
Device: iRex
Quote:
Originally Posted by twobob View Post
@arikfunke I will test it if you would like... Batter up. Sling me a copy.
KK at the ready.
@twobob: Thanks for the offer, but I found a safe way to launch the framework with the hack. It seems to work ok. (See my previous post.)

Obviously nothing interesting happens as there are no patches yet. You want a copy anyways?

I will take a look at how to write those over the next few days to see whether the patching works as expected.
arikfunke is offline   Reply With Quote
Old 10-12-2012, 03:09 PM   #832
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,552
Karma: 6021142
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
yep definitely want a copy mate. pls.
twobob is offline   Reply With Quote
Old 10-12-2012, 03:26 PM   #833
qlob
Official Lurker
qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.qlob ought to be getting tired of karma fortunes by now.
 
qlob's Avatar
 
Posts: 1,048
Karma: 7096675
Join Date: Apr 2012
Device: Kindle 3.4
Quote:
Originally Posted by twobob View Post
yep definitely want a copy mate. pls.
Seconded. I would love to help with this effort. Now i just need to learn Java so I can start writing patches..... may be a while though...
qlob is offline   Reply With Quote
Old 10-12-2012, 09:19 PM   #834
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,552
Karma: 6021142
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 qlob View Post
Seconded. I would love to help with this effort. Now i just need to learn Java so I can start writing patches..... may be a while though...
You'll get the hang of it no doubt : )
twobob is offline   Reply With Quote
Old 10-14-2012, 05:52 AM   #835
arikfunke
Enthusiast
arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.arikfunke is an enigma wrapped up in a mystery.
 
Posts: 32
Karma: 41848
Join Date: Mar 2011
Device: iRex
JBPatch works on K3

Good news for those who have been waiting for JBPatch on K3: after writing a small dummy patch I can confirm that JBPatch appears to work perfectly on K3. (Obviously less the UI component.)

Rough recipe for compiling JBPatch for K3:
  1. Delete the "ui" directories from the JBPatch source tree. That is in its base directory and in the "conf" directory.
  2. Delete the line "public abstract SettingPanel getPanel(SettingChangeListener listener);" from "conf/ConfigurableSetting.java"
  3. Delete "bootstrap/Stage1.java" from the source tree.
  4. Delete the patch source files from the source tree.
  5. Add the new startup script for the K3 from this post.
  6. Compile and pack in a JAR

Note: the deletions were necessary in my case due to missing dependencies. If you have them, it should not be necessary to delete anything from the source three.

Copy the JAR to the kindle as described by ixtab in his post.

I have also created a dummy patch that prefixes "abcXYZ" to any search string entered in the browser's URL bar for Google searches:

Code:
package com.mobileread.arikfunke.patch;

import java.util.Map;

import serp.bytecode.BCClass;
import serp.bytecode.lowlevel.Entry;
import serp.bytecode.lowlevel.UTF8Entry;

import com.mobileread.ixtab.jbpatch.Patch;
import com.mobileread.ixtab.jbpatch.PatchMetadata;
import com.mobileread.ixtab.jbpatch.PatchMetadata.PatchableClass;

public class K3BrowserGoogleMobileSearchPatch extends Patch {

	private static final String CLASS = "com.amazon.ebook.booklet.browser.resources.BrowserResources";
	private static final String MD5_BEFORE = "6c8c6e226e2f60e134fa7ccec784c4ce";
	private static final String MD5_AFTER = "96d802f5b0cef88cdf54a2407e263af8";

	private final String[] ORIGINAL = new String[] { "search.internet.url.pattern", "http://www.google.com/search?q={0}" };
	private final String[] REPLACEMENT = new String[] { "search.internet.url.pattern", "http://www.google.com/search?q=abcXYZ{0}" };
	
	public int getVersion() {
		return 20121013;
	}

	protected void initLocalization(String locale, Map map) {
		if (RESOURCE_ID_ENGLISH.equals(locale)) {
			map.put(I18N_JBPATCH_NAME, "Use Google Mobile Search in Browser");
			map.put(I18N_JBPATCH_DESCRIPTION, "This is a proof of concept patch. It changes the browser's search-bar behaviour. abcXYZ is prefixed to any search string.");
		}
	}

	public PatchMetadata getMetadata() {
		PatchableClass pc = new PatchableClass(CLASS).withChecksums(MD5_BEFORE,
				MD5_AFTER);
		return new PatchMetadata(this).withClass(pc);
	}

	public String perform(String md5, BCClass clazz) throws Throwable {
		if (md5.equals(MD5_BEFORE)) {
			patchBrowserResources(clazz);
			return null;
		}
		return "unsupported MD5: "+md5;
	}

	private void patchBrowserResources(BCClass clazz) {
		String[] replacement = REPLACEMENT;
		
		Entry[] entries = clazz.getPool().getEntries();
		for (int e=0; e < entries.length; ++e) {
			if (entries[e] instanceof UTF8Entry) {
				UTF8Entry entry = (UTF8Entry) entries[e];
				for (int r = 0; r < ORIGINAL.length; ++r) {
					if (ORIGINAL[r].equals(entry.getValue())) {
						entry.setValue(replacement[r]);
						break;
					}
				}
			}
		}
	}

}
To try the patch, compile into a class file and rename to "com.mobileread.arikfunke.patch.K3BrowserGoogleMob ileSearchPatch.class". Copy to "/mnt/us/opt/jbpatch/" on the K3 (or simply "/opt/jbpatch/" when plugged in as USB drive).

Restart the framework with the modifications described in this post by ixtab. (Note: due to changes in the naming of the classes you need to use "app=com.mobileread.ixtab.jbpatch.bootstrap.K3Star tup" rather than "app=com.mobileread.ixtab.jbpatch.bootstrap.Startu p" .)

Hope this is useful to somebody. Many thanks to ixtab for the great work with JBPatch!
Attached Files
File Type: zip jbpatchK3.zip (204.0 KB, 238 views)

Last edited by arikfunke; 10-14-2012 at 06:02 AM.
arikfunke is offline   Reply With Quote
Old 10-14-2012, 10:53 AM   #836
eduard93
Junior Member
eduard93 began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Nov 2010
Device: Kindle Touch
Noob question here. Installed JBpatch today (Kindle Touch 5.1.2, JBpatch 2.4.1). Works nicely. How can I configure it, so home screen would always stay in portrait mode? After applying JBpatch it started "following" reading screen mode. I tried disabling "Enable all Screen Rotations" patch, but home screen still goes album, if i choose it while reading.
eduard93 is offline   Reply With Quote
Old 10-15-2012, 12:19 PM   #837
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 eduard93 View Post
Noob question here. Installed JBpatch today (Kindle Touch 5.1.2, JBpatch 2.4.1). Works nicely. How can I configure it, so home screen would always stay in portrait mode? After applying JBpatch it started "following" reading screen mode. I tried disabling "Enable all Screen Rotations" patch, but home screen still goes album, if i choose it while reading.
Disabling the "all rotations patch" is the correct solution.

But you forgot one fundamental thing: "all changes that you make to patch settings generally require a restart of the framework before they come into effect."

ixtab is offline   Reply With Quote
Old 10-15-2012, 01:19 PM   #838
eduard93
Junior Member
eduard93 began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Nov 2010
Device: Kindle Touch
Quote:
Originally Posted by ixtab View Post
Disabling the "all rotations patch" is the correct solution.

But you forgot one fundamental thing: "all changes that you make to patch settings generally require a restart of the framework before they come into effect."

Thanks.
eduard93 is offline   Reply With Quote
Old 10-18-2012, 02:53 AM   #839
DrunkenDonkey
Connoisseur
DrunkenDonkey is a jewel in the roughDrunkenDonkey is a jewel in the roughDrunkenDonkey is a jewel in the roughDrunkenDonkey is a jewel in the roughDrunkenDonkey is a jewel in the roughDrunkenDonkey is a jewel in the roughDrunkenDonkey is a jewel in the roughDrunkenDonkey is a jewel in the roughDrunkenDonkey is a jewel in the roughDrunkenDonkey is a jewel in the roughDrunkenDonkey is a jewel in the rough
 
Posts: 76
Karma: 7087
Join Date: May 2009
Device: Kindle PW2
Hey guys, I'm confused a bit about the models here and could not find in the sticky pages which is which... this topic is marked K5, does that $69 kindle qualify or it is out of the question? It is K4?
DrunkenDonkey is offline   Reply With Quote
Old 10-18-2012, 03:03 AM   #840
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 DrunkenDonkey View Post
Hey guys, I'm confused a bit about the models here and could not find in the sticky pages which is which... this topic is marked K5, does that $69 kindle qualify or it is out of the question? It is K4?
That's a K4. In general, you only need to look at the firmware number shown in the device info. Firmware 3.x is K3, FW 4.x is K4, FW 5.x is a K5.

So, your K4 does not "qualify" for the "happy camper" package (JBPatch core and all the described patches - that's K5 only). However, if you scroll back a few posts, you'll see that JBPatch as such has been ported to (and is known to work on) the K3. There is no reason why it wouldn't work on the K4, but nobody tried to make it run on that Firmware yet.
ixtab is offline   Reply With Quote
Reply

Tags
jbpatch, kindle touch hacks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump


All times are GMT -4. The time now is 06:30 PM.


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