Welcome to PARSLED, the Linux pushbutton and LED control program.

First off, you need to obtain or build suitable hardware to use this program.
Candidate 1 is Guido Socher's (guido@linuxfocus.org) SLED for which this program has been written originally. See here. The SLED hardware is attached to a free serial port, so you'll need one of those.
Candidate 2 is Volker Gering's parallel port device, documented on this page, see below.

What it does.

parsled controls the device's LEDs. It makes them flash or display certain internal states. Then, parsled handles pushbutton presses and executes commands as soon as it detects a push button press of suitable length.

What is it for?

parsled is intended to initiate very low-level commands for keyboard- and monitor-less (server) computers such as system shutdown and/or network up/down.

Of course, having a programmable flashing LED on your computer is geeky in itself :-) (But not really rocket science).

parsled is intended for Linux systems. Probably it can be used under other operating systems, too, but this has not yet been tested.

How it works.

parsled is a user-space program that is intended to be executed during system startup via rc scripts. It controls the LEDs and reads the push button connected to one of the serial (new since 0.5: or parallel) ports. parsled used a polling mechanism to remain as simple as possible.

How to make it.

The supplied make file should cut it. Just type make. If this fails, play with the compiler and its settings. Simply compile all source files and link them together to make the executable.

Notice: Kernel 2.4.xx

The Linux include file lp.h now defines the constants required by parsled without the __KERNEL__ preprocessor definition. With the definition still in the code, compilation fails. Consequently, the definition has been removed from the one source file where this was used (ParSledExecutor.cpp).

The Makefile assumes that your default installation of gcc is capable of linking C++ programs. If you get linker errors, you may need to install libstdc++ and include a suitable linker parameter in the Makefile (-l stdc++ -L/usr/lib).


parsled is configured via a configuration file that usually resides in /etc/parsled.conf. See the distribution config file for a description of available features.


The latest version of this code can be downloaded here (parsled-0.51.tar.gz). The default configuration file, which is contained in the tarball, can be downloaded separately here (parsled.conf.default). It is commented and describes what can be done with parsled.

NEW: Parallel Port Device.

Volker Gering (volker dot gering at siemens dot com) has contributed code changes and a device for the parallel port. When all serial ports are taken, this comes in handy. The device really is simple, click here for the schematic (N.B. "low power LEDs" should read "low current LEDs"). A parallel port plug case provides plenty of space to hold all (just five) components. I drilled two small holes each for the LED leads so that the LEDs stand out and can be seen from a far wider range. The leads are twisted inside so that the LEDs cannot fall out. Click here for a picture of my efforts.


In order to avoid versioning conflicts with respect to Guido's original SLED I have renamed this project "parsled" (parallel and serial LED control). While I was at it I even changed the source code to reflect the new name which probably was a little over the top...


0.51 -May 29th 2003
 Adjusted to building on recent Linux kernels where lp.h defines the necessary symbols even without __KERNEL__ being defined.
0.5 -December 21st 2002
 Incorporated Volker Gering's extension for his parallel port device.
 Changed file format to UNIX-only. Previous release did contain some CRLF line endings.
 Updated this page.
0.2 -July 4th 2001
 initial release (sled-0.2.tar.gz)


Numerous. There are bugs. None of the ones I know of really hurt. Send feedback when you want anything changed. Here's my current list:

  1. Config file scanner does not handle required/optional fields.
  2. Overlapping group windows are not detected.
  3. Config file errors are reported merely via process return code, and even this is broken.
  4. No notice is given if command execution fails. This is not even checked.
  5. There are no security checks regarding PID file creation/deletion or config file writability/ownership.
  6. LED mode RUNLEVEL does not work reliably (any hints?).
  7. There is no documentation.
  8. There is no description on how to link parsled into the startup process (hint: use rc3.d/S99parsled, also see here)
  9. Anyone cares to run a memory leak checker on this?
  10. A feature is missing that resets the group state after a certain timeout.
  11. It would be nice to have a feature that allows to set the LEDs from other programs.
  12. Shouldn't this be a kernel module, controllable via the /proc interface?
  13. ...


The contained config file reader may be useful in itself. But it needs some brushing-up. By the way, this is a C++ progam, so you need a C++ compiler to compile it. I use gcc which should work fine in all recent versions. I did not use any of the more obscure C++ features. Still, this may well be my last C++ program. I do Java now (esp. J2EE, JSP & Servlets), and it just kind of hurts to have no garbage collector, readily available containers, robust strings, throw-in properties files, you name it...

Folks at LEARN actually have used parsled in one of their projects: see here.

You may also be interested in this article: "Displaying Real Time System information on a LCD Display using LCDproc & lcdmod" on linuxgazette.com


...go to Guido Socher for (one more) of his fabulous circuits that do a lot with virtually no parts. And for fixing my TV set back then by first shorting the broken fuse and then replacing the transistor that got blown for good subsequently.

...and to Volker Gering for his ready-to-use support of a parallel device. Thank you!

Send feedback and suggestions to m.g@rtner.de

This code is GPL'ed. Enjoy!

Matthias Gaertner.


This page was last changed on May 29th, 2003. © Matthias Gärtner 2003