BLINKENmini compatible BlinkenLeds driver
-----------------------------------------

bmdrv_leds is a kernel module for Linux 2.4 that proviedes BLINKENmini compatible support for the BlinkenLeds device. If you do not know what the BLINKENmini device is take a look at http://blinkenmini.1stein.no-ip.com/. If you do not know what BlinkenLeds is take a look at http://www.jalcds.de/blinkenleds/.

bmdrv_leds provides a charcater devices for output and one for input. The major device number is 0xB0 (176) and the minor numbers is 0. The communication with the real BlinkenLeds device uses the parallel port. When loading the module, the IO settings can be specified.



Compiling (Linux 2.4)
---------------------

Since you are reading this, you already unpacked the archive into a directory. If you have a symbolic link at /usr/src/linux to your current kernel source, you should be able to compile the module:

  make

This should create a file named bmdrv_leds.o. If you get some errors, check the include directories in Makefile. You can copy the file to your module directory if you want:

  su
  mkdir /lib/modules/<kernel-version>/bmdrv_leds
  cp bmdrv_leds.o /lib/modules/<kernel-version>/bmdrv_leds/
  chmod 644 /lib/modules/<kernel-version>/bmdrv_leds/bmdrv_leds.o
  exit



Compiling (Linux 2.6)
---------------------

Since you are reading this, you already unpacked the archive into a directory. If you have a symbolic link at /usr/src/linux to your current kernel source, you should be able to compile the module:

  su
  ./build26
  mkdir /lib/modules/<kernel-version>/bmdrv_leds
  cp bmdrv_leds.ko /lib/modules/<kernel-version>/bmdrv_leds/
  chmod 644 /lib/modules/<kernel-version>/bmdrv_leds/bmdrv_leds.o
  exit



Creating the Devices
--------------------

Now you'll have to create the device in /dev/:

  su
  cd /dev
  mknod bmdrv.out c 176 0
  chmod 666 bmdrv.out
  exit



Loading and Unloading the Driver
--------------------------------

To load the driver you have to find out what the IO settings are for your parallel port. On most systems, the first parallel port has got the settings IO=0x378 and the second one IO=0x278. You also have to ensure that no other device is using theese resources. (This can be checked with "cat /proc/ioports".)
Then you can load the module:

  su
  insmod bmdrv_leds.o io=<io-port>
  exit

You can look at your kernel-messages to view the output of bmdrv.

Now you can use the driver, e.g. copy a binary movie to it.

  cp my_movie.bmbm /dev/bmdrv.out

To unload the driver just remove the module:

  su
  rmmod bmdrv_leds
  exit



Output Device
-------------

When writing data to /dev/bmdrv.out, the data is expected to be in the bmbm-format. This format consists of one or more frames directly behind each other. A frame has got the following format:

<frame> = <size-x><size-y><row>...<row><delay> //size-y times row <row>
<row> = <pixel>...<pixel> //size-x times <pixel>
<size-x> = the width of the frame in pixels as unsigned char
<size-y> = the height of the frame in pixels as unsigned char
<pixel> = the greyscale value of that pixel as unsigned char, 0x00 dark, 0xFF full on
<delay> = the time to hold execution after displaying this frame in steps of 5ms as unsigned char

When reading from /dev/bmdrv.out, the read-function returns always 0.

