[Nut-upsuser] ownership of pid directory

Arjen de Korte nut+users at de-korte.org
Fri Dec 29 09:34:25 CET 2006


Doug Reynolds wrote:

> After during some extreme testing of my CPS1200AVR, the trouble isn't
> 100% with the driver. The driver itself works the way it should.

I beg to differ. If the UPS shuts down without warning, which it doesn't
when you're using the genericups driver or Windows software, the problem
*is* in the driver.

> I've found if you issue those UPS commands thru a serial port, the UPS acts
> the same (shuts down after a couple minutes).  The ups worked _great_
> with the generic driver, but you don't get all those nifty, smart
> features).

That's an interesting remark. If I understand correctly, you use
upstype=7 with the genericups driver? We could try if setting up cable
power helps here.

> The only difference I can figure out is that the Windows UPS
> driver holds one of the control pins high until it wants the UPS to shut
> down (I noticed this when I had the ups on my Windows machine and was
> monitoring the serial port).

Can you figure out which pin? I suspect that the normal situation will
be RTS=1 and DTR=0 and that they reverse when shutting down (this mimics
upstype=7 for the genericups driver). It might be that this UPS has two
shutdown methods ('smart' via the "S01R0001\r" command and 'dumb'
through raising DTR). It could be that the Windows software uses both to
handle both smart and dumb UPS'es with the same driver.

> At that time, I didn't really think it was
> important.  However, not being super knowledgeable with c/cpp (or the
> NUT format, for that matter), I haven't been able to do much
> experimentation with it.  I guess I'm going to have to subscribe to
> nut-dev.

Excellent! In the mean time, could you try if the following patch helps
to resolve this issue?

Best regards, Arjen

=======================================

--- drivers/cpsups.c        (revision 670)
+++ drivers/cpsups.c        (working copy)
@@ -470,9 +470,19 @@

 void upsdrv_initups(void)
 {
+       int dtr_bit = TIOCM_DTR;
+       int rts_bit = TIOCM_RTS;
+
        upsfd = ser_open(device_path);
        ser_set_speed(upsfd, device_path, B2400);

+       /*
+        * Set RTS and clear DTR to provide power for
+        * the serial interface. It looks like some
+        * Cyberpower UPS'es require this.
+        */
+       ioctl(upsfd, TIOCMBIS, &rts_bit);
+       ioctl(upsfd, TIOCMBIC, &dtr_bit);
 }

 void upsdrv_cleanup(void)



More information about the Nut-upsuser mailing list