Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 10-19-2012, 08:05 PM   #1
KevinShort
Addict
KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.
 
KevinShort's Avatar
 
Posts: 338
Karma: 165069
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
Kobo Weather Forecast - for Wifi and Touch

This project was inspired by Matthew Petroff's Kindle weather display

Update: I've changed the script to work on Kobos with a 4-bit framebuffer, as well as on 8-bit framebuffers.

Update 2: The script now uses worldweatheronline.com to get the weather forecast, so it's not limited to the US anymore.

Update 3: If you have a Kobo Touch, see this post for directions on getting this app working on your Touch.

Now that I can draw to the Kobo Wifi's screen, I just had to create something ASAP.

Presenting, the Kobo Weather Forecast!



How to install
The first step of installing is to Enable telnet access to your Wifi.

After that's done, download the weather forecast installer and copy it to the .kobo folder on your Wifi. Eject your Wifi from your computer and wait for your Wifi to install the package. It'll take a couple of minutes.

Once your Wifi has finished installing and has rebooted, telnet in to your Wifi
Code:
telnet YOUR_KOBO_IP
Now, through telnet, run the command:
Code:
/mnt/onboard/.python/install-python.sh
This sets up python and pygame. Now you can use the weather forecast! just run:
Code:
/mnt/onboard/.python/weather.sh
On the first time you start the app, it will ask you for your latitude and longitude so it can get weather info for your area. After that, you should see the weather forecast on your Wifi!

By default, it does not automatically update every hour. If you want it to auto-update, run the following command:
Code:
/mnt/onboard/.apps/koboWeather/autoupdate.sh
If you would like the temperature to display in Celsius, just change the "F" in the file "unit.txt" to a "C". If you connect your Kobo to your computer, you can find unit.txt in ".apps/koboWeather". Or you can edit it through telnet:
Code:
echo C > /mnt/onboard/.apps/koboWeather/unit.txt
Enjoy!
Attached Thumbnails
Click image for larger version

Name:	KoboWifiWeatherSmall.png
Views:	15013
Size:	768.0 KB
ID:	94495  

Last edited by KevinShort; 12-15-2012 at 09:03 AM.
KevinShort is offline   Reply With Quote
Old 10-20-2012, 09:45 AM   #2
Nate the great
Sir Penguin of Edinburgh
Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.Nate the great ought to be getting tired of karma fortunes by now.
 
Nate the great's Avatar
 
Posts: 10,373
Karma: 3161371
Join Date: Apr 2007
Location: DC Metro area
Device: Shake a stick plus 1
Cool!
Nate the great is offline   Reply With Quote
Old 10-21-2012, 10:59 PM   #3
donhamilton
Junior Member
donhamilton began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Oct 2012
Device: Kobo
Will this hack work with the Kobo Touch device ?
donhamilton is offline   Reply With Quote
Old 10-22-2012, 06:06 AM   #4
ghalfacree
Junior Member
ghalfacree began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Oct 2012
Device: Sony PRS-505 and Kobo WiFi
I can't seem to get it to work on my UK Kobo WiFi with 1.9.10 firmware. I've rooted it, enabled telnet, installed Python and pygame, but when I come to run the script I get the following error:

Kobo Wifi weather forecast started.
Getting weather information . . .
Drawing to the screen . . .
Traceback (most recent call last):
File "weather.py", line 346, in <module>
get_weather_data()
File "weather.py", line 93, in get_weather_data
display(days, highs, lows, conditions, img_links)
File "weather.py", line 100, in display
pygame.display.init()
pygame.error: Unsupported console hardware

A quick search tells me that "echo 1 > /sys/class/graphics/fb0/rotate" should fix it - but it doesn't. I can echo as much as I like to that file, but pygame still errors out.

Any idea what I'm doing wrong?
ghalfacree is offline   Reply With Quote
Old 10-22-2012, 08:23 AM   #5
murg
No Comment
murg ought to be getting tired of karma fortunes by now.murg ought to be getting tired of karma fortunes by now.murg ought to be getting tired of karma fortunes by now.murg ought to be getting tired of karma fortunes by now.murg ought to be getting tired of karma fortunes by now.murg ought to be getting tired of karma fortunes by now.murg ought to be getting tired of karma fortunes by now.murg ought to be getting tired of karma fortunes by now.murg ought to be getting tired of karma fortunes by now.murg ought to be getting tired of karma fortunes by now.murg ought to be getting tired of karma fortunes by now.
 
Posts: 1,176
Karma: 1790868
Join Date: Jan 2012
Location: Australia
Device: Kobo: Not just an eReader, it's an adventure!
Quote:
Originally Posted by ghalfacree View Post
echo 1 > /sys/class/graphics/fb0/rotate
I have a vague recollection of this from way back...

If what I'm not really remembering is correct, there is a parameter for the rotate. Or it could be a completely different thing.
murg is offline   Reply With Quote
Old 10-22-2012, 09:10 AM   #6
lst
Junior Member
lst began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Oct 2012
Device: kobo wifi
I have the same problem as ghalfacree on the same firmware.

If you look at weather.sh you can see it already does echo 1 > /sys/class/graphics/fb0/rotate

So that's not going to fix it.

I'm going to be so impressed if someone can fix this - the example weather app is very neat, but the whole idea of being able to write Python apps for the kobo is absolutely amazing, so cheers Kevin for work so far.
lst is offline   Reply With Quote
Old 10-22-2012, 09:50 AM   #7
KevinShort
Addict
KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.
 
KevinShort's Avatar
 
Posts: 338
Karma: 165069
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
Quote:
Originally Posted by donhamilton View Post
Will this hack work with the Kobo Touch device ?
I'm not sure if it will work right out of the box, but it could definitely be made to work.
You could go ahead and try to run it as-is on the Touch. I'm just not sure if the Touch's
e-ink display will allow updating the screen in the same way as the Wifi

Quote:
Originally Posted by ghalfacree View Post
A quick search tells me that "echo 1 > /sys/class/graphics/fb0/rotate" should fix it - but it doesn't. I can echo as much as I like to that file, but pygame still errors out.

Any idea what I'm doing wrong?
Since I don't know why it works on my Wifi, I'm not sure why it doesn't work on yours.
After a reboot, what is in the rotate file? Mine contains a single zero.
Code:
cat /sys/class/graphics/fb0/rotate
What does the "fbset" command output?

My US Kobo Wifi is running firmware 1.9 (r25373), from March 29, 2011.

Last edited by KevinShort; 10-22-2012 at 10:04 AM.
KevinShort is offline   Reply With Quote
Old 10-22-2012, 10:13 AM   #8
lst
Junior Member
lst began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Oct 2012
Device: kobo wifi
This is after a reboot... looks like at least the rotate file is the same...

Quote:
Originally Posted by KevinShort View Post
After a reboot, what is in the rotate file? Mine contains a single zero.
What does the "fbset" command output?
[root@(none) /]# cat /sys/class/graphics/fb0/rotate
0
[root@(none) /]# fbset

mode "600x800-0"
# D: 0.038 MHz, H: 0.063 kHz, V: 0.079 Hz
geometry 600 800 600 800 4
timings 26400000 0 0 0 0 0 0
accel false
rgba 4/0,4/0,4/0,0/0
endmode
lst is offline   Reply With Quote
Old 10-22-2012, 01:02 PM   #9
KevinShort
Addict
KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.
 
KevinShort's Avatar
 
Posts: 338
Karma: 165069
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
Quote:
Originally Posted by lst View Post
[root@(none) /]# fbset

mode "600x800-0"
# D: 0.038 MHz, H: 0.063 kHz, V: 0.079 Hz
geometry 600 800 600 800 4
timings 26400000 0 0 0 0 0 0
accel false
rgba 4/0,4/0,4/0,0/0
endmode
Your Wifi's framebuffer seems to have a 4-bit depth, while mine is 8-bit.
Here's my fbset output:
Code:
[root@(none) /]# fbset

mode "600x800-0"
        # D: 0.038 MHz, H: 0.063 kHz, V: 0.079 Hz
        geometry 600 800 600 800 8
        timings 26400000 0 0 0 0 0 0
        accel false
        rgba 8/0,8/0,8/0,0/0
endmode
I remember seeing over in the Kindle dev forum that some kindles were 4-bit while
others were 8-bit. Maybe I can grab some code from over there and see how they
deal with it. . .
KevinShort is offline   Reply With Quote
Old 10-22-2012, 03:10 PM   #10
atomney
Junior Member
atomney began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Oct 2012
Device: Kobo Touch
Just tried it out on the Kobo Touch

So I had previously rooted my kobo touch specifically to serve this function after reading about the kindle hack. My old way of doing this was with some scripts on my media server that would generate a correctly formatted .raw file and push it to my kobo touch's screen. Your way seems way more streamlined so I decided to give it a try.

I manually pushed the ".apps" and ".python" to their respective places in "/mnt/onboard/" and ran the script you provided for installing python. This all worked great until I tried running the weather script, it gets through asking for my lat and long and grabbing weather data.. then it dies at:

Code:
[root@(none) koboWeather]# python weather.py
Kobo Wifi weather forecast started.
Getting weather information . . .
Drawing to the screen . . .
init kbd.
init mouse failed.
Traceback (most recent call last):
  File "weather.py", line 346, in <module>
    get_weather_data()
  File "weather.py", line 93, in get_weather_data
    display(days, highs, lows, conditions, img_links)
  File "weather.py", line 111, in display
    tiny_font = pygame.font.Font("Cabin-Regular.ttf", 18)
RuntimeError: Couldn't load font file
Any ideas?

## Edit
So I poked around a bit more and realized I don't have a "mouse" binary. The Kobo touch uses a binary called "pickle" to write to the screen. I guess I'll have to poke at it a while and see where I get.

Last edited by atomney; 10-22-2012 at 03:16 PM. Reason: I found out more information
atomney is offline   Reply With Quote
Old 10-22-2012, 03:34 PM   #11
KevinShort
Addict
KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.
 
KevinShort's Avatar
 
Posts: 338
Karma: 165069
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
Quote:
Originally Posted by atomney View Post
Code:
[root@(none) koboWeather]# python weather.py
Kobo Wifi weather forecast started.
Getting weather information . . .
Drawing to the screen . . .
init kbd.
init mouse failed.
Traceback (most recent call last):
  File "weather.py", line 346, in <module>
    get_weather_data()
  File "weather.py", line 93, in get_weather_data
    display(days, highs, lows, conditions, img_links)
  File "weather.py", line 111, in display
    tiny_font = pygame.font.Font("Cabin-Regular.ttf", 18)
RuntimeError: Couldn't load font file
Any ideas?

## Edit
So I poked around a bit more and realized I don't have a "mouse" binary. The Kobo touch uses a binary called "pickle" to write to the screen. I guess I'll have to poke at it a while and see where I get.
The "init mouse failed" error is perfectly normal, because the Kobo doesn't have a mouse input,
and it doesn't prevent the app from continuing to run.

The Wifi and Touch both use pickel to display images. (Though I have been able to drive
the Touch's screen directly, see my Tetris port)

From the error you posted, the script hasn't even gotten to drawing anything yet, but is
trying and failing to load a font file. Did you double-check that the font file "Cabin-Regular.ttf"
was in the same directory as the "weather.py" script?

Last edited by KevinShort; 10-22-2012 at 03:40 PM.
KevinShort is offline   Reply With Quote
Old 10-22-2012, 05:04 PM   #12
lst
Junior Member
lst began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Oct 2012
Device: kobo wifi
Quote:
Originally Posted by KevinShort View Post
I remember seeing over in the Kindle dev forum that some kindles were 4-bit while
others were 8-bit. Maybe I can grab some code from over there and see how they
deal with it. . .
Looks like some of them have a 8bpp interface to 4bpp hardware, with the top and bottom 4 being the same.

I'm **way** out of my depth here (decent on Python but embedded Linux - ) but if there's any way I can help sort this for those of us with these devices let me know.

Out of interest, I saw the weather app makes a call to update the e-ink after the final pygame call - but did pygame itself need modifying to talk to a / the Kobo's framebuffer?

Edit: looks like there's more detail on the kindle buffers here.

Last edited by lst; 10-22-2012 at 05:06 PM. Reason: added link
lst is offline   Reply With Quote
Old 10-22-2012, 08:57 PM   #13
KevinShort
Addict
KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.
 
KevinShort's Avatar
 
Posts: 338
Karma: 165069
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
Quote:
Originally Posted by lst View Post
Looks like some of them have a 8bpp interface to 4bpp hardware, with the top and bottom 4 being the same.

I'm **way** out of my depth here (decent on Python but embedded Linux - ) but if there's any way I can help sort this for those of us with these devices let me know.

Edit: looks like there's more detail on the kindle buffers here.
Thanks for the links, I'll take a look at them tomorrow. Saves me some time having to search for them.

And I have absolutely no experience with embedded Linux myself outside of my Kobo work.
I'm just a high school student who likes to fiddle with stuff.

Quote:
Originally Posted by lst View Post
Out of interest, I saw the weather app makes a call to update the e-ink after the final pygame call - but did pygame itself need modifying to talk to a / the Kobo's framebuffer?
Nope, I didn't modify pygame at all. It already has support for framebuffers, so getting
it to work was just a matter of compiling python and pygame in a virtual machine for ARM.
KevinShort is offline   Reply With Quote
Old 10-23-2012, 02:04 PM   #14
KevinShort
Addict
KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.
 
KevinShort's Avatar
 
Posts: 338
Karma: 165069
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
I've found out that pygame doesn't support any bit depth less than 8.

Could someone with a 4-bit Wifi try these commands after a fresh reboot and post the output?
Code:
[root@(none) /]# cat /dev/urandom > /dev/fb0 
cat: write error: No such device
[root@(none) /]# echo 1 > /sys/class/graphics/fb0/rotate 
[root@(none) /]# cat /dev/urandom > /dev/fb0 
cat: write error: No space left on device
And then try updating the e-ink display, either with /mnt/onboard/.python/eink_update.sh, or with:
Code:
cat /dev/fb0 > /tmp/fb
cat /tmp/fb | /usr/local/Kobo/pickel showpic
After these commands, is your Wifi's screen filled with random noise?
KevinShort is offline   Reply With Quote
Old 10-23-2012, 06:06 PM   #15
lst
Junior Member
lst began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Oct 2012
Device: kobo wifi
Quote:
Originally Posted by KevinShort View Post
Could someone with a 4-bit Wifi try these commands after a fresh reboot and post the output?
Here's mine, direcltly after a reboot:
Code:
[root@(none) /]# cat /dev/urandom > /dev/fb0
cat: write error: No space left on device
[root@(none) /]# echo 1 > /sys/class/graphics/fb0/rotate
[root@(none) /]# cat /dev/urandom > /dev/fb0
cat: write error: No space left on device
[root@(none) /]# /mnt/onboard/.python/eink_update.sh
2048+0 records in
2048+0 records out
1048576 bytes (1.0MB) copied, 0.018657 seconds, 53.6MB/s
So it doesn't look like changing rotate did anything, **however** I did get a screen full of random noise, which is sort of encouraging.

Just to confirm I hadn't somehow changed stuff earlier, after this I rebooted again and got:
Code:
[root@(none) /]# cat /sys/class/graphics/fb0/rotate
0
and directly after this you can still write random data to fb0 and have it display OK.

Last edited by lst; 10-23-2012 at 06:09 PM.
lst is offline   Reply With Quote
Reply

Tags
hacking, kobo wifi

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Odd; Kobo-purchased book reads fine on Desktop, WiFi and Sony -but not on Kobo Touch. beautifulsoup Kobo Reader 4 07-17-2012 09:29 AM
Kobo Touch in cold weather Judsuw General Discussions 15 06-02-2012 06:23 PM
Sync epubs between Kobo app and Kobo wifi? emilikins Kobo Reader 1 11-17-2011 04:12 PM
Kobo Desktop App v1.7 onboard Kobo WiFi ZombWii Kobo Reader 6 10-20-2010 12:24 PM
Forrester upgrades sales forecast by 50% xoox News 0 10-10-2009 04:11 AM


All times are GMT -4. The time now is 01:26 PM.


MobileRead.com is a privately owned, operated and funded community.