Ian Campbell: Consolidating Qcontrol Configuration Files
A little while ago Michele Cane filed Debian bug #689912 against
qcontrol asking that the package install the correct
configuration file for a TS-419P II, a newer device which has an
LCD.
It turns out that to support devices with LCDs properly we need to
probe a GPIO line in order to figure out if an LCD is attached or if a
serial console is in use (since the two are mutually exclusive on this
hardware, when you attach a serial console you must toggle a jumper
too).
This actually turns out to be rather trivial since
qcontrol
's
configuration files are actually simple Lua
programs and the state of the GPIO lines can be accessed via sysfs and
so we can read the state directly from the configuration file itself.
While looking into this I happened to notice that the various
board-specific configuration files are actually very similar and that
the differences can all be detected by a combination of the Hardware
field in /proc/cpuinfo
and the GPIO lines.
So I started looking into whether I could write a single consolidated
qcontrol.conf
file to replace the various variant specific files. It
turns out to be quite possible, the resulting consolidated file has
been posted to the bug
log
(see also my
mail).
The danger with configuration files which are also
fully-fledged programming languages is that there is a temptation to
write more and more complex configuration files with the danger that
the primary purpose of the file (configuration) can be obscured. I
think in this case it is a close call but on balance I think the
downsides outweigh the advantages, so I've uploaded qcontrol
0.4.2+svn-r40-2 which simply adds LCD support to the relevant board
specific configuration file.
In process of doing so I seem to have fallen into a trap which seems
to catch out many sbuild
users at least once and uploaded a package
with "UNRELEASED" still in the changelog. To try and save myself (and
others) some blushes in the future I've filed Debian bug #693841
(wishlist) against dput
to see if it can catch this case, I've also
added to my prerelease checklist.
As it happens my own TS-419P II arrived today. I intend to use it for
second tier storage (mythtv recordings, music, mirrors) as well as
light server duties (MTA, internal DNS etc) which should allow me to
turn off the existing PC in the cupboard under the stairs which is
getting a bit long in the tooth and starting to become a bit
unreliable (I also suspect its costing a fortune to run).