Saturday, April 19, 2014

More Headless Raspbian Beta Testing

A couple weeks ago I announced I was working on a headless configuration tool for Raspbian devices. I just pushed out an updated beta distro for general testing. I added a few things to the mix:
  1. Network Configuration - you can now configure your network via the web page.
  2. Network Profiles - not only can you configure the network via the web page, you can store configurations as "profiles" so you can easily move your device between different networking environments (home, work, mobile, etc.)
  3. Remote Reboot - If you have a remote device, you can now reboot it remotely with the web interface rather than walking over to it and power cycling it.
To test out the updated beta distro, just do this:
  1. Download the file http://sm5.us/2014-01-07-starless-raspbian.zip and unzip it. You should wind up with a file called 2014-01-07-starless-raspbian.img. Beware though, the zip file is about 800MB, so make sure you're downloading it over a decent connection.
  2. Copy this file onto a spare SD Card using your favorite tool. I use Ubuntu as my daily driver, so I use the command `sudo dd if=2014-01-07-starless-raspbian.img of=<SD Card Device> where <SD Card Device> is the name of the unix device file representing the SD Card. The good people over at eLinux.org have put together a good wiki page describing how to do this in non-unixy environments.
  3. Put the SD Card into your RasPi and give the thing a boot. If you're going to be doing wireless, make sure you're using a USB wireless interface that uses the Realtek 81XX chipset (like this one sold by AdaFruit.) But you should also be able to use the built-in ethernet adapter on the Raspberry Pi Model B's.
  4. It will take a little while to boot. If you have a PiSwitch board, you should see both the recovery and nominal lights turn on for a bit, then turn off, then turn on again. If you want to configure it via a handheld device like a tablet or iPhone, attach to the wireless network 'starless' using 'starless' as the WPA password.
  5. After the device has booted and you've joined the starless WiFi network, point your browser at: http://starless.local/ - you should be greeted with a user interface that looks something like this:

  6. Click on the "User Accounts" menu item to create a user account for yourself, then click on the "Network" menu item to create a network profile for your device. On the "Create Network Profile" screen, you can configure your device to attach to your local wireless network using DHCP like this:

  7. Now click on the "Reboot, etc." menu item and click the Reboot button. In about a minute you should be able to attach to the device from the wireless network you configured or via the wired ethernet network. The admin UI is still available at http://starless.local/ (if your device knows how to do mDNS) or you can ssh into the device and run the raspi-config utility:


  8. And that's about it. Ping me with questions or comments here or on twitter (@OhMeadhbh) or via email at OhMeadhbh [at] gmail [dot] com.

Saturday, April 12, 2014

Using Multiple Versions of Node.JS on Raspbian

People who know me know I'm a fan of Node.JS, the "JavaScript on the server" development framework. And while I would love to say it's all sweetness and light in Node-Land, sometimes there are some dark clouds. One of the darkest current clouds is version dependencies. It's not as bad as it used to be, but every now and again we still get a situation where we might want to punt on the latest version and use the "most recent version that exhibits a particular behaviour."

But the way node is packaged on Debian (and Raspbian) you generally get an old version installed directly in /usr. At Smithee, et al, we've taken a slightly different tack. We install node in /opt/node-v$VERSION with soft-links scattered throughout the file-system to point back to /opt.

For example, on my Raspberry Pi right now, I have two versions of node v0.10.26 and v0.6.5 (yeah. don't ask.) So, /opt on my machine contains the following node-related directories:

Directory What's There
/opt/node-v0.10.26 Modern, daily use node installation
/opt/node-v0.6.5 Legacy node installation

Then I added some soft links to make the system think i had installed version 0.10.26 in /usr:

From To Description
/opt/node /opt/node-v0.10.26 Current default node
/usr/bin/node /opt/node/bin/node Node executable
/usr/include/node /opt/node/include/node Node include files
/usr/lib/node_modules /opt/node/lib/node_modules Node modules (including npm)
/usr/lib/dtrace/node.d /opt/node/lib/dtrace/node.d dtrace descriptor for node
/usr/share/man/man1/node.1 /opt/node/share/man/man1/node.1 Man page for node

So if I want to use version 0.10.26, i use node normally. But if I need to use version 0.6.5, i put /opt/node-v0.6.5/bin in the path before /usr. And when version 0.10.27 comes out, i install it in /opt/node-v0.10.27 and point /opt/node to point to there. If it turns out I have to revert for some reason, all I have to do is change /opt/node to point back to /opt/node-v0.10.26.

If you want to try this out yourself, here's a .deb file you can install with the command `sudo dpkg -i nodejs_0.10.26-1.armhf.deb`. Or, if you like tar files, here is a tar file with node v0.10.26 you can install with the command `( cd /; sudo tar xzvf node_v0.10.26_raspian.tar.gz )`. Both should work with a stock 2014-01-07-wheezy-raspbian system. 

Tuesday, April 8, 2014

Chapter 117 of my still unnamed Space Viking saga

"Okay Gunnr, read it back to me," Fram asked like an youngling asking a parent to read them a story.

"Fram. You really should learn to read and write on your own."

"Pish! I read and write modern. I never got the hang of this old stuff." Fram replied with an amazing lack of annoyance. "C'mon. Read it back. I want to make sure it's perfect!"

"Fram." It took only one word to convey her annoyance. "You'll never learn if you don't try."

"Uh... My helmet's fogging up! I can't see it clearly." It would have been a good excuse had it been true. But Gunnr didn't have a clear view of the front side of his vacc suit, so...

"Okay. Fine." she said, the annoyance giving way to acceptance. There was no way Fram was going to get on with life until this was over. "It reads, 'In the year of the city twenty-three seven-hundred eighty-five, Fram Steinfríðrson had this stone erected in memory of himself, because he was so awesome.'"

"Does it really say 'awesome'?" he asked, "That sounds a little conceited."

"And erecting a rune-stone on an asteroid doesn't make you seem full of yourself, Fram." she said with mock seriousness. "Besides, it actually translates as 'fantastic.'"

Monday, April 7, 2014

What should a computer interface look like?

So I was thinking about how computer/human interfaces reveal biases in their developers.

The early micro-computers I used booted up directly into BASIC. And that makes sense; they were built mostly by hackers, for hackers. Built at a time when people thought, "oh yeah, everyone will be writing their own programs to solve random problems around the house."

Various Xerox machines like the Alto and the Star introduced the "desktop metaphor" which was famously used later in the Apple Macintosh. Jef Raskin, considered the god-father of the Macintosh built a machine for writers, focused on the keyboard. If you get a chance to fiddle with a Canon Cat, it's worth doing. It is a radically different idea for how people should interact with computers.

If you can figure out what Microsoft Windows' primary user interface metaphor is, please let me know. Classic Windows is mostly a desktop; Metro seems to be a "scrollable cork-board of applications or documents" or something.

So this got me thinking, what does the UI of devices like iOS and Android phones reveal about their developers?

My take on iOS is it lets you do a small number of things easily and with admirable grace. Once you try to do something it doesn't want you to do, the steely smirk of Steve Jobs' out of the ether to smack you upside the head. "It's fucking beautiful the way it is!" a disembodied voice says, "Quit trying to do things it wasn't designed for! Maybe you should just get one of those Android phones. Or better yet, go get a Windows Phone." You walk away realizing how unworthy you are of the iOS platform.

To me, iOS says "we know more than you do." And that would be fine if I didn't have to pay $13/month to listen to music i already paid for or could get the address book application to sync properly.

On the Android side, you turn on the phone and... MY OPINION OF ANDROID IS NOT RESPONDING. WAIT? QUIT?

You eventually find a USB cable, download the Android debugger, kill the bloatware process HTC auto-launched at startup and proceed to be confused by configuration options which are amazingly similar to the previous version's config options, but have radically different effects. Android reveals the bias of a typical handset software vendor: "OMG. I can't believe you bought this!"

We're moving into world where the "Internet of Things" is supposed to be the next big thing. Based on what I've seen so far, I'm vaguely bearish on commercial IoT offerings. To start with, there's about zero interoperability. I should be able to whip over to Amazon and buy a 10-pack of ZigBee / BLE / whatever temperature sensors for $32.99. They should come up on a network and respond to administrative requests with a string describing their function; bonus points if they include a description of the protocol they respond to.

What do we get instead? fucking Nest. This is the future? Stop this train, I want to get off. I'll have a better time running a Commodore 64 emulator on my Raspberry Pi.

Sunday, April 6, 2014

Beta Testing a Headless Raspberry Pi Confgurator

So I finally had the time to hobble together an open source version of the headless Raspberry Pi config interface I've been working on. It's used in applications where you want your Raspberry Pi to act as a "headless" server (i.e. - it doesn't have a video screen.) The configuration steps you would normally perform using the raspi-config utility are performed using a web page accessed over the network.

If you have a Raspi with a USB wireless adapter (like this one, sold by Adafruit) you'll be able to test it out. Note. This rev only works with the adapters that use the RTL 871X driver. The official version will support many more USB devices, and you can always access the interface over the wired network connection.

To try it out, download the image from http://sm5.us/2014-01-07-starless-raspbian.img.bz2, unzip the file, then write the image to a SD card. After that, you just boot your raspi and look for a wireless network whose name is something like starlessXXXXXX. Connect to the wireless network using the pass phrase starless, and then go to http://y.sm5.us/ to see the admin interface.

I haven't configured mDNS yet, so accessing the interface via the wired interface on a Model B is a little trickier. It's setup to do DHCP on eth0, so if you have your raspi working now with DHCP, it should still work. You'll have to figure out what the IP address is by yourself, but that's the hardest part. I've configured my DHCP server to always hand out the same IP address to my raspi, so i just added the line

192.168.1.3  y.sm5.us

to the /etc/hosts file. Your raspi probably has a different IP address, so... substitute 192.168.1.3 with whatever your IP address is.

The interesting bit I'm trying to test out right now is to make sure the interface works with popular mobile phones and tablets. Unlike previous web experiments, I'm not doing anything fancy, so as long as you have a reasonably modern browser that handles JavaScript and jQuery, you should be fine.

If you have questions, comments or just want to tell me you tried it and it worked, ping me at @OhMeadhbh on twitter or via email at OhMeadhbh [at] gmail [dot] com.

-Cheers!

p.s. - like most of the project names I use, the name "starless" comes from a King Crimson song; "Starless and Bible Black" in this instance.