Old laptop, Puppy Linux and a web browser on Pokitto?


#1

An offtopic story but with a Pokitto-related point.

Some time back I got my hands on an old gem IBM ThinkPad laptop. The HDD is dead and it’s missing a few keys, but other than that it’s perfectly fine. I decided to experiment and revive him.

The specs: 1.6 GHz single core CPU, 512 MB RAM.

I found a super lightweight Linux distro family named Puppy Linux, made a bootable flash drive and made it run no problem:

So now I also have my own pocket-sized OS that I can run on anything, with persistent storage. I can use it to probe hardware of computers I come across and do all kinds of hacking of locked computers.

Anyway, yesterday I booted that computer again and since it has very big problems running modern browsers (or rather displaying the horribly bloated websites), I decided to check out some simple web browsing. I installed the command line web browser named links, plus also some similar ones (lynx, w3m, …). Needless to say I was quite happy with these. I’ve been even able to read this forum, though logging in wasn’t possible (due to lack of JS support):

And so, naturally, my thoughts now revolve around a Pokitto web browser. Specifically an HTML renderer as a first step, until we get some possibility to comfortably connect to the internet.

The biggest problem I can see is the website size – checking some mainstream sites, the HTML is usually above 50KB, which we couldn’t store in RAM. Switching to mobile version we get to lower sizes, such as some 20KB for Wikipedia, but still, adding PokittoLib, this seems like too much. It’s not impossible though, if we involve the SD card, to convert it to some more compressed format, given HTML tags and things useless to us like scripts and CSS could mostly be stripped.

I think we wouldn’t have too many problems otherwise – the website text is static, so we can build pointers to the text and helper structures for quick rendering – unlike with my text editor. I also already have some encoding handling code from my text editor. And I bet there are tons of lightweight XML/HTML parsers around, and similar web-related stuff.

Opinions on web browsing on Pokitto? :blush:

EDIT:

HTML wouldn’t just need to mean the web of course. For example some e-books are distributed as HTML, so you could potentially read these as well.


#2

HTTP is overrated, let’s use Gopher instead. :P


Problem #1 is that we still need a hat with wifi capabilities to actually connect to the internet.

The availability of a small enough parser and DOM implementation is going to be the biggest issue.
People these days don’t tend to write stuff like that for embedded systems.

And of course oversized webpages will be another headache.
We’d probably end up having to have system that can intelligently discard junk information (like a Pokitto uBlock).


#3

Gopher rocks, shame that no one uses it :smile:

We might need some intermediate DOM representation to interpret the document formatting during conversion but in the end I’d just want to end up with some kind of non-structured format, basically a glorified plain text file with links and very basic formatting. Something like Markdown.


PS: I’ve figured out how to view images :smile: (libcaca)


#4

@drummyfish

https://virtuallyfun.com/wordpress/2014/03/03/surfing-modern-web-with-ancient-browsers/

…you’re welcome

EDIT: also, http://pici.picidae.net/

What is it?

Its rendering webpages into imagemapped gifs :wink:

so, all we need is a proxy server that renders pages into 220x176 :wink:


#5

Server that renders… that’s what they’re doing with some games nowadays, isn’t it?

But that’s a cool idea. The server wouldn’t really need to render images, it could just help Pokitto with the preprocessing… fetch the site and make the compressed version… and Pokitto just displays it. It could run on your server, I wouldn’t expect a huge traffic… at least until it catches on :smile:


#6

It’d be easy to setup a proxy on glitch.com that reduced pages into a simple format (text with links).


#7

pokitto-proxy.glitch.me
source


#8

With a bit of formatting polish that will be exactly what I had in mind. Thanks for showing me this service.


#9

I think an ereader might be cool and maybe even a little bit usable. Also, if it could be done on a microcontroller with less program storage and ram than the Pokitto, it should definitely be possible, and it would make more sense for a device without internet.

Perhaps a browser that wouldn’t read an entire page at once and just ignores text within <…> blocks could give a rough approximation of the content of a site. Of course, the page being prerendered or preprocessed off the Pokitto could work too, but if we’re doing that, it might be exciting to push other kinds of prerendered things to the Pokitto. What about real-time video, or games? Could the Pokitto receive and render high resolution images at a decent framerate if there is no other local computation besides button inputs?


#10

I’d like that. It would be handy to be able to read an ebook on the Pokitto.

If we were to stream a screen in uncompressed 565 format, that’s 220x176x2=77,440 bytes. At 30 frames per second, that’s a bit over 2 megabytes per second. Would a wifi hat be able to handle that? I’ve never done anything with wifi chips so I have no idea what they’re capable of.


#11

Ereader was my secret idea as well. It could either read books from the card OR we could try to make a PC tool that would create executable books that would be stored in flash. As a byproduct we might create an advanced text rendering library, with antialiasing and stuff, for comfortable reading. I would definitely like to convert a number of books from project Gutenberg.


#12

Yes, lots of books to read…


#13

If it’s going to be preprocessed on a server then we don’t even need to use proper HTML, we could come up with a format that’s easier to parse, e.g. some kind of JSON variant or something.
We could also reduce the number of tags that need to be considered.
(Or even translate it to Gopher :P)

(HTML deviated from XML by making certain tag openings/closings optional, which makes it much harder to parse.)

We could even make it a binary data format where tags are encoded as byte values.
For example, if we had an ASCII mode and a Unicode mode then we could have around 128 tags without even increasing the transmission size just by treating the high bit as a ‘command or text’ flag.

(I know people grumble when I mention unicode, but I like to look out for the people who can’t speak English.
We don’t want to isolate the Chinese, Russian, Japanese etc markets.)

I can’t find many statistics, but aparently the ESP8266 can handle between 1 mbps to 72 mbps.
77,440 * 8 = 619520 bits, / 1024 = 605 mb
So we’d need some form of fast compression to do whole frames at once.

Why not just store them on the SD card? One program, many books.
(And when we eventually have a wifi hat, potentially infinite books.)


#14

Yep, that’s what I had in mind with the “Markdown”-like format :+1:

You also have XHTML which is a real XML, but I don’t know what percentage of sites is actually using it.


#15

A binary format would allow transmitting images. Transmitting each line of text as an image would probably look good too.

I don’t think the Pokitto would be able to handle decompression quickly enough, unless all we’re doing is reducing the color count. 220*176*4bpp*15fps = 2.3mbits. Ugly, but might work? Maybe another option would be to decompress on the ESP, if networking is the bottleneck, and transmitting uncompressed over SPI.

As a test, I wrote a nwjs thing that captures the screen and streams it to the serial port. I couldn’t get it to work with PPP. It would be possible to get the button states, transmit that back to the PC and map them to mouse/keyboard inputs.
The bottleneck is definitely the Pokitto’s USB stack in this case. Even if it runs at only 0.3fps, it’s kinda cool seeing Steam on the the little screen. :laughing:

Now I really need to stream Skyrim to my Pokitto.

AFAIK, that was an HTML4 thing that got deprecated.


Browsing pages doesn’t need a high framerate.


#16

So would a text format if you’re willing to put up with the monstrosity known as base64 :P

Given time we might be able to come up with something that’s more clever, like delta compression, or the image equivalent of huffman coding, or bitplaning.

The ESP8266 runs at 80-160MHz, so that’s plausible, assuming it’s an ESP chip that gets used.

Everything needs Skyrim streamed to it.

It’s ironic, they changed HTML to make it so that end tags could be omitted to make it easier for humans to write, and now humans hardly ever write HTML, it’s mostly generated from other sources.

They should have made it easier for machines to parse.


#17

Managed to get the framerate up. Using 256 colors with a 332 palette:

Ugly, but playable. I think I can optimize the palette to get less banding. If a WiFi hat can run at this speed and if it can be stacked with the JoyHat, I’m going to replay Skyrim all over again! :laughing:


#18

wait wait… wait a second… that… that wasn’t just a screenshot mockup? :no_mouth:


#19

Nope. :stuck_out_tongue:


#20

how do you do it? :flushed: I wanna try various games this way.