View Single Post
Old 11-05-2012, 09:13 AM   #37
KevinShort
Addict
KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.
 
KevinShort's Avatar
 
Posts: 348
Karma: 209937
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
Quote:
Originally Posted by neonpolaris View Post
Fantastic work, I was able to get the weather display working on my kobo wifi easily! I''m now working on making it display some custom data of my own. How did you edit the python file during development? vi is such a pain to use, is there some easy way to get nano (or similar) running on the device?
Since the script uses pygame, I wrote and ran the code on my computer before putting it
on my Wifi. But if you'd still like to have nano on your Kobo, you could try downloading
and extracting this debian package to your Wifi.

Quote:
Originally Posted by jkgeyti View Post
Would it be possible to make the home button restart the Kobo? This way, I can add a link in ikarus9999's plugin to the weather-app, make it kill nickel and run, and still be able to "get back" to nickel by restarting the device using the home button. It's kind of a hassle that you have to telnet into the device to reboot it now.
Absolutely. I've set up something similar on my Wifi so I can start or stop nickel and
the weather display by pressing the back and home keys at the same time.

The easiest way to do this would probably be to start a "listener" script when you start
the weather display. Here's a python script that waits for the home button to be pressed
and then restarts the device:
Code:
import struct
from subprocess import call

buttons = open("/dev/input/event0")
format = "iihhi"
key_event = buttons.read(16)

running = 1

while running:
        
    (key_time1, key_time2, key_type, key_code, key_value) = struct.unpack(format, key_event)

    # Home button.
    if key_code == 102:
        if key_value == 1:
            print "Home button pressed"
            # Restart the device.
            call(["/bin/busybox", "reboot"])
            
    key_event = buttons.read(16)
Then all you have to do is point the plugin at a script that starts both the listener and the
weather display:
Code:
#!/bin/sh
killall nickel
cd /mnt/onboard/.apps/koboWeather
python listener.py &
./autoupdate.sh 
python weather.py

Last edited by KevinShort; 11-05-2012 at 11:37 AM. Reason: updated script
KevinShort is offline   Reply With Quote