| 
	|||||||
![]()  | 
            
        
| 
             | 
        Thread Tools | Search this Thread | 
| 
			
			 | 
		#1 | 
| 
			
			
			
			 20% cooler. 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 93 
				Karma: 364674 
				Join Date: Oct 2012 
				Location: Poznań, Poland 
				
				
				Device: Kindle Paperwhite 1 
				
				
				 | 
	
	
	
		
		
			
			 
				
				eventHandler - easy way to run scripts on boot and screensaver on/off events
			 
			
			
			I've just created a small package for Kindle Touch and Paperwhite. 
		
	
		
		
			(please note that it's untested on Touch, but it should work) I don't know if anything like that already exists. I just created it for myself and now decided to learn how to package stuff with kindletool ![]() It's a very simple shell script used to run other shell scripts on particular events - boot, suspend or resume. Boot is self-explanatory, suspend is going to screen saver and resume is returning from screen saver. After installing eventHandler you'll see a scripts directory created in your user partition. It contains three subdirectories - boot, suspend and resume. When event occurs, eventHandler runs all scripts in directory matching given event. It's simple as that   This gives you possibility to run simple scripts without having to install usb networking and other advanced stuff. You'll just need a jailbreak.Installing is easy: just put install file in root directory of user partition and select "Update your Kindle" from Settings screen. Uninstalling follows the same pattern. Package contains also few scripts used by me which can be taken as examples: Spoiler: 
 Please note that example scripts are only tested on Paperwhite. NOTE: eventHandler runs all your scripts as root, so be careful with what you include in your scripts! Running "rm -rf /" isn't probably a good idea ![]() If you have Kindle Touch or Kindle Paperwhite, install kindle5 version. If you have non-touch Kindle 4, install kindle4 version. Please note that Kindle 4 version is untested! Enjoy! [edit] Updated to 0.11 version which should fix bug reported by stepk and which brings (untested) install files for Kindle 4 (non-touch). [edit] Updated to 0.2 version which now works properly with magnetic cover. Last edited by dos1; 03-01-2013 at 07:20 PM. Reason: update to 0.2  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#2 | 
| 
			
			
			
			 Official Lurker 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,050 
				Karma: 7096675 
				Join Date: Apr 2012 
				
				
				
				Device: Kindle 3.4 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			It's almost like Kite! (but lacking in the launching scripts from the home screen area...) 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Looks fancy though... It would be cool to write this for the K3 or K4 as well.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#3 | 
| 
			
			
			
			 Groupie 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 165 
				Karma: 593460 
				Join Date: Oct 2012 
				
				
				
				Device: K5 B011 5.3.2.1 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Thanks for this. Unfortunately install.sh fails on my KT because it assumes that /usr/local exists, while it really doesn't - on my almost untouched KT.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#4 | 
| 
			
			
			
			 ( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586 
				Karma: 6299993 
				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 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			I had an issue in DIAGS where it (booting diags) would clean down my /usr/local 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Never not had one. Good point though. best to do a [ -e ] or z or f or whatever I suppose   YAY CORNER CASES!  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#5 | |
| 
			
			
			
			 20% cooler. 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 93 
				Karma: 364674 
				Join Date: Oct 2012 
				Location: Poznań, Poland 
				
				
				Device: Kindle Paperwhite 1 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 BTW. I've included version for Kindle 4, could someone test if it works? (note that example scripts probably won't work without adjusting)  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#6 | 
| 
			
			
			
			 Groupie 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 165 
				Karma: 593460 
				Join Date: Oct 2012 
				
				
				
				Device: K5 B011 5.3.2.1 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			OK, it's working now, thanks. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	How do you generate the server content for the rss feed script? I mean, do you run the calibre client on a debian box and save generated .pobi files to the http server, or do you run calibre as a content server?  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#7 | 
| 
			
			
			
			 20% cooler. 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 93 
				Karma: 364674 
				Join Date: Oct 2012 
				Location: Poznań, Poland 
				
				
				Device: Kindle Paperwhite 1 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			I have installed Calibre on my VPS and created cron jobs for updating pobi files in specified directory, which is exported to the world via rsync daemon.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#8 | 
| 
			
			
			
			 20% cooler. 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 93 
				Karma: 364674 
				Join Date: Oct 2012 
				Location: Poznań, Poland 
				
				
				Device: Kindle Paperwhite 1 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			0.2 version is now up - I've fixed a bug which prevented scripts from being launched when using magnetic cover. Enjoy!
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#9 | 
| 
			
			
			
			 ( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586 
				Karma: 6299993 
				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 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			ROCK HANDS!!!
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#10 | 
| 
			
			
			
			 Member 
			
			![]() Posts: 17 
				Karma: 10 
				Join Date: May 2013 
				
				
				
				Device: PaperWhite 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Thanks you for this package ! 
		
	
		
		
		
		
		
		
		
		
		
		
	
	I have an issue with the startup script. I would like to run a web browser (this one https://www.mobileread.com/forums/sho...d.php?t=210210) at startup. The application is well opened but few secondes later the classic menu comes back. When I launch it from the suspend or resume script, it works fine. My first guess was that the browser finished his launching before the Kindle. Did you ever notice this kind of problem ?  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#11 | 
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,669 
				Karma: 2300001 
				Join Date: Mar 2011 
				Location: Türkiye 
				
				
				Device: Kindle 5.3.7 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#12 | 
| 
			
			
			
			 Member 
			
			![]() Posts: 17 
				Karma: 10 
				Join Date: May 2013 
				
				
				
				Device: PaperWhite 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			I did but it seems that the browser begin his launching anyway, then the function sleep hold and at the end the menu shows up. (I place the sleep function before my call to the browser)
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#13 | 
| 
			
			
			
			 Member 
			
			![]() Posts: 17 
				Karma: 10 
				Join Date: May 2013 
				
				
				
				Device: PaperWhite 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Hi ! I would use the event handler to switch from normal mode to standby mode, standby mode to normal mode, etc ... But the script in the folder "suspend" only partially executed and I do not get out of standby mode. Any ideas? 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Here are the contents of my scripts. "resume": Code: 
	#!/bin/sh echo >> /mnt/us/scripts/logs.txt date >> /mnt/us/scripts/logs.txt echo Kindle awakes >> /mnt/us/scripts/logs.txt date >> /mnt/us/scripts/logs.txt # enable WiFi echo enable WiFi : >> /mnt/us/scripts/logs.txt lipc-set-prop com.lab126.cmd wirelessEnable 1 lipc-get-prop com.lab126.cmd wirelessEnable >> /mnt/us/scripts/logs.txt # sleep echo sleep during 10 secondes >> /mnt/us/scripts/logs.txt sleep 10 date >> /mnt/us/scripts/logs.txt # calendar update echo calendar update >> /mnt/us/scripts/logs.txt /mnt/us/extensions/WebLaunch/bin/start.sh & date >> /mnt/us/scripts/logs.txt # delay nedeed to do the update echo sleep during 10 secondes >> /mnt/us/scripts/logs.txt sleep 10 date >> /mnt/us/scripts/logs.txt # disable WiFi echo disable WiFi >> /mnt/us/scripts/logs.txt lipc-set-prop com.lab126.cmd wirelessEnable 0 lipc-get-prop com.lab126.cmd wirelessEnable >> /mnt/us/scripts/logs.txt # sleep echo sleep during 1 secondes >> /mnt/us/scripts/logs.txt sleep 1 date >> /mnt/us/scripts/logs.txt # go to screenSaver mode (even if the screen doesn't change) echo go to screenSaver mode >> /mnt/us/scripts/logs.txt lipc-set-prop com.lab126.powerd powerButton 0 Code: 
	#!/bin/sh echo >> /mnt/us/scripts/logs.txt date >> /mnt/us/scripts/logs.txt echo Kindle falls asleep >> /mnt/us/scripts/logs.txt date >> /mnt/us/scripts/logs.txt # EXECUTION STOPS HERE # synchro each hour echo Kindle pending awakening (during 1 hour) >> /mnt/us/scripts/logs.txt # sleep 3600 sleep 10 # awakening date >> /mnt/us/scripts/logs.txt # out of screenSaver mode echo out of screenSaver mode >> /mnt/us/scripts/logs.txt lipc-set-prop com.lab126.powerd powerButton 0  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#14 | 
| 
			
			
			
			 Going Viral 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212 
				Karma: 18210809 
				Join Date: Feb 2012 
				Location: Central Texas 
				
				
				Device: No K1, PW2, KV, KOA 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Short answer: PEBCAK 
		
	
		
		
		
		
		
		
		
		
		
		
		
			Longer answer (but not all inclusive): 1) "sleep" is a shell command, not a system command. It only effects the execution path of the script that contains it. 2) Where / How are these scripts being called? 3) If you do succeed in putting the processor to sleep, then you need a hardware event from some hardware that is still running to wake it. 4) Writing less than a full erase block of data to flash will cause the "short write" to be cached (somewhere, there are several places) in the system or within the flash chip's controller itself. Shutting down the power to the flash and its internal controller before it completes one of its erase and re-program functions (while the operation is in progress) will at best result in a corrupted, non-recoverable, erase (storage) block in the flash. At worse, a corrupted, non-recoverable internal control structure (then it is unsolder flash chip, solder in a new one time). You really should try to understand the system and its hardware before trying to take control of it outside of its normal dependence system. PS: You are in the wrong thread. This thread is about responding to system events, not about trying to manufacture them. If you can't find a thread about your subject here, start your own, they are cheap here. Last edited by knc1; 06-02-2013 at 09:02 AM.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#15 | 
| 
			
			
			
			 Member 
			
			![]() Posts: 17 
				Karma: 10 
				Join Date: May 2013 
				
				
				
				Device: PaperWhite 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			1) Yes, and that's how I want to use it 
		
	
		
		
		
		
		
		
		
		
		
		
	
	2) These scripts are called by the eventHandler (that's why I posted a reply instead of create a new thread) 3) Ok, that's what I would like to know. That means there is no chance I succeed to came back from standby mode without an external intervention ? 4) I do not see why it's dangerous. I thought that I was only sending the same command that the system send by pressing the physical button.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
            
        
            
| Tags | 
| events, k5 tools, kindle, kite, screensaver | 
| Thread Tools | Search this Thread | 
            
  | 
    
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| is it possible to run k5 launchpad scripts on k5 | techiemonkey | Kindle Developer's Corner | 3 | 07-30-2012 10:10 AM | 
| Kite on K3G launches scripts randomly on boot or unplug | jmseight | Kindle Developer's Corner | 0 | 03-23-2012 02:55 PM | 
| Kindle tries to run C/++ applications like sh scripts? | dnR | Kindle Developer's Corner | 1 | 01-09-2011 08:45 AM |