11-19-2012, 09:45 AM | #16 |
Guru
Posts: 608
Karma: 1588610
Join Date: Jan 2012
Device: Kindle Scribe
|
Co.cc is dead. Now at sudoforlunch.org. I havent yet uploaded the waf post. But do read the notice on the page
|
11-19-2012, 09:45 AM | #17 |
Guru
Posts: 608
Karma: 1588610
Join Date: Jan 2012
Device: Kindle Scribe
|
Ill also update the "bofficapi"
|
12-10-2012, 05:51 PM | #18 |
THE NOOB
Posts: 701
Karma: 1545649
Join Date: Jan 2012
Location: Italy
Device: Kindle Touch 5.3.2
|
I may have found a rough way to run custom shell script from inside a WAF.
It actually works (I tried a simple script with touch foo.txt and a more complex one), but I still need to check if there are bugs or problems.. |
12-11-2012, 12:00 PM | #19 |
THE NOOB
Posts: 701
Karma: 1545649
Join Date: Jan 2012
Location: Italy
Device: Kindle Touch 5.3.2
|
How to run custom script from inside a WAF
This work is based on eventHandler by dos1. The starting point is: - we need to send an input from inside the WAF - this input needs to be catched by something ouside the WAF As regards the first point, we could use the sendEvent property by com.lab126.system. We used something similar some times ago to take a screenshot from inside a WAF. So, this time, it's quite the same. Let's place this in the config.xml file: Code:
<kindle:messaging> <kindle:app name="com.lab126.system" value="yes"/> </kindle:messaging> Code:
kindle.messaging.sendMessage('com.lab126.system', 'sendEvent', 'YOUR_EVENT_NAME');
If you use Code:
showlog -f Now it's time to catch the event. I altered dos1's script a bit and I called this eventlauncher.sh Code:
lipc-wait-event -m com.lab126.system YOUR_EVENTS_NAME | while read event; do if [[ "$event" == "YOUR_EVENTS_NAME" ]]; then PATH_TO_YOUR_SCRIPT & fi done; Last thing is make eventlauncher.sh running every time you run your WAF. Create a new upstart script like this: Code:
# start script for upstart
start on started lab126
stop on stopping lab126
export LANG LC_ALL
respawn
exec PATH_TO_YOUR_EVENTLAUNCHER_SCRIPT/eventlauncher.sh
This way the eventlauncher.sh script is automatically executed at startup and stays active to catch your events. Please note that playing around in upstart folder is potentially dangerous! Last edited by silver18; 12-14-2012 at 11:09 AM. |
12-11-2012, 02:40 PM | #20 |
THE NOOB
Posts: 701
Karma: 1545649
Join Date: Jan 2012
Location: Italy
Device: Kindle Touch 5.3.2
|
EDIT
I solved the framework problem by using an upstart script to run my eventlauncher.sh script. This proved to work really fine. I'm using about 5 differents events for Komic and I'm planning to use more! On the other hand, I'm working on the dual problem: send an event from a custom script and catch it inside a WAF. If I manage to do this, we can finally have a full working "communication service" to/from WAFs. Last edited by silver18; 12-14-2012 at 11:16 AM. |
12-14-2012, 03:56 PM | #21 |
THE NOOB
Posts: 701
Karma: 1545649
Join Date: Jan 2012
Location: Italy
Device: Kindle Touch 5.3.2
|
I edited last two posts to add the current solution!
|
12-19-2012, 10:31 AM | #22 |
THE NOOB
Posts: 701
Karma: 1545649
Join Date: Jan 2012
Location: Italy
Device: Kindle Touch 5.3.2
|
Although my last finding makes possible to run custom scripts from inside a WAF, we still have some problems...
The Kindle caches WAFs somewhere and this is a PITA as we can alter some JS files (add/remove variables....) but we can't affect the WAF itself. Does anybody knows where the Kindle caches WAF files? |
12-31-2012, 12:14 PM | #23 |
Guru
Posts: 608
Karma: 1588610
Join Date: Jan 2012
Device: Kindle Scribe
|
The guide is coming. This time, the guide will include all the features covered on this thread, and the whole "bofficapi" (I will change that name) will on git.
|
01-22-2013, 04:36 AM | #24 |
THE NOOB
Posts: 701
Karma: 1545649
Join Date: Jan 2012
Location: Italy
Device: Kindle Touch 5.3.2
|
Some news from 5.3.2 firmware...
WAFs are now called mesquite. From what I've seen in ten minutes, Amazon seems to want to give more power to mesquites. They provide a debug tool for javascript, a sort of sandbox for the browser to execute applications and a lot of new linkings between mesquites and the rest of the OS. Probably they broke something we used (pinch to zoom and similar things are done in a different way), but they made everything faster. We just need to study what's new and use it! PS They didn't broke the script launcher based on sending events!!! |
01-28-2013, 05:05 AM | #25 |
THE NOOB
Posts: 701
Karma: 1545649
Join Date: Jan 2012
Location: Italy
Device: Kindle Touch 5.3.2
|
Thanks to eureka, we finally came up with a full "communication service" between WAF and the rest of the system.
We can now run a custom script from inside a WAF and then let the WAF wait for a reply. The reply can also contain variables, messages or anything else. We can use this to avoid using eips, to create a nice GUI for shell scripts or to provide user interaction during the execution of a script. I finally found also a way to trigger the cache refresh so that we can update WAF's file and make the WAF load them without restarting it (this really was a simple thing!!). I'm still looking for a way to refresh the localStorage cache... Everything will be documented asap! |
02-01-2013, 03:38 PM | #26 |
Junior Member
Posts: 1
Karma: 11110
Join Date: Feb 2013
Device: Kindle Papaerwhite
|
I'm very excited to read your results. I read over your posts a few days ago but was confused. After hours of investigation I discovered eips and made it work with xev, although I never worked out how to catch the click so it wouldn't affect the underlying page. For some reason (xtestlab126 -d) gave me poor results. I wanted to use WebReaderViewer but it's javascript is very limited, however using it for drawing seems better than eips -- for whole pages. Add xev for detecting coords and I got everything working. Such a PITA. Now I'll wait to see what you've come up with before I continue.
My main goal is to allow the user to email notes, clips, and entire books to himself or others. I've already got shell scripts that work that I can run from cron or a background process but it's very ugly. Your solution should solve most of my problems. |
03-09-2013, 02:34 PM | #27 |
Member
Posts: 14
Karma: 5554
Join Date: Sep 2011
Device: Kindle
|
How are things going with documentation? Even if full autoupdate isn't well polished yet, It'd be great if you could post some preliminary stuff if you could. I'm eager to get a couple scripts (for text to speech and audio playing) working from a web UI.
I'm eagerly awaiting your findings |
03-09-2013, 02:41 PM | #28 | |
THE NOOB
Posts: 701
Karma: 1545649
Join Date: Jan 2012
Location: Italy
Device: Kindle Touch 5.3.2
|
Quote:
I'm sorry but I'm a bit busy ATM (thesis....) As regards the full update, if you want to reload all your external JS, html, images and similar, you just need to use the plain JS bit: Code:
window.location.reload(true) If you need something about the communication system, you need to wait a little more as this is a bit more complicated. Let me know if you need something else! |
|
03-09-2013, 02:47 PM | #29 |
Member
Posts: 14
Karma: 5554
Join Date: Sep 2011
Device: Kindle
|
Apologies, I meant the ability to call out to actual shell scripts to trigger behavior (not worried about reloading). Something like:
"aplay success.wav" that you could do before waf-shell stuff got locked down in one of the 5.X releases. |
03-09-2013, 02:49 PM | #30 |
Member
Posts: 14
Karma: 5554
Join Date: Sep 2011
Device: Kindle
|
(if your post from 12-11-2012 is still the most recent best-practice, I'll use that, just wasn't sure if you'd refined the process)
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Classic Nook on screen hints? | Hellmark | Barnes & Noble NOOK | 4 | 08-12-2011 08:54 AM |
Tips, Tricks, and Hints | Nate the great | Amazon Kindle | 44 | 03-22-2011 04:15 AM |
The Times hints at release of new Kindle | Grumpyreader | News | 0 | 06-04-2010 12:36 PM |
Q7 - v3.0 firmware - Hints and Tricks | rogue_ronin | Alternative Devices | 8 | 06-30-2009 02:59 PM |
Any hints on first software update? | Leaping Gnome | Sony Reader | 32 | 12-07-2006 10:22 AM |