Tue, 27 Sep 2005
Intrusion control panel and Linux
Yesterday I've been trying to make an intrusion control panel talk to the Linux box. The panel itself is connected to motion sensors via its own cabling, and with the Linux box via a RS-232 serial line. It worked on old Red Hat Linux system with a 2.4 kernel, but after an upgrade to the 2.6 kernel it stopped working - the panel looked as if it received no input from the Linux side (altough the output direction such as status reporting looked fine).
Even with 2.4 kernel the communication was not straightforward. It seems there is some kind of timing issue between the panel and the computer - in 2.4 we had to do "setserial /dev/ttyS0 uart 16450 low_latency" to make it working. With the 2.6 kernel the timing has changed, and the software has stopped talking to the panel. And what was worse, the setserial hack above nor any changes using stty did not help.
After few hours of testing I tried to recompile the kernel with faster system timer (HZ=1000), and insert a 1ms sleep before sending each byte to the panel. It suddenly started to work. I wonder what crappy implementation of RS-232 the panel has, that cannot handle even an input of two conecutive bytes (even with two stop-bits to make the gap longer). A positive outcome is that the 2.6 kernel proved itself to be faster than 2.4, because it can send individual bytes over the RS-232 port in low-latency mode faster than 2.4.