I made the changes I described in the previous entry and plcd seems to be much more stable. It is still possible to crash it, but it's occuring much less frequently.
I also decided over the weekend to write a tool to talk with the PLM. This tool will enable me to get send bespoke commands to the PLM and to devices. Things that are useful to determine what is happening but really are unnecessary in a properly running system. Link database reads of the PLM for example, or getting extra data from a device.
The tool has a command line interface and accepts various commands, to connect to a PLM, send group and standard commands, I want to add a "raw" command so that I can simply send bytes to the PLM, but the tool is coming along nicely.