[Nut-upsdev] Megatec driver : Definitely a serial com setup issue !

Michel Bouissou michel-nut at bouissou.net
Sat May 24 11:14:55 UTC 2008


Hi there,

I wanted to try to debug what was happening between the nut 2.2.2 Megatec 
driver and my UPS, so I installed a serial port sniffer software, 
http://sourceforge.net/projects/slsnif/

Then I fired up slsnif and started the Megatec driver, but 
specifying "/dev/ttyp0" instead of "/dev/ttyS0" in ups.conf (ttyp0 being 
intercepted by the sniffer and then routed out to ttyS0)

To my huge surprise the Megatec driver said :

# drivers/megatec -DDD -a Alpha
Network UPS Tools 2.2.2 - Megatec protocol driver 1.5.14 [megatec]
Carlos Rodrigues (c) 2003-2008

debug level is '3'
Starting UPS detection process...
Asking for UPS status [Q1]...
Q1 => OK [(238.3 238.3 238.3 013 50.0 13.8 32.0 00001000]
Asking for UPS status [Q1]...
Q1 => OK [(238.3 238.3 238.3 012 50.0 13.8 32.0 00001000]
Asking for UPS status [Q1]...
Q1 => OK [(238.3 238.3 238.3 012 50.0 13.8 32.0 00001000]
Asking for UPS status [Q1]...
Q1 => OK [(238.3 238.3 238.3 013 50.0 13.8 32.0 00001000]
Asking for UPS status [Q1]...
Q1 => OK [(238.3 238.3 238.3 013 50.0 13.8 32.0 00001000]
0 out of 5 detection attempts failed (minimum failures: 2).
Cancelling any pending shutdown or battery test.
Asking for UPS information [I]...
I => OK [#UNITEK          Alpha500iC A0        ]
Megatec protocol UPS detected [UNITEK Alpha500iC A0].
Parameter [ignoreoff]: [false]
Asking for UPS power ratings [F]...
F => OK [#230.0   6  12.0 50.0]
12.0V battery, interval [9.7V, 13.7V].
Done setting up the UPS.
Asking for UPS status [Q1]...
Q1 => OK [(236.7 236.7 236.7 013 50.0 13.8 32.0 00001000]
Calculated battery charge: 100.0%

Fatal error: unable to create listener socket

bind /var/state/ups/megatec-Alpha failed: Permission denied

Exiting.


Okay, I don't care about the end, that's a permission issue, but this shows 
that :

- The serial dialog being somewhat "remixed" by the serial sniffer, the 
Megatec driver is happy and finds my UPS.

- When trying to talk to the serial port by itself, the Megatec driver 
miserably fails. I have double-checked that there is no permission issue with 
the serial port itself, of course...

So in some manner the "sniffer" fixes nut's driver (in)ability to properly use 
the computers' serial port.

This is completely reproductible and 100% consistent everytime.

Uh, Uh... Any clue ?

-- 
Michel Bouissou <michel at bouissou.net> OpenPGP ID 0xEB04D09C



More information about the Nut-upsdev mailing list