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

Arjen de Korte nut+devel at de-korte.org
Thu Aug 30 12:31:56 UTC 2007


[ new 'reconnect' option ]

> [restart]
> Same as reload, but don't run the 'exact' matcher after reading the report
> descriptor. Since this may mean we're connecting to a completely different
> device we brutally DELCMD/DELINFO everything we have and act as restarting
> the driver (including creating a new 'exact' matcher). Not for the faint
> of heart.

I made one slight mistake here, it's not the same as 'reload', but more
accurately 'retry' with fallback.

This isn't as bad as I initially thought, since the usbhid-ups driver
won't work as expected anyway if you have multiple UPS'es and multiple
drivers that use the same regular expressions. All drivers would connect
to the first matching device on startup, since we don't do port locking
(if that's possible with USB at all). So this problem would surface
immediately at startup. Only when you add a UPS *after* startup of the
driver, this might go wrong in 'restart' mode provided that the regex
matcher doesn't deal with the new situation already *and* the UPS doesn't
provide a unique serial number.

I'll commit this change later today. It was ready yesterday actually, but
the segfaults caused by the error in Parse_ReportDesc() prevented me from
committing it. I should lay more trust in 'valgrind', that had been
complaining about this from the very first time I ran it with the driver.
What we can learn from this, is that it is not a good idea to make
assumptions on the size of a variable and that sizeof() should be used
instead... :-)

Best regards, Arjen




More information about the Nut-upsdev mailing list