View Single Post
Old 08-11-2008, 07:36 PM   #1
mkaluza
Member
mkaluza began at the beginning.
 
Posts: 20
Karma: 27
Join Date: Jul 2008
Device: PRS-505
Code to launch autorun from SD without pullin the card out

I'm not sure, but if it was posted here already, then sorry for the mess.
Actually biggest thanks go to llasram for figuring out, how to force memory rescan and therefore initiate card autorun script. The code below, when run, hooks up to bookmark-key-hold action and forces a rescan when the button is held. This allows to avoid pulling the card in and out each time you want to use an app from there (a dict for example).
The hook is not permanent - it's cleared upon device reboot (obvious) and also when the device is connected and disconnected from usb - main UI seems to be reinitialized then. (this shows a particularly interesting opportunity - if we mount --bind the directory with main.xml to a dir on a /Data partition and it is rescanned and loaded from a new location, we can gain a bricking-safe way to manipulate main.xml without even the need to reflash the reader, but this I'll check tomorrow)

var objs = new Array();
var obj;
var n=0;
obj=this;
while(n<30) { //infinite loop protection - 30 is an arbitrary number
objs[n]=obj;
if (obj.container) obj=obj.container;
else break;
n++;
}

//not a very nice way, but for now I haven't figured out any better
objs[n-2].doMarkMenu=function() {
this.setVariable("SHD_TIME","XXXXX");//just for fun
kbook.model.initialized(); //got this from bookswap, thanks again
};

It's of course just a very general demo - it can be made much more versatile and context sensitive.
Comments and remarks are welcome, as always.
btw. llasram - how did you find it? Object dump didn't show it to me.

Martin
mkaluza is offline   Reply With Quote