My good friend leftyfb asked me to take a look at a LED display system, it’s one of those funky arrays of coloured LEDs that allows you to program in various messages.
Problem is, this display (SLC16H-IR aka CL-A7×80RG) doesn’t have any linux based software. But there is an ancient windows program that does work in wine. Job solved you might think? Well not quite, how about if we want to script this thing or tie it into our emails and have blinking lights for breakfast?
So I had to set about reverse engineering the serial protocol by using a program running in wine that was connecting via a serial port. I did this by firstly downloading a program called slsnif, it’s old and hasn’t been updated for 3 years, but works.
This device is running over USB, so it has in it a usb to serial chip supported by the linux kernel, this produces the node /dev/ttyUSB0 when it’s plugged in. So I just tie this serial port into slsnif like so:
slsnif /dev/ttyUSB0 –color=black -s 2400 -x
This creates a new node called /dev/ttyp0 where the signal is forwarded.
I then used this in wine, creating a symlink from /dev/ttyp0 to ~/.wine/dosdevices/com1. Loading the SLC16H editor.exe program via wine, I was then able to use each of the functions via COM1 and decode the protocol from the output from slsnif. Here is my results for anyone else with this device: Launchpad branch with protocol and code
Then using this protocol documentation (always remember to document!) I created a quick python script which will open a serial port specified and insert messages.
Now there was one snag, the LED display is supposed to support 8 user defined images. I worked out how the editor.exe program was trying to set these images into the device (and documented it) but the defice just returned an error code when ever either the original app or my script tried to set them. This is one reason why all devices should come with full disclosure of protocols, not just obscure windows apps. We can’t fix anything if you broke the app.
Now with all that done, I just have to give this LED sign back to my friend…