#!/bin/blog

October 4, 2008

Playing with the ALIX LEDs

Filed under: UNIX & Linux — Tags: , , — martin @ 7:24 am

I have started to use an ALIX machine by PC-Engines as my printserver using CUPS. Being the playful kid that I am, I wanted the machine to somehow indicate that it has queued print jobs, using the LEDs.

Controlling the LEDs is fairly simple. I started on OpenBSD, found a very simple method for controlling them through gpioctl right away and quickly rolled it into this very simple shell script that allows for commands such as “led 1 on” or “led 3 off”, you get the idea.

I found that OpenBSD didn’t work too well for me as a CUPS printserver for multiple USB printers. The helpful OpenBSD mailing lists were down on that weekend, so I just decided to install Debian Linux onto the ALIX.

The Linux Kernels currently in circulation don’t however support the ALIX LEDs. Support is available, though. I downloaded the kernel module source from here (leds-alix_0.0.1.orig.tar.gz) and after compiling them and loading the leds_alix module, my shell script was ready to be extended into a “multiplatform” LED control wrapper.

(The LED drivers on Linux allow for a lot more fun, such as a “heartbeat” feature or acting as an “IDE” LED, but that’s not my point here. 🙂 )

On top of my little shell wrapper, I have now implemented a Perl script, the “CUPS LEDs daemon”, cupsledsd, which starts cycling the LEDs when there are pending jobs and uses the wrapper for turning them on and off. Of course, this could easily be used for something more sophisticated, such as displaying the number of queued jobs.

Update, 2008-10-07: I found that the original cupsledsd, as posted above, was a bit too hard on the CPU, using 5-10% for just blinking. Here’s a Linux-only cupsledsd that uses no system() calls. It accesses the CUPS queue directly (searches for data files in /var/spool/cups, probably unsupported), writes directly to the Linux /sys filesystem and blinks more frantically while not using a significant amount of CPU.

Advertisements

5 Comments »

  1. Blinking LEDs? Where’s the video? 🙂

    Comment by melle — October 4, 2008 @ 11:04 am

  2. Maybe you could install a webcam and a remote control *g*

    Comment by Oliver — October 4, 2008 @ 12:36 pm

  3. Can you tell me how you installed debian on the Alix? Are there helping documents?

    Comment by Ericsson — October 6, 2008 @ 1:05 am

  4. I have a Microdrive in the ALIX, pretend that it’s a normal harddisk based system and use the regular Debian PXE installation procedure. It should work fine with a CF card as well; restrictions regarding write cycles do apply, though.

    You can get rid of the test-based menus and speed up installation by appending “DEBIAN_FRONTEND=text” to pxelinux.cfg/default as outlined here. It seems I should use english more often as my blogging language. 😉

    Comment by martin — October 6, 2008 @ 4:43 am

  5. Hi your project sounds excellent could you post a working cf image?

    Comment by Richard — November 7, 2008 @ 11:19 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: