Success! I have been able to modify browser.sh so that turning the encoder (volume control) "a few" clicks will exit the browser and restart the control panel. Here's how I did it in 3 easy steps:
Step 1
Create a file called browserkill.sh in the same directory as your startbrowser or debugchumby script
#! /bin/ash
hexdump /dev/input/event2 -n 64 >/dev/null
kill $1
All this little script does is open the encoder device, wait for 64 bytes of data, and return. Redirecting the output to /dev/null throws out anything that hexdump decides to print (what its actually designed for). Once hexdump returns the script executes the kill command with the 1st command line argument. Now we have to modify browser.sh
Step 2
Modify browser.sh (or debugchumby or whatever your start browser script is) in the following manner:
locate the line near the bottom of the script that actually launches the browser
# Launch a browser (with chrome) starting at the address specified...
/mnt/storage/web/demos/browser/browser -qws 'http://www.chumby.com'
Directly above the line noted above add a new line with ./browserkill.sh $$ &
Next, add "exec " to the front of the browser launching line
# Launch a browser (with chrome) starting at the address specified...
./browserkill.sh $$ &
exec /mnt/storage/web/demos/browser/browser -qws 'http://www.chumby.com'
So here what we're doing is calling our browserkill script created in step 1, passing it the system variable $$ (which expands to the PID of the current process), and telling it to run in the background (the & sign at the end). Adding exec to the front of the browser line makes the browser replace the current process (the one that we gave to the browserkill script).
So at this point we have browserkill.sh running in the background (just waiting for input -- the encoder wheel), and the browser running normally. When you turn the encoder "a few" clicks the browserkill script will execute the kill command and the browser will shut down. So what to do next? ON TO STEP 3
STEP 3
Last modification. Wherever you call your browser.sh script (or whatever you called it), add ;start_control_panel or ;reboot to the end. So if your script is called browser.sh it will look like
browser.sh;start_control_panel
The semicolon just says "this is a new command" so its the same as typing it on two lines at the console. As soon as browser.sh exits (killed by our browserkill.sh process) the 2nd command will run. start_control_panel will be faster, but reboot will make sure that any memory leaks are cleaned up (since the unit is rebooting).
Hope this helps!
Scott