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 09-22-2011, 02:03 AM   #1
CdnBloodlust
Member
CdnBloodlust doesn't litterCdnBloodlust doesn't litter
 
Posts: 18
Karma: 120
Join Date: Sep 2011
Location: Edmonton, AB
Device: Kobo Touch
Kobo Touch Telnet Images

Just wanted to share my notes with everyone on how the kobo touch displays images and the conversion process. I've also created a custom boot animation if anyone's interested.

Code:
############################################################################################################

# raw to png

input=reboot.raw
output=output.png

ffmpeg -f rawvideo -pix_fmt rgb565 -s 800x600 -i <(head -c 960000 "$input") \
-vf transpose=1 -y "$output" < /dev/null

############################################################################################################

# png to raw

# note the extra.raw is to create an image just like the ones found in /etc/images. It's unkonwn to me if the extra bytes are needed but I add them just incase.

zcat ghostbuster.raw.gz | tail -c +960001 > extra.raw

input=on-0.png
output=testing.raw

ffmpeg -i "$input" \
-vf transpose=2 -f rawvideo -pix_fmt rgb565 -s 600x800 -y "$output" < /dev/null

cat extra.raw >> "$output"

############################################################################################################

# ssh and telnet

printf "user root\nput testing.raw" | ftp -in 192.168.0.158
telnet 192.168.0.158
user root
cat testing.raw | /usr/local/Kobo/pickel showpic

############################################################################################################

# extract all default images

cd /home/foo/unsorted/kobo/kobocopy/etc/images

for input in *.raw.gz; do
ffmpeg -f rawvideo -pix_fmt rgb565 -s 800x600 -i <(zcat "$input" | head -c 960000) \
-vf transpose=1 -y "${input%%.*}.png" < /dev/null
done

############################################################################################################

# get extra leading information

cd /home/foo/unsorted/kobo/kobocopy/etc/images

for input in *.raw.gz; do
zcat "$input" | tail -c +960001 > "${input%%.*}-extra.bin"
done

for input in *extra.bin; do
diff -s on-5-extra.bin "$input"
done

############################################################################################################

# notes

In the default images there's extra information at the end of each image, and it's exactly the same for each image.
The extra bytes are 1.2 MB (1219072 bytes) of null bytes minus the 7 bytes listed below. Significance unknown, maybe a watermark?

...
00000FFC   00 00 00 00  00 00 00 00  00 00 00 00  01 00 00 00  00 40 21 00  00 00 00 00  00 00 00 00  00 40 21 00  00 40 21 00  00 00 00 00  00 00 00 00  .................@!..........@!..@!.........
...

# what is this?
/usr/local/Kobo/pickel disable.rtc.alarm

############################################################################################################
Custom Boot Animation.



Edit: Added More Images.

Last edited by CdnBloodlust; 09-22-2011 at 07:30 AM.
CdnBloodlust is offline   Reply With Quote
Old 09-22-2011, 04:01 AM   #2
rjcroy
Bibliophile
rjcroy ought to be getting tired of karma fortunes by now.rjcroy ought to be getting tired of karma fortunes by now.rjcroy ought to be getting tired of karma fortunes by now.rjcroy ought to be getting tired of karma fortunes by now.rjcroy ought to be getting tired of karma fortunes by now.rjcroy ought to be getting tired of karma fortunes by now.rjcroy ought to be getting tired of karma fortunes by now.rjcroy ought to be getting tired of karma fortunes by now.rjcroy ought to be getting tired of karma fortunes by now.rjcroy ought to be getting tired of karma fortunes by now.rjcroy ought to be getting tired of karma fortunes by now.
 
rjcroy's Avatar
 
Posts: 167
Karma: 1147338
Join Date: Jun 2010
Location: New Zealand
Device: Sony PRS-T3, Kobo Touch
Why, that's a very nice GNU you have there. Would be a shame if something happened to it
rjcroy is offline   Reply With Quote
Old 09-22-2011, 05:04 AM   #3
CdnBloodlust
Member
CdnBloodlust doesn't litterCdnBloodlust doesn't litter
 
Posts: 18
Karma: 120
Join Date: Sep 2011
Location: Edmonton, AB
Device: Kobo Touch
What's cuter tux or gnu? Maybe should've made it tux.

Code for how the custom animation was created. Thanks to the people who documented the process of setting up telnet etc and kobo devs for not locking down the device.

Code:
# files not included that need to be generated or whatever

/home/foo/animation/gnu.png
/home/foo/extra.raw

# create png from the svg template

rsvg <(printf "$(cat on-template.svg)" a a a a a) custom/on-$((i++)).png
rsvg <(printf "$(cat on-template.svg)" b a a a a) custom/on-$((i++)).png
rsvg <(printf "$(cat on-template.svg)" c b a a a) custom/on-$((i++)).png
rsvg <(printf "$(cat on-template.svg)" c c b a a) custom/on-$((i++)).png
rsvg <(printf "$(cat on-template.svg)" c c c b a) custom/on-$((i++)).png
rsvg <(printf "$(cat on-template.svg)" c c c c b) custom/on-$((i++)).png
rsvg <(printf "$(cat on-template.svg)" c c c c c) custom/on-$((i++)).png
rsvg <(printf "$(cat on-template.svg)" a c c c c) custom/on-$((i++)).png
rsvg <(printf "$(cat on-template.svg)" a a c c c) custom/on-$((i++)).png
rsvg <(printf "$(cat on-template.svg)" a a a c c) custom/on-$((i++)).png
rsvg <(printf "$(cat on-template.svg)" a a a a c) custom/on-$((i++)).png

# convert the generated png to raw gziped images

cd custom
for input in on-*.png; do
output=${input%.*}.raw
ffmpeg -i "$input" \
-vf transpose=2 -f rawvideo -pix_fmt rgb565 -s 600x800 -y "$output" < /dev/null
cat "$output" /home/foo/extra.raw | gzip -c > "$output.gz"
done

# create gif animation
convert on-{0..10}.png -delay 25 test-25.gif

# file on-template.svg
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="600" height="800">
	<defs>
		<rect id="a" x="4.5" y="4.5" fill="none" stroke="black" stroke-width="1" width="17" height="17"/>
		<rect id="b" width="26" height="26"/>
		<rect id="c" x="4" y="4" fill="black" width="18" height="18"/>
	</defs>
	<rect fill="white" width="600" height="800"/>
	<image x="177" y="177" width="246" height="240" xlink:href="/home/foo/animation/gnu.png"/>
	<g transform="translate(211, 468)">
		<use xlink:href="#%s" transform="translate(0)"/>
		<use xlink:href="#%s" transform="translate(38)"/>
		<use xlink:href="#%s" transform="translate(76)"/>
		<use xlink:href="#%s" transform="translate(114)"/>
		<use xlink:href="#%s" transform="translate(152)"/>
	</g>
</svg>
I've been looking for a way to emulate the server so when you press the sync button on the kobo touch it'll go to my custom perl server script and download ebooks from my computer rather than kobo. I don't know if I'll release the code on that since I don't want kobo to lock down the device.

Anyways I'm having mixed results so far lots of trial and error.
CdnBloodlust is offline   Reply With Quote
Old 09-22-2011, 08:57 AM   #4
Latch
Porcupine Tree fan
Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.
 
Latch's Avatar
 
Posts: 139
Karma: 357322
Join Date: Sep 2011
Location: Ottawa, Canada
Device: Kobo Touch
Very cool. Stay with Tux; nobody really knows what GNU is (hint: it's not Unix )
Latch is offline   Reply With Quote
Old 09-22-2011, 10:15 AM   #5
CdnBloodlust
Member
CdnBloodlust doesn't litterCdnBloodlust doesn't litter
 
Posts: 18
Karma: 120
Join Date: Sep 2011
Location: Edmonton, AB
Device: Kobo Touch
Thank you.

So much stuff I could post but I don't wanna spam this forums. Look how the kobo touch communicates with the kobo servers for ebooks. Here's one example which isn't filled out (I've seen what the filled out request looks like too).

Code:
<?xml version="1.0" encoding="UTF-8"?>
<KEpubRequest xmlns="http://kobobooks.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://kobobooks.com Requests.xsd">
	<RequestHeader>
		<UserID>%1</UserID>
		<UserKey>%2</UserKey>
	</RequestHeader>
	<RequestBody>
		<ContentType>6</ContentType>
		<ContentID>%3</ContentID>
		<EPubPlatform>%4</EPubPlatform>
		<NeedUserInfo>%5</NeedUserInfo>
		<NeedDownloadURLs>%6</NeedDownloadURLs>
	</RequestBody>
</KEpubRequest>
This is obviously a template which needs to be filled out. Strange the format with a percent sign and a number, I know I've seen %s before but not %1 and %2. What's that from? I would love to get my hands on the pickel source, it would probably have to be without a lot of the adobe stuff. Maybe one day.
CdnBloodlust is offline   Reply With Quote
Old 09-22-2011, 10:38 AM   #6
Latch
Porcupine Tree fan
Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.Latch ought to be getting tired of karma fortunes by now.
 
Latch's Avatar
 
Posts: 139
Karma: 357322
Join Date: Sep 2011
Location: Ottawa, Canada
Device: Kobo Touch
Those look like passed parameters to me, or global variables.
Latch is offline   Reply With Quote
Old 09-22-2011, 12:21 PM   #7
Pistos
Connoisseur
Pistos could sell banana peel slippers to a Deveel.Pistos could sell banana peel slippers to a Deveel.Pistos could sell banana peel slippers to a Deveel.Pistos could sell banana peel slippers to a Deveel.Pistos could sell banana peel slippers to a Deveel.Pistos could sell banana peel slippers to a Deveel.Pistos could sell banana peel slippers to a Deveel.Pistos could sell banana peel slippers to a Deveel.Pistos could sell banana peel slippers to a Deveel.Pistos could sell banana peel slippers to a Deveel.Pistos could sell banana peel slippers to a Deveel.
 
Pistos's Avatar
 
Posts: 95
Karma: 3198
Join Date: Jul 2011
Location: Canada
Device: Kobo Touch
They probably made them numbered so that they'd be (hopefully) unique in the document, for (to them) easier search and replace. Maybe a full blown XML parser and manipulator would be too much for the small device.
Pistos is offline   Reply With Quote
Old 09-23-2011, 12:55 AM   #8
CdnBloodlust
Member
CdnBloodlust doesn't litterCdnBloodlust doesn't litter
 
Posts: 18
Karma: 120
Join Date: Sep 2011
Location: Edmonton, AB
Device: Kobo Touch
So have you guys been working on anything interesting for the touch? Or finding anything interesting?

Also something interesting you can see that when you convert the the default images from raw to png there's no pure white color in the image. Maybe it has a custom color palate or something? Don't know much about color palates tho, it never interested me. What you guys think? Should custom images also use that color palate or does it not really matter.

Edit: To answer my question about the %1 %2 thing it's part of the qt framework thing.

Code:
#include <QString>
#include <QtDebug>

int main() {
	qDebug() << QString("%1 test %2").arg("1", "2");
	qDebug() << QString("%1 test %2").arg("3").arg("4");
	return 0;
}
Code:
% ./test
"1 test 2" 
"3 test 4" 
%

Last edited by CdnBloodlust; 09-23-2011 at 06:16 AM.
CdnBloodlust is offline   Reply With Quote
Old 08-10-2012, 05:31 AM   #9
kalabala
Junior Member
kalabala began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jun 2012
Device: Kobo Touch
sorry mistake !

Last edited by kalabala; 08-10-2012 at 06:13 AM.
kalabala is offline   Reply With Quote
Reply

Tags
images, kobo, telnet, touch

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Rooted Nook Touch vs Kobo Touch? producerism Which one should I buy? 20 09-09-2011 10:10 PM
Kobo Touch vs Nook Simple Touch jbcohen Which one should I buy? 42 07-28-2011 06:38 PM
Kindle 3, Nook Simple Touch, Kobo Touch and Libra Pro Touch jbcohen Which one should I buy? 4 06-18-2011 07:58 PM
Own (and love) a PRS505: Is the Nook Touch or Kobo Touch right for me? rahulm Which one should I buy? 8 06-10-2011 01:51 PM
Pre-ordering Nook Simple Touch or Kobo Touch? SilentDuck Which one should I buy? 27 05-29-2011 05:27 PM


All times are GMT -4. The time now is 05:14 AM.


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