[Nut-upsdev] [nut-commits] svn commit r1073 - in trunk: .

Arjen de Korte nut+devel at de-korte.org
Fri Aug 24 20:20:49 UTC 2007


Peter Selinger wrote:

>> We could also create a function in the subdrivers, that would be appended
>> to the list of matchers, once we have found a subdriver. Subdrivers not
>> needing this would simply provide a stub that always matches. This would
>> allow subdrivers the freedom to look anywhere in the UPS for data to match
>> on.
> Yes. This can wait until it's actually needed though. 

Apparently, Charles would like to have this.

>> I even think we should add a 'relaxed_reopen' flag (or something like
>> that) that would need to be set to allow fallback from MODE_REOPEN to
>> MODE_OPEN. I would rather see a warning about stale data, than the driver
>> connecting to some other device. Broken UPS'es should not be made the
>> norm, although we should try our best to workaround known problems.
> Fair enough. But I think there might still be a problem in the current
> code, where I am not sure if the HID tables will be reloaded if we
> connect first to device A, then to device B, and then reconnect to
> device A again later. At the last connection to device A, "reopen" was
> successful, and if we're not careful, device A might be running with
> B's HID-tables. I haven't checked the code to see if that's what's
> currently happening.

You're absolutely right, this would cause a problem. One could fix that
(by checking whether the previous connect was a regex or an exact one),
but I don't think we should follow that path. Basically the only reason
to use an exact matcher, is that you're more confident that you're
talking to the same UPS should it ever reconnect. Other than that, using
the regex matcher that is used on startup is probably fine too.

So you would choose the "exact" matcher if the UPS is connected to a
server, for which it is unlikely that the USB connection is replugged
once it is running and you really need to know which UPS you're talking
to. The 'Bus' is probably fairly static too, so we should add this to
the reopen_matcher.

On the other hand, there may be desktop applications where unplugging
the UPS may occur and we can't be certain that it is replugged into the
same 'Bus'. Here the convenience of the 'regex' matcher autodetecting
where the UPS is connected on a reconnect is probably more important
than the guarantee that it still the same device (on most desktop
systems, there probably will be only one anyway).

Therefor, I think we should either use MODE_REOPEN or MODE_OPEN, based
on a configuration option. Having it default to 'regex' would result in
less question, however it would be a change compared to the existing
bahaviour of only allowing 'exact' matches on reload. Therefor, I opted
to make 'exact' the default for now.

Best regards, Arjen



More information about the Nut-upsdev mailing list