[Nut-upsuser] [UPS on Serial vs. USB] USB slow to update, serial instant.

Arjen de Korte nut+users at de-korte.org
Sat Jan 27 16:14:42 CET 2007


> When I disconnect my UPS from the wall, I have to wait 15-30 seconds
> before the USB drier 'polls' this information and tells me that the UPS is
> on battery power (via knutclient or syslog via nut):
>
> ups at p34 POWER ALERT on Fri Jan 26 12:49:29 EST 2007
>
> With a serial connection, I would get the alerts IMMEDIATELY (0.5-1
> seconds) after disconnecting the UPS.  My new machine does not have a
> serial port built-in, only a serial header, and of course does not come
> with an included cable, so I chose to use USB.

Which serial driver have you been using so far? Most serial drivers will
poll the UPS every two seconds for status updates. So on average, you'll
see status changes in about half that time, which equals about one second.
So far the number of UPSes that issue alerts on line status changes is
limited and hence we don't have that many drivers that use this feature.
But generally speaking, what you're seeing is normal for a driver that
uses the serial interface.

> My question is, how do I change the polling time that nut uses to poll the
> device to match that of the serial port?

That depends on the driver you're using. If you're using the newhidups
driver (which will be renamed usbhid-ups in the next release), there is
probably not much you can do about this. Many USB protocols are *very*
verbose and don't allow polling the status every two seconds. Therefore,
the newhidups has a build in mechanism to only do a full status update
every 30 seconds (if memory serves). If you're using another driver, you
could try the 'pollinterval' parameter (see 'man 5 ups.conf' for a
description after verifying that the man page of the driver does not
mention it).

> The reason I'd like to is I am not going to see any power alerts for
> unless there is a power outage for longer than 15-30 seconds.

Use a less verbose (serial) driver in that case. There is probably nothing
else we can do for you right now. A driver that uses a more intelligent
mechanism to read status changes more frequently is planned, but so far we
have no schedule for its release (not even for an experimental/trial
version, don't ask).

> I've checked the FAQ on this, do I have to change the 'MAXAGE' parameter
> to force more frequent updates?

No. The MAXAGE parameter only determines when to declare a driver stale.
If we don't hear anything from a driver for this many seconds, it is
declared stale. This has nothing to do with the polling interval.

Best regards, Arjen
-- 
Eindhoven - The Netherlands
Key fingerprint - 66 4E 03 2C 9D B5 CB 9B  7A FE 7E C1 EE 88 BC 57




More information about the Nut-upsuser mailing list