[collectd] new plugin - multimeter

Claus Herwig lists at checon.de
Wed Aug 16 18:24:03 CEST 2006


Hi,

> I didn't do much serial port programming (apart from some experiments
> involving an Intel 80286 and QuickBasic, quite a while back ;), so, is
> there a way to automagically detect these values? I guess `no', but I
> honestly don't know.

Just trying to remember my old BBS times...

There's no real "autodetect" functionality for RS232 (serial port). Only
thing you can do is "walk through" the most probable set of settings.
For each setting send a "reset" plus a kind of status command and listen
for the answer. If you get a reasonable one, parameters are right.
Advantage: You can't break anything this way. And only a few
combinations are widely used, so the odds are good to actually find the
parameters. Disadvantage: Detection will take a while, you've to
re-detect it on every start of collectd and it's error-prone anyway.

In detail, as far as I know you've three parameters to detect:
- speed: 2400, 9600, 19200, 57600, 115200 (most common only)
- amount of Bits, Parity, Stoppbits used - normaly 8N1 (8 Bits, no
parity, 1 Stop) or 7E1 (7 Bit, even parity, 1 Stop)
- Handshake: Hardware (uses two/four wires of the interface called
RTS/CTS and DTR/DSR) or Software (two special ASCII-Chars called
XON/XOFF in the normal datastream)

Unfortunately nobody forbids you to connect "your" device with 4800bps
and 7E2. So, to detect only the common combinations would need 20 tries
and it's not guaranteed to get a result.

I would propose to use vendor name and type as a configuration value and
hardcode the parameters in the plugin. You could add flexibility with a
second config value which allows to set the interface manually if
needed. Something like:
<metex>
  type: manual
  settings: 19200-8N1-HW
</metex>

Greets,
  Claus

-- 
CHECON   EDV-Consulting und Redaktion
         Claus Herwig * Barer Straße 70 * 80799 München
         +49 89 27826981 * Fax 27826982 * c.herwig at checon.de




More information about the collectd mailing list