Creating a /dev/prolite Device on Linux
Creating the device is as simple as figuring out what serial port you've
got the sign hooked up to. For instance, COM1:
# ln -s /dev/cua0 /dev/prolite
If you are brave, you can give the world read/write access to your sign.
This may be important, especially if you are using a web server to
update the sign.
# chmod a+rw /dev/prolite
Configuring the Communication Settings
Commands can be echo'd to the ProLite once the terminal is
properly configured (9600,N,8,1):
$ stty 0:705:bd:0:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:73 < /dev/prolite
$ echo "<ID01><PA>Your Message Here" > /dev/prolite
This is the same as $ stty opost -ocrnl onlcr -echo 9600 < /dev/prolite
Binary Access to the Device
If you are intent on sending the Control-M Control-J terminators yourself,
the serial port will accomodate that as well (9600,N,8,1):
$ stty 0:700:bd:0:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:73 < /dev/prolite
This is the same as $ stty -opost -ocrnl -onlcr -echo 9600 < /dev/prolite
Avoid Using Echo
This tip comes from Steve Baker, who points out that it is necessary to
add -echo, otherwise the sign's reply of
<ID01>\r\n gets echoed back to the sign,
which the sign thinks is an empty wakeup command, so it sends another,
and an infinite loop results.
Steve also points out that it should be emphasized that you should
wait for the sign's reply. Some commands take a while to respond,
and if you send another command while the sign is still thinking about
the prior one, it can screw up the sign's internal state.
Wait Between Characters
It should also be pointed out that it's very easy for the computer
to outrun the sign, even at the specified baudrate and settings
because there is no flow control in either hardware or software.
In some cases, you may want to consider the sign a write-only
device, pausing several milliseconds between sending characters.
Waiting momentarily between commands is also advisable.
A Suggested Script Format
This tip comes from David McInnis. He suggests that setserial is
not sufficient for setting the baudrate, and that stty
must be used.
His bash script has three steps:
- Set the communications up for the sign:
stty opost -ocrnl onlcr -echo 9600 < /dev/prolite
- Use a script to generate some output:
YourContentScriptHere > /tmp/somefile
- Send that file to the sign:
cat /tmp/somefile > /dev/prolist
This technique allows for easy debugging, because the content for the
sign is kept separate from the delivery mechanism.
|