Monday, August 30, 2010

My life with Ben, episode 3

In the previous two episodes, I've told you how I've carried the Ben Nanonote along for several weeks, just to see how it behaves in the real world. In short, it has been used as an MP3 player, a small wordprocessor and as a miniature system console.

But since it also has a capable PDF viewer I wondered whether it could free me from printing those papers just before a meeting. You know, these entries in your schedule that you become aware of just five minutes before they start. In the meanwhile you have to collect all the documents required from various sources and locations and quickly send them to the printer since your regular laptop is out of juice or its use during the meeting is - if you happen to work for certain technologically conservative companies - "undesired".

At that moment you will notice that a "printer queue" refers to the number of persons waiting before their print jobs have finished and if it doesn't that's because the device in question is either out of paper or simply jammed beyond repair.

So wouldn't it be nice if you could simply put all these documents on your Ben Nanonote and carry them along? Sure it would. The only thing keeping you from doing that is that your boss probably selected that "other" Operating System and ditto Office suite.

Fortunately, most companies offer PDF printing capabilities nowadays, so you can save your documents in that format. If not, there are several FOSS or freeware utilities you can use like FreePDF, CutePDF or PDFCreator. Note the latter has been accused of installing spyware, despite its FOSS license. If you're using any FOSS productivity programs, you probably have that capability already. Anyway, whatever method you use, generating PDF files is usually a matter of seconds.

The big question is, how do you get them to your Nanonote that quickly. USB doesn't work on MS-Windows - unless you're only interested in charging the battery of the Nanonote - and chances are your uSD card contains only ext2 file systems. But help is underway, because it is possible to read and write ext2 file systems under that "other" Operating System by using Ext2IFS (freeware) or Ext2FSD (FOSS).

Both are very easy to install under XP, but I had a bit more luck with Ext2FSD. Ext2FSD is definitely recommended when you use one of the latest incarnations of that "other" Operating System, because Ext2IFS hasn't been updated since late October 2008.

For accessing the uSD card I use an SD card adapter, although USB adapters are also available. First I installed Ext2IFS, rebooted, inserted the uSD card and started Explorer. Then I uninstalled it and repeated the same procedure with Ext2FSD. Both times I was asked whether I wanted to format my uSD card - which I didn't, of course. Ext2IFS was consistent in its behavior, but Ext2FSD complied when I accessed the drive with MinGW bash. After that, Ext2FSB worked flawlessly, reading and writing the ext2 file system and unmounting it cleanly.



I must note I've been pretty careful, shutting the Ben down entirely before inserting or removing the uSD card. You can probably mount and unmount it while in operation, but because booting the Ben is a matter of seconds I simply didn't want to take the risk.

In a previous episode I already reviewed "nupdf", which is a pretty decent PDF viewer - although not entirely bugfree. It is very well suited for reading office documents, which are usually fifteen pages or less. You can even keep two "nupdf" instances in memory concurrently and switch between them by pressing [CTRL]-[ALT]-[Fx]. However, "nupdf" does not blank the screen automatically (like "gmu"), so you might drain the battery a little bit quicker than usual.



I must admit I haven't tried using "nupdf" for reading entire books, but I wonder whether it is well suited for that purpose. You'll either have to strain your eyes to read the small, grainy print or scroll from the left to the right all the time. Whatever choice you make, I can assure you it is not going to be a comfortable read. Note this is hardly the fault of the developer, but rather a logical consequence of using a device with these limitations for this kind of task.

Still, for a quick peek you can't go wrong, especially since you can keep "hnb" open in another console to make a quick note. If you keep your uSD card synchronized with your desktop, you're prepared to go to any meeting at any time. Never mind the print queues..

Sunday, August 29, 2010

My life with Ben, episode 2

I've had a serial terminal connected to my Linux box for as long as I can remember. My brother worked for a company that was phasing them out at the time, I told him I wanted one (I was always a sucker for useless hardware) so I got one for free. It sat on my dinner table for years and then I switched to Linux. Hooking it up was (and is) quite easy. You simply put this entry in your inittab:
S0:12345:respawn:/sbin/agetty -L 38400 ttyS1 wy60-25

And make an entry in /etc/securetty. Done. Then I log in and enter:
tail -f /var/log/messages

This may seem trivial, but it has saved my life numerous times, e.g.
  • .. when X becomes unresponsive because a runaway program is eating up my swap space;
  • .. when X crashes for some reason and locks up my terminal;
  • .. when my harddisk is starting to give up and throws all kinds of messages all over the place.
Once I was able to quickly make a backup, losing only a few trivial files. After a reboot the disk was gone forever.

Unfortunately, my old Wyse 25 is slowly giving up. All of a sudden horizontal or vertical bars strike out all the characters on screen and only a sharp tap on the left side of the terminal helps - sometimes. I have been looking for a replacement, but even on eBay they're scarce. Wyse has stopped producing them altogether.



The closest thing you can get are thin clients. Although they're not too expensive they're a hell to setup properly. Note I'm not a network expert and I really don't need a GUI. All I need is a bunch of scrolling /var/log/messages and an occasional [CTRL]-C halt[ENTER]. In other words, a thin client: that's overkill.

Then I got my Ben Nanonote. The Ben features a serial port, but unfortunately you need to solder your way into that. That's a tall order from a guy who can't even properly glue the poor things feet back on without making the device an inseparable part of his body. But the Ben also features an Ethernet-over-USB gadget. I could use that one to connect it to my OpenSuSE machine.

Ok, it probably can be done, but I got two problems here. One, I don't know much about networking. Two, I'm paranoid where security is concerned. I saw sshd was running, so I tried to login.
ssh root@192.168.254.100

Surprise, it didn't work. A quick look at dmesg showed me why:
SFW2-INext-DROP-DEFLT IN=usb0 OUT= MAC=xxxx SRC=192.168.254.101 DST=192.168.254.100 LEN=52 TOS=0x00 PREC=0x00 TTL=64 ID=27103 DF PROTO=TCP SPT=49762 DPT=22 WINDOW=5840 RES=0x00 SYN URGP=0 OPT (yyyy)

It was killed by the firewall before it even got there. I never like fiddling around with my machine - especially when I barely know what I'm doing - but I gave it a try. I started YaST, selected "Security and Users" and then "Firewall". Then I selected "Interfaces" and placed "usb0" in the DMZ.



Now I had to allow Ben to use ssh. I selected "Allowed services" and then "Secure Shell Server".



Finally, it was time to wrap it all up and try again. I finalized the configuration and was presented with a screen, showing all my changes.



When I tried to login, it still didn't work, but at least I got through.
SFW2-INdmz-ACC-TCP IN=usb0 OUT= MAC=xxxx SRC=192.168.254.101 DST=192.168.254.100 LEN=52 TOS=0x00 PREC=0x00 TTL=64 ID=460 DF PROTO=TCP SPT=49763 DPT=22 WINDOW=5840 RES=0x00 SYN URGP=0 OPT (yyyy)

Finally, I turned to /etc/ssh/sshd_config and changed a few settings. Now, this was dangerous territory..
Port 22
AddressFamily any
ListenAddress 192.168.254.101

Then I restarted ssh.
/etc/init.d/sshd restart

But all I got was:
bind: Cannot assign requested address

Duh? Ok, to cut this story short: I went from 192.168.254.101 all through 192.0.0.0, but all with the same result. Finally, 0.0.0.0 worked. Don't ask me why..

I went to Gibson Research Center to test the outside defenses. All ports still on stealth. Fine. I know my ADSL modem has a firewall too, but you can never be too sure..

So, this is how my Ben Nanonote became a console. If my Wyse 25 finally goes to that big computer center in the sky, the only thing I have to do is to order another Ben Nanonote and hook it up.



Sure, there are still a few things left to figure out. Sometimes I have to go through the entire firewall dialog, because it seems to have "forgotten" all about the DMZ. The connection with the Ben is not set up automatically at startup and finally, a professional would have made a far more better job of setting up the entire configuration. But it works! And that's good. I hate repairing filesystems.

Saturday, August 28, 2010

My life with Ben, episode 1

I've been using (and abusing) my Ben Nanonote daily now for several weeks, simply to find out whether this little machine is just a little gadget or really a useful device. In the meanwhile, I found out several things:
  • The feet will come off, so maybe you'd better fix that before it happens, because the changes are you'll never find them again. Using it without feet is not an option, because it will wobble. Which is very uncomfortable and irritating.
  • When the screen fades to white, it hasn't given up. Relax, hook it up and it will recharge. The battery is dead, not the screen.
  • I will boot the Nanonote when I'm on the tramway and it will usually still have juice when I get home eight hours later, unless the screen has been heavily used - at least that is the impression I have. I haven't tested this under controlled circumstances yet.
  • Unlike the iPad, it does have multitasking. You can switch between consoles by pressing [CTRL]-[ALT]-[F1], [CTRL]-[ALT]-[F2], [CTRL]-[ALT]-[F3], etc. Even when you're using a graphics application. However, if you try to use two heavy-load applications at the same time (e.g. Gmu), strange things may happen, including a spontaneous shutdown.
So, you may ask, what am I using the Nanonote for all day? Well, first of all, Gmu makes it an excellent Ogg player. The Nanonote comfortably fits in ones pocket and has an excellent sound quality. The uSD card provides lots of space, so you can take all of your favorite songs along with you. Second, the "hnb" (a sort of KJots) is always just a few keystrokes away, so you'll never have to search for a piece of paper while on the phone. You can even create a spreadsheet using "sc" or 4tHs own "Tiny Commandline Spreadsheet".

I clearly stated "create", not "maintain". Why? Well, IMHO the screen of the Nanonote is just too small to manipulate large amounts of data. You simply don't have any overview. E.g. a line is only forty characters wide, so you can only see three columns at the time. I haven't worked with such small screens since the ZX Spectrum. And even in those days, I didn't feel a spreadsheet was a viable option on that machine.

Don't understand me wrong: it's alright to set up a spreadsheet while "in the field", but at some point in time, you want to transfer that file to a full blown workstation and continue work there. Fortunately, "sc" allows you to export a spreadsheet to a CSV-like format. "TCS" even supports exports to .FODS (OpenOffice), .XLS (MS-Excel), and .KSP (KSpread). "TCS" will be part of the up and coming 3.61.0 release of 4tH.

The same applies to wordprocessing: you simply don't want to maintain a large document on the Nanonote. But what you want to do is to create a document while on the road. I'm a regular columnist of the Dutch "IT Infra" magazine, so I really want to use these lost moments to do some work.

And there the trouble began: there is no wordprocessing package available for the Nanonote. Just a few editors. However, while looking for a "curses" based wordprocessor I stumbled upon "txt2tags", a formatting program written in Python - which is supported by the Nanonote.

The big advantage of "txt2tags" is that you don't have to bother yourself with technicalities like setting margins or papersize, you just type and add formatting instructions like section, bold, bulleted list, link, image, etc. When you're done, you simply render the document in the required format, like HTML, TeX, etc. Very much like how my favorite LyX works.

Now the quest for a suitable editor began. Fortunately, a list of suitable editors was available, most of which were already available on the Nanonote. "vi" was out of the question, because - although I like it for editing source files - it doesn't give me a wordprocessor feel. "nano" just fell short, especially the Nanonote implementation. So I decided to use "joe". "joe" has a "Wordstar" legacy which I do not particularly like (I'm still trying to get the knots out of my fingers while trying to type [CTRL]-[ALT]-[SHIFT]-K-Y-0) but it would have to do. There were three things I wanted to archieve:
  1. Wordwrap and reformatting paragraphs;
  2. Highlighting of tags;
  3. Rendering of the document within the editor itself.
Wordwrap and reformatting
You can customize "joe" by creating a .joerc file within your $HOME directory. Note you have to customize "joe" completely - you can't just single out the options you want to set. The nice thing about "joe" is that you can customize it for particular file types. My "txt2tags" files all have a .t2t extension, so that wasn't too difficult:
*.t2t
-rmargin 39
-wordwrap

That did the trick! I could simply type away without scrolling to the right, so all the text remained on the screen. If I had created a gap while editing a quick [CTRL]-K-J would fix the formatting. Mission completed!

Highlighting of tags
This proved to be a bit more difficult. I created a ~/.joe/syntax directory and placed the txt2tags.jsf file there. I edited .joerc accordingly:
*.t2t
-rmargin 39
-wordwrap
-syntax txt2tags

Nothing. I turned to the Nanonote mailinglist for help and David Kuehling and Mark Adrian Bell came to the rescue. Mark had been able to activate syntax highlighting by using Davids own "joe" package.



So I uninstalled the native "joe" package and installed Davids. Nothing. Nada. No highlighting. I asked David for help and he figured it out: the -highlight option was missing. He found that one out by incident when using another .joerc file. I would never had thought that because the -lightoff option was disabled.



And that is the problem with "joe". IMHO it is not sufficiently documented. You can surf the web for hours - like me - without finding any useful information. Sure, if you just want to make a quick edit there are lots of tutorials. But if you really want to do some serious customizing, you're very much on your own.

Rendering of the document
Integrating the "txt2tags" program was the last step. The only help you can get is the glossary here and a few odd examples scattered around the web. Fortunately, you can type in the commands at the prompt after typing [ESC]-X. I finally decided on:
:def render savenow,if,"!joe(sys,\"[path]txt2tags \",name,rtn)",then,msg,"*ERROR* file not generated",rtn,endif

This will save the current file, call the "txt2tags" program and print a message when an error occurs. I just needed to bind it to a key (I choose [ESC]-C) and that was it.
render ^[ c Compile
render ^[ ^C Compile

Now it seems quite easy but I hammered away for hours at the prompt before I got it right - sort of. Rendering is not particularly fast, but for short documents (about 500 words) it will do just fine.

Wordprocessing on the Nanonote
So now we're in for business. I will just scratch the surface, because "txt2tags" is very well documented.



The first three lines are reserved to the title, the author and the version. If one or all of these are missing just leave them blank. The next lines can be used for the configuration area, e.g. the format you want to render the document in. In the Nanonote implementation, the %!target: tag is required. You can put any supported format there, like tex (LyX) or html (OpenOffice). If you want to generate a Table of Contents, you can add:
%!options: --toc

After that your text follows. Simple tags like "**", "+", "//" are used to indicate bold, bulleted list, italic, others can be used to indicate numbered or unnumbered section headers. You'll get the hang of it soon enough, it's very intuitive.

When you're done, you simply hit the [ESC]-C key and within a few seconds you're done. You can now transfer it to your main machine by using the uSD card or scp. Done.

This is how it looks in OpenOffice:



And this is LyX:



Well, that's it for now, but I'll be back soon with some more unexpected uses for the Ben Nanonote that go beyond the "Barbie notebook for little girls with too much money". Have phun!

Sunday, August 8, 2010

Pure fun, but not for the faint hearted

Several weeks ago I found out that my 4tH compiler had been ported to the Ben Nanonote. Well, that happens quite a lot. It's small, portable and even cross-compilable so that shouldn't surprise anyone.

Curious as I am, I tried to find out what a kind of computer that was. In short, it's a Linux computer the size of a pack of cigarettes. It looks like a toy laptop, but it isn't. It's fully functional. And best of all, it was only $99. I decided I had to have one.

Ben Nanonote

Unpacking and installing
It took me a while to find a Dutch dealer, but I found one. I ordered one online and a week later I found a small package in the mail. I opened it and found:
  • The Nanonote itself;
  • A USB cable;
  • A battery;
  • A manual;
  • An odd rubber thingy.
The manual isn't worth much. It's small and over half of it is dedicated to a GPL license. No, if you want to find out something about the Ben Nanonote, you got to have a working Internet connection and surf down here.



First thing you have to consider is that the USB cable is of special quality. Unless you're sure you've bought a state of the art cable, don't use another cable in connection with the Ben Nanonote. Second thing, reserve a USB port for the Nanonote. Don't use a USB hub! This is very important.

Ok, now we got that settled, hook it up to your Linux machine and boot it. Now type:
passwd

And enter the password for root on your Ben Nanonote. Then open a console on your Linux machine and type:
su
ifconfig usb0 192.168.254.100
exit
ssh root@192.168.254.101

Now accept the defaults and enter the password you've just given. Hurray, you're connected with your Ben Nanonote! First, find out what version you're using:
dmesg | less

If the first line doesn't say:
[ 0.000000] Linux version 2.6.32.10 (mvogt@buildhost) (gcc version 4.3.3 (GCC) ) #1 PREEMPT Tue Jun 15 17:53:33 CEST 2010

You're in for a treat: updating the firmware. It's no walk in the park, but it can be done. The documentation lists three methods:
  1. Using a shell script and the USB cable;
  2. Using the prompt and USB cable;
  3. Using the prompt and a mini-SD card.
I tried all three and only the second worked. However, this requires a special program called usbboot. If you're using a Debian based distribution this is not too hard, but my OpenSuSE isn't. First I had to install the confuse library from source. Then I had to unpack the tarball. After that usbboot was functional.

Now the trick is to get the Ben Nanonote into USB mode. Fortunately, pressing the power button in conjunction with "U" worked for me. If not, you have to short a few pins (!) in the interior of the tiny machine. That's what this strange, rubbery thingy is for!

I followed the instruction to the letter (even copy and pasted them at the prompt), but for one odd reason it wouldn't take:
nprog 2048 openwrt-xburst-qi_lb60-root.ubi 0 0 -n

I still don't know what caused that - it may have been a user error, but fortunately this worked:
usbboot -c "nprog 2048 openwrt-xburst-qi_lb60-root.ubi 0 0 -n"

Applications
This firmware makes a world of difference. Sound works and with it, a lot of applications that are just plain fun like "Doom" and "Gmu". Note that for patent reasons "Gmu" only works with Ogg-Vorbis files. If you got a large MP3 collection, this is a quick fix:
sox mp3file.mp3 oggfile.ogg

Copying files to you Ben Nanonote is very straight forward. If you don't want to swap mini-SD cards, simply enter:
scp [myfile] root@192.168.254.101:[directory]

Another indispensable program is "Nupdf". It does quite a decent job of rendering PDF files on the tiny machine. Just don't press [enter] because that gets you in a menu that is very volatile. If that happens, leave it as soon as you can before the thing hangs.

Therefore it is good to know that you can shut the Ben Nanonote down by simply pressing the power button for a few seconds. If that fails, you have to reset it much like the EeePC 701, i.e. by putting a toothpick in a hole. Of course, issuing:
halt

Is so much more elegant and professional.

Programming is not bad at all as well. Python and Lua are included by default. 4tH is another obvious choice, more so because it is adapted to the tiny 320x240 pixel screen. Office applications are a bit rarer, but if you are determined to type away on this calculator style keyboard, try "sc". It is a console based, vi like spreadsheet. Wordprocessing is a bit harder, but I found the tandem of "nano" and "txt2tags" quite usable.

Finally, I'd love to have a ZX Spectrum emulator for this machine! It's perfectly suited for this kind of keyboard and screen size. Unfortunately, although it is stated that Dingoo binaries are compatible, I wasn't able to make one single ZX Spectrum emulator run.

However, there is a DOSBox emulator for the Ben Nanonote, so I brushed off my Z80 emulator and installed it. After some tinkering, it ran!

Z80

But there are some serious drawbacks. First, there is no sound. Second, you can't type any numbers. Third, a lot of keys are missing from the Ben Nanonote, so you can't quit the Spectrum emulator once you've started it. Finally, it is SLOW. The ZX Spectrum emulator says it's running at 112%, but believe me: it is much slower.

Theatre Europe

Also, DOSBox still emulates a 80x25 screen which pretty much means everything is illegible. E.g. Wordperfect 5.1 runs perfectly. You just can't read anything..

Finally, I really advise you to disable "gmenu2x". It uses a lot of memory and is hardly useful. My Ben Nanonote really was sluggish while it was loaded, up to the point where the kernel killed it - and "hotplug" along with it. A full list of packages can be obtained here.

Cross compilation
There is a nice page about setting up cross compilation. I really have to advise you to use this one and not some others you may find on the web. Except for one thing. Don't issue this command:
scripts/feeds update -a && scripts/feeds install -a

It will take much longer before you have a working environment and it bombed out while building Qt4 with me. You can always add additional packages by marking them <*> and issuing:
make

Still, I wasn't able to make 4tH pop up in the menu of "menuconfig". Fortunately, there is an alternative way to cross compile for the Ben Nanonote. It worked for 4tH, but I must admit I haven't been able to cross compile much more.

Conclusion
I must admit I've been very frustrated at times. And sometimes, I still am. But there is something about this tiny machine that makes you love it, no matter what. It's very sturdy, although a foot has fallen off and I reconnected the rubber USB protection several times. I reset it, yanked the battery out of it, reinserted the mini-SD card time and time again, but it kept on working. The power button has been abused a zillion times, but it doesn't give up. It's really a brave little machine.

But all in all, it's not a consumer device. If you expect the thing to "just work", don't buy one. If you expect it to be useful out of the box, don't buy one. If you expect perfect end user documentation, don't buy one. E.g. documentation said I could mount the mini-SD card line this:
mount /dev/mmcblk0 /card

But it actually is:
mount /dev/mmcblk0p1 /card

That's typical. But if you want the tiniest webserver you've ever seen (it supports Apache and PHP), do buy one. If you have no fear of trying things - and failing while you're at it, do buy one. If you want a piece of hardware that will really touch your friends, do buy one. They will be amazed, laugh, because there's nothing similar on the market.

Support is there, you can't get any closer to the developers than here. And they'll help you. But this device will require some effort from your side. And if you give it that little bit of effort, I don't believe it lets you down. It's much too cute for that..!

Update: Yes, you can use it as an MP3 player. You can connect a 3.5 mm jack headphone and it easily slips into your pocket. The sound is plain beautiful and it will easily play for 10+ hours. And in the meanwhile it is open to other tasks.

No, you don't need to do any soldering unless you want to use the RS232 interface. Shorting the pins for usbboot is temporary. And unless you've blasted the bootloader, you won't need to do that.

Update: You can switch between consoles by pressing [CTRL]-[ALT]-[F1], [CTRL]-[ALT]-[F2], [CTRL]-[ALT]-[F3], etc. Even when you're using a graphics application. However, you cannot start two graphics applications at the same time.

Update: Jirka correctly stated that running two graphics applications at the time is possible. However, any console switch in combination with "gmu" gave rise to erratic behavior, including a spontaneous shutdown of the Nanonote. Two concurrent "Nupdf" sessions gave no problems whatsoever. So while a console switch is possible while in graphics mode, "caveat lector" remains sound advice.

Update: My Ben Nanonote scared the hell out of me today. I left it open all day, including a graphic screen. When I went home, the screen turned milky-white within about a second and stayed that way. Pressing the "off" button didn't work. Resetting it didn't work. Jerking out the battery didn't work. The screen stayed milky-white. At that moment I wondered whether the screen had given up, but may be I was still able to hook it up to USB.

When I got home, it didn't react to nothing anymore. I was prepared to send it back. When I hooked it up to my main computer, I wasn't able to connect it to USB Ethernet, but it booted at least. A Nanonote reboot fixed that, however. It turned out, it was just out of juice. After a few hours of recharging it worked perfectly. Had the screen simply turned black, I wouldn't have worried.

All in all, it simply confirmed its reputation: it may not work the way you expect it to, but it will survive. Keep up these quality requirements where the battery, ON/OFF button and reset button are concerned.