|
|||||||
![]() |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
20% cooler.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 92
Karma: 364266
Join Date: Oct 2012
Location: Poznań, Poland
Device: Kindle Paperwhite
|
eventHandler - easy way to run scripts on boot and screensaver on/off events
(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.
__________________
http://dosowisko.net/ | http://www.superderpy.com/ Debian on Kindle: http://www.mobileread.com/forums/sho....php?p=2289700 Last edited by dos1; 03-01-2013 at 06:20 PM. Reason: update to 0.2 |
|
|
|
|
|
#2 |
|
Horse
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,019
Karma: 7087247
Join Date: Apr 2012
Device: Kindle3G+WiFi
|
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. |
|
|
|
|
Enthusiast
|
|
|
|
#3 |
|
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 150
Karma: 511590
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: 5,143
Karma: 5329011
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|Ematic E6+E8|Rooted Nook Touch|NO K2!!
|
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!
__________________
Audiophile and electron bully. My tunes (for free) soundcloud.com/twobob. DONATE TO KUAL BY CLICKING THIS SIMPLE LINK Kung-Fu. Hard work over time to accomplish skill. A painter can have kung-fu... The musician can have kung-fu, or the poet who paints pictures with words and makes emperors weep. This, too, is kung-fu. Formless, nameless, the true master dwells within. Only you can free him. The album I'm headlining on at the moment: s.beatport.com/OCp9dT - FREE: 2012 Award winning set |
|
|
|
|
|
#5 | |
|
20% cooler.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 92
Karma: 364266
Join Date: Oct 2012
Location: Poznań, Poland
Device: Kindle Paperwhite
|
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)
__________________
http://dosowisko.net/ | http://www.superderpy.com/ Debian on Kindle: http://www.mobileread.com/forums/sho....php?p=2289700 |
|
|
|
|
|
|
#6 |
|
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 150
Karma: 511590
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: 92
Karma: 364266
Join Date: Oct 2012
Location: Poznań, Poland
Device: Kindle Paperwhite
|
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.
__________________
http://dosowisko.net/ | http://www.superderpy.com/ Debian on Kindle: http://www.mobileread.com/forums/sho....php?p=2289700 |
|
|
|
|
|
#8 |
|
20% cooler.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 92
Karma: 364266
Join Date: Oct 2012
Location: Poznań, Poland
Device: Kindle Paperwhite
|
0.2 version is now up - I've fixed a bug which prevented scripts from being launched when using magnetic cover. Enjoy!
__________________
http://dosowisko.net/ | http://www.superderpy.com/ Debian on Kindle: http://www.mobileread.com/forums/sho....php?p=2289700 |
|
|
|
|
|
#9 |
|
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,143
Karma: 5329011
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|Ematic E6+E8|Rooted Nook Touch|NO K2!!
|
ROCK HANDS!!!
__________________
Audiophile and electron bully. My tunes (for free) soundcloud.com/twobob. DONATE TO KUAL BY CLICKING THIS SIMPLE LINK Kung-Fu. Hard work over time to accomplish skill. A painter can have kung-fu... The musician can have kung-fu, or the poet who paints pictures with words and makes emperors weep. This, too, is kung-fu. Formless, nameless, the true master dwells within. Only you can free him. The album I'm headlining on at the moment: s.beatport.com/OCp9dT - FREE: 2012 Award winning set |
|
|
|
|
|
#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 http://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,446
Karma: 1378565
Join Date: Mar 2011
Location: Türkiye
Device: Kindle 5.3.2.1
|
|
|
|
|
|
|
#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 |
|
Embedded Cheerleader
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,251
Karma: 3921779
Join Date: Feb 2012
Device: K0
|
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.
__________________
"Hack is just a four letter word." - - With apologies to B. Dylan Last edited by knc1; 06-02-2013 at 08: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 |
| K5 is it possible to run k5 launchpad scripts on k5 | techiemonkey | Kindle Developer's Corner | 3 | 07-30-2012 09:10 AM |
| Kite on K3G launches scripts randomly on boot or unplug | jmseight | Kindle Developer's Corner | 0 | 03-23-2012 01:55 PM |
| Kindle tries to run C/++ applications like sh scripts? | dnR | Kindle Developer's Corner | 1 | 01-09-2011 07:45 AM |