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

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 03-18-2011, 02:48 PM   #1
Xiaopangzi
Enthusiast
Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.
 
Posts: 29
Karma: 16912
Join Date: Mar 2011
Device: kindle k3, prs-t2
Lightbulb Web server, user interfaces

I'm attaching an arm binary executable of a tiny http server called bozohttpd (see http://www.eterna.com.au/bozohttpd/ for details), compiled with directory indexing and cgi support but without ssl support. I find this to be extremey handy to have on the kindle.

A possible quick-start would be to mkdir /mnt/us/www, put some content there, and start the server using bozohttpd -b -X /mnt/us/www (from the command prompt in an ssh session, from a launchpad ini, from /etc/rc...). For cgi support, mkdir /mnt/us/www/cgi-bin and add -c /mnt/us/www/cgi-bin to the options.

For example, I keep a web bookmarks file (same html-formatted file in /mnt/us/documents as .txt and in /mnt/us/www as .html) that allows access both from the kindle's home screen and bookmarked within the web browser.

If you want the web server to be accessible from the outside world, open port 80 in the kindle's firewall. Bind-mounting /mnt/us/documents somewhere under /mnt/us/www/ would allow you to share your books and other documents over wifi.

However, the most useful application of this appears to build user interfaces using cgi. At present, the options to launch and interact with applications beyond what the kindle framework itself allows are limited. Launchpad works fine for many applications, but sometimes a user interface going beyond blind keypresses is desirable. For example, a playlist of local audio files and remote streaming urls could be presented as a list of clickable links (static or generated on the fly by a local cgi script), launching mplayer with the right options (from the same or another local cgi script). Unlike for the blind keypress interface, there would be nothing wrong with having hundreds of audio files or streaming urls visually filling a few web pages.

Static html files with clickable links to launch or control local applications via cgi scripts could (in addition to an .html in /mnt/us/www) live in a .txt file on the kindle's home screen. Clicking a link will launch a cgi script that can perform any action and then generate html-formatted output as a response to be presented to the user in the kindle's web browser. Dynamically generated html content like on-the-fly playlists needs to be viewed inside the web browser. In all situations, wifi needs to be enabled.

The potential benefits of doing this look very promising to me. I'm not a web programmer and don't have any useful scripts at this time, but I invite the forum members to consider this technique and to expand on it. In particular, I would like to see a useable frontend for mplayer.
Attached Files
File Type: zip bozohttpd.zip (20.3 KB, 855 views)
Xiaopangzi is offline   Reply With Quote
Old 03-18-2011, 03:26 PM   #2
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,477
Karma: 26012492
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
In the same vein, the busybox binary bundled in the usbnet hack has the httpd applet built-in.
NiLuJe is offline   Reply With Quote
Old 03-18-2011, 04:50 PM   #3
PoP
 curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.
 
PoP's Avatar
 
Posts: 3,002
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
Quote:
Originally Posted by NiLuJe View Post
In the same vein, the busybox binary bundled in the usbnet hack has the httpd applet built-in.
Ah! Thanks NiLuJe.

Not to hijack the thread but it is the second time I get fooled by the busybox help output:
Code:
[root@kindle bin]# busybox
BusyBox v1.7.2 (2011-02-05 18:52:13 PST) multi-call binary
Copyright (C) 1998-2006 *Erik Andersen, Rob Landley, and others.
Licensed under GPLv2. *See source distribution for full notice.

Usage: busybox [function] [arguments]...
   or: [function] [arguments]...

        BusyBox is a multi-call binary that combines many common Unix
        utilities into a single executable.  Most people will create a
        link to busybox for each function they wish to use and BusyBox
        will act like whatever it was invoked as!

Currently defined functions:
        [, [[, addgroup, adduser, adjtimex, ash, awk, basename, bunzip2, bzcat, cat,
        chgrp, chmod, chown, chpasswd, chroot, clear, cmp, cp, crond, crontab, cut,
        date, dd, delgroup, deluser, df, dirname, dmesg, du, echo, env, expr, false,
        fbset, fdisk, fgrep, find, freeramdisk, getty, grep, gunzip, gzip, head, hexdump,
        hostname, hwclock, id, ifconfig, ifdown, ifup, install, ip, kill, killall,
        klogd, less, ln, logger, login, logname, losetup, ls, makedevs, md5sum, mkdir,
        mkfifo, mknod, mktemp, more, mv, nc, netstat, nice, nslookup, passwd, pidof,
        ping, pipe_progress, pivot_root, printf, pwd, rdate, readlink, realpath, renice,
        reset, rm, rmdir, route, run-parts, sed, seq, sh, sleep, sort, start-stop-daemon,
        stat, strings, stty, su, sync, tail, tar, tee, telnet, test, time, touch,
        tr, traceroute, true, tty, udhcpc, uname, uniq, unzip, uptime, usleep, vi,
        wc, wget, which, who, whoami, xargs, yes, zcat
The first time I was looking for a telnetd and now I was not looking for a httpd, while both are supported! I wonder what else?

Last edited by PoP; 03-18-2011 at 11:38 PM. Reason: correct typos
PoP is offline   Reply With Quote
Old 03-18-2011, 08:44 PM   #4
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,477
Karma: 26012492
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
Err, that's the output from the Kindle's busybox, not the one bundled in usbnet (which, FYI, only bundles the login, telnetd & httpd applets) ;o).

Last edited by NiLuJe; 03-18-2011 at 08:51 PM.
NiLuJe is offline   Reply With Quote
Old 03-18-2011, 11:36 PM   #5
PoP
 curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.
 
PoP's Avatar
 
Posts: 3,002
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
Confusion cleared:
Code:
[root@kindle root]# cd /mnt/us/usbnet/bin
[root@kindle bin]# ls
busybox         htop            rsync           usbnet-disable  usbnetwork
dropbearmulti   lsof            sftp-server     usbnet-enable
[root@kindle bin]# ./busybox
BusyBox v1.18.3 (2011-02-27 19:52:09 CET) multi-call binary.
Copyright (C) 1998-2009 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
See source distribution for full notice.

Usage: busybox [function] [arguments]...
   or: busybox --list[-full]
   or: function [arguments]...

        BusyBox is a multi-call binary that combines many common Unix
        utilities into a single executable.  Most people will create a
        link to busybox for each function they wish to use and BusyBox
        will act like whatever it was invoked as.

Currently defined functions:
        httpd, login, telnetd, who

[root@kindle bin]#
Thx again NiLuJe.
PoP is offline   Reply With Quote
Old 03-19-2011, 03:32 AM   #6
stasenko
Junior Member
stasenko began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Dec 2010
Device: Amazon Kindle
Please, describe how configurate httpd for external access to kindle.
stasenko is offline   Reply With Quote
Old 03-19-2011, 11:27 AM   #7
Xiaopangzi
Enthusiast
Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.
 
Posts: 29
Karma: 16912
Join Date: Mar 2011
Device: kindle k3, prs-t2
Quote:
Originally Posted by stasenko View Post
Please, describe how configurate httpd for external access to kindle.
Code:
iptables -A INPUT -i wlan0 -p tcp --dport www -j ACCEPT
Xiaopangzi is offline   Reply With Quote
Old 03-22-2011, 04:20 PM   #8
Xiaopangzi
Enthusiast
Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.
 
Posts: 29
Karma: 16912
Join Date: Mar 2011
Device: kindle k3, prs-t2
Smile

The following works to lauch mplayer streaming some URL by clicking it (from a list of such URLs in an .html or .txt file). It could use some improving, like including the useful part of mplayer's output (but no cache fill... etc).

Code:
#!/bin/sh

# This is file /mnt/us/www/cgi-bin/mplay
# call using (replace host/stream/Station):
# <a href="http://localhost/cgi-bin/mplay?http://host/stream">Station</a>

echo 'Content-type: text/plain'
echo ''

INSTALLDIR=/mnt/us/mplayer
NICENESS="-10"
FIFO=/tmp/mplayer.fifo
MPLAYER="nice -n$NICENESS $INSTALLDIR/mplayer -ao alsa -slave -quiet -input file=$FIFO"

test -z `pidof mplayer` || killall mplayer >/dev/null 2>&1
test -e $FIFO || mkfifo $FIFO

($MPLAYER -playlist "$1" >/dev/null 2>&1) &

echo "Now playing $1 ..."
Xiaopangzi is offline   Reply With Quote
Old 04-17-2011, 08:40 PM   #9
kranu
I <3 my Kindle
kranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensionskranu can understand the language of future parallel dimensions
 
Posts: 528
Karma: 51332
Join Date: Nov 2010
Location: United States
Device: Kindle 3G + WiFi
Hey,

I know this may be a little far-fetched, but is there a way to get PHP running with the busybox bundled with usbnet?
kranu is offline   Reply With Quote
Old 05-15-2011, 10:50 AM   #10
kapsi
Member
kapsi began at the beginning.
 
Posts: 22
Karma: 10
Join Date: May 2011
Device: Kindle 3
So is it possible to mirror a website, put it in /www and browse? Where should I put the bozo httpd executable on Kindle?
kapsi is offline   Reply With Quote
Old 05-15-2011, 11:09 AM   #11
Xiaopangzi
Enthusiast
Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.Xiaopangzi 's shirt has a full set of merit badges.
 
Posts: 29
Karma: 16912
Join Date: Mar 2011
Device: kindle k3, prs-t2
Quote:
Originally Posted by kapsi View Post
So is it possible to mirror a website, put it in /www and browse?
Yes.

Quote:
Where should I put the bozo httpd executable on Kindle?
You can put it anywhere you like.
Xiaopangzi is offline   Reply With Quote
Old 05-15-2011, 03:33 PM   #12
kapsi
Member
kapsi began at the beginning.
 
Posts: 22
Karma: 10
Join Date: May 2011
Device: Kindle 3
Quote:
Originally Posted by Xiaopangzi View Post
Yes.



You can put it anywhere you like.
How about browsing offline without being connected to internet? Is there a hack for this?
kapsi is offline   Reply With Quote
Old 07-16-2011, 02:42 PM   #13
space4
Member
space4 is a jewel in the roughspace4 is a jewel in the roughspace4 is a jewel in the roughspace4 is a jewel in the roughspace4 is a jewel in the roughspace4 is a jewel in the roughspace4 is a jewel in the roughspace4 is a jewel in the roughspace4 is a jewel in the roughspace4 is a jewel in the roughspace4 is a jewel in the rough
 
Posts: 19
Karma: 7120
Join Date: Mar 2011
Device: Kindle DXG, Kobo Aura HD
I'm happy to learn that it is possible to browse local html files. There are many html files I would like to read on Kindle but am unwilling to load them over on 3G, it's slow.

I tried both bozohttpd and busybox httpd approach, but no luck.

Command I've put in is:
bozohttpd -b -X /mnt/us/www
/mnt/us/usbnet/bin/busybox httpd -h /mnt/us/www

I put in a file current.html in /mnt/us/www and in the browser, typed http://localhost/current.html

I got error msg: "There was an error encountered when processing your request."

Is there anything wrong or missing on my approach?

----------
Just notice that the file:/// approach works now, which was not working on DXG before. Probably one of the hacks has re-enabled this function! Anyway, I don't need this httpd thing now. Enjoying the local html files! Thanks!

Last edited by space4; 07-25-2011 at 06:23 AM. Reason: Update
space4 is offline   Reply With Quote
Old 07-17-2011, 03:30 PM   #14
Kindlevarazs
Connoisseur
Kindlevarazs ought to be getting tired of karma fortunes by now.Kindlevarazs ought to be getting tired of karma fortunes by now.Kindlevarazs ought to be getting tired of karma fortunes by now.Kindlevarazs ought to be getting tired of karma fortunes by now.Kindlevarazs ought to be getting tired of karma fortunes by now.Kindlevarazs ought to be getting tired of karma fortunes by now.Kindlevarazs ought to be getting tired of karma fortunes by now.Kindlevarazs ought to be getting tired of karma fortunes by now.Kindlevarazs ought to be getting tired of karma fortunes by now.Kindlevarazs ought to be getting tired of karma fortunes by now.Kindlevarazs ought to be getting tired of karma fortunes by now.
 
Posts: 60
Karma: 494362
Join Date: Nov 2010
Location: Budapest, Hungary
Device: Kindle 3
Quote:
Originally Posted by space4 View Post
----------
Just notice that the file:/// approach works now, which was not working on DXG before. Probably one of the hacks has re-enabled this function! Anyway, I don't need this httpd thing now. Enjoying the local html files! https://www2.mobileread.com/i/smilies/smile.gif Thanks!
Hello!
Could you explain it a little? Thanks!
Kindlevarazs is offline   Reply With Quote
Old 07-17-2011, 11:44 PM   #15
space4
Member
space4 is a jewel in the roughspace4 is a jewel in the roughspace4 is a jewel in the roughspace4 is a jewel in the roughspace4 is a jewel in the roughspace4 is a jewel in the roughspace4 is a jewel in the roughspace4 is a jewel in the roughspace4 is a jewel in the roughspace4 is a jewel in the roughspace4 is a jewel in the rough
 
Posts: 19
Karma: 7120
Join Date: Mar 2011
Device: Kindle DXG, Kobo Aura HD
To read a local html file, say current.html, stored in the usual Kindle documents directory, type:
file:///mnt/us/documents/current.html
space4 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
automatic conversion on web server? crankypuss Conversion 6 04-15-2012 03:13 AM
calibre detection on the web server poldem Recipes 2 03-26-2011 05:51 PM
Web Server XML data gweminence Calibre 12 02-17-2011 10:11 AM
how to server up ebooks on my web site metras3 General Discussions 2 01-16-2011 11:43 AM
Web Content Server mezme Calibre 7 01-08-2010 09:59 PM


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


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