David Douthitt has been working hard on cleaning up and
enhancing LCDproc. He's submitted several patches
(thankfully they're cummulative :). Here are his
comments about them (chronological order):
Also, I didn't like the way that LCDd opens up port
13666 to the world;
attached is a patch which also makes it easy to add a
* LCDd now uses getopt_long(3)
* Refuses to "load" driver named "base"
* Help display shows valid available drivers
* Text Driver now has a help screen and exits properly
when options are
* Better bombproofing
* Development code can be seen for using tcpwrappers --
initial viewing of hosts_access(3).
* sprintf has been replaced with snprintf in the server
not in any of the drivers).
I also used sprintf(x, sizeof(x), "...") instead of
"...") as the bugtraq posting suggested: sizeof() is, I
believe, a macro
and thus generates a fixed number at compile time, and
automatically accomodate larger buffers without
(except to recompile).
Applying this patch to 0.4.1 should be fine. It
replaces blindly all
sprintf with snprintf in the server, but mainly
replaces sections of
code in the MtxOrb driver (MtxOrb.c) like so:
sprintf(out, "%cV%c", 254, 0);
write(fd, out, 3);
write(fd, "\x0FEV\x000", 3);
In some cases, this results in out becoming
unnecessary; many times it
removes the need for a sprintf() call.
This patch should result in a basically working LCDd.
MtxOrb.c (the Matrix Orbital driver) is heavily
modified. There are a
lot of comments now sprinkled within the code; some
and ideas. The code to analyze the options was heavily
most "manipulations" (such as analyzing options and
being shifted to separate functions. A conversion
(again) to getopts(3)
is in the future.
There is a new command available in the driver
structure (getinfo) and
the MtxOrb driver takes advantage of it.
There is also a new command for the server (in
output this string.
Unfortunately, I can't seem to be able to get any
output from the
display in this program... So until some kind somebody
ideas, the "info" returned will only display the
current driver name.
I also took out the "bye" when the daemon quits - it
was showing up in
triples and even on the display at times.
I looked at input.c, but couldn't make it work for me.
I did try
setting the keys differently for the LK202-25 - it
generates keys for A
F K I and N (with two missing keys?!).
A - right arrow
F - down
K - left
I - up
N - F2
? - F1
? - Enter
Anyone know what those other keys ought to be?
Also, shouldn't "backlight" support be relegated to the
drivers might not support the backlight.
Many of the changes I make are just designed to make it
maintain the code and to understand what is happening.
The biggest things I did here was to go through
cleaning out all the argument count testing code, as
well as returning
the usage of a command if no arguments are given.
The big change with the argument testing code was that
now, there is,
wherever possible, a SINGLE test to divide the bad
argument counts from
the valid argument counts - which is faster.
It would also appear that there were bugs in this code;
argc counts all
argument entries, including argv. Some code also
appeared to have
been cut and pasted, but not fixed up.
I also changed the exit code so that stdin, stdout, and
stderr are not
closed (as requested in the code). I also changed
test errno; however, errno appears to often have the
("Resource temporarily unavailable") so I tested for
that. I suspect
that this is from other file descriptors, and not from
client_set_func seemed to have some errors; I gave it a
I updated MtxOrb.c some; I mucked with input.c. My
keyboard on my
LK202-25 gives a funky set of keys; it is "codified" in
input.c - change
The biggest change was parse.c; I changed it to use
pointers and do a
scan character by character. I also added the
1. Now a '#' in the first position is ignored as a comment.
2. Now excess whitespace should be handled (don't know
if it was
2a. Also, a line of ONLY whitespace is handled
2b. I think, too, that an EMPTY line will be handled
3. Tabs are *NOT* considered whitespace; neither is a
Whew! Thanks David for all these contributions!
Log in to post a comment.