[Nut-upsdev] [nut-commits] svn commit r1074 - in trunk: .
Peter Selinger
selinger at mathstat.dal.ca
Thu Sep 6 02:51:35 UTC 2007
Arjen de Korte wrote:
>
> Ultimately, this boils down to the problem that we're trying to do add
> hotplugging support to a driver, where it should really be handled by the
> kernel (or HAL daemon for that matter). The hotplugging support for USB is
> not in the drivers. The more I'm looking into this, the more I think the
> regular expression (exact) matching is a gross hack at best. I understand
> (and appreciate) the reasons how we came to this, but in the end I don't
> like the result at all. It currently works reasonably well for devices
> that can be uniquely identified through the regex matching mechanism, but
> if this is not possible (for whatever reason) you're limited to just one
> UPS on your system, which wouldn't be neccessary with hotplugging support.
I am not sure how the kernel or HAL are supposed to distinguish devices
that we can't. They see the same information that our driver sees.
> I really think we'd better put our effort into adding *real* hotplugging
> support. At least, that's where I'm going to put my effort in the next
> couple of weeks (months). We badly need it to use the information the HAL
> daemon provided about the whereabouts of the UPS, rather than trying to
> detect it ourselves again (which was already done by the HAL daemon), with
> the limitation that we can only support one UPS per system, because we
> can't use the regular expression matching. What would be nice also, if we
> would not need to make a choice between HAL and NUT support, but that the
> HAL capable drivers (one dedicated one for each subdriver we have now)
> would also allow monitoring by the (upsd) server.
I don't think it's as bad as you say. We are not trying to hot-plug
anything. We are just writing a driver that can support multiple
similar devices, and that has some reasonable behavior when a device
gets disconnected (which, given that many devices we support have
crappy firmware, happens often and without user intervention).
I don't have HAL support installed on my system, and perhaps never
will. I see the usefulness of hotplugging for iPods and portable disks
and other gadgets, but UPS devices are not that "hot".
Anyway, perhaps you are overreacting. All I was saying (in a
discussion that started weeks ago) is that MODE_REOPEN should be
replaced by MODE_OPEN in usbhid-ups.c line 1007, circa revision
r1000. Given that neither MODE_REOPEN nor MODE_OPEN still exists in
the current revision, the discussion is moot.
Another point I was trying to make is that in addition to checking the
productid, vendorid, and serial number, we could and should also check
the CRC32 sum of the report descriptor, which is easy to calculate.
While it does not identify a device uniquely among a set of identical
devices, at least it identifies *only* identical devices. You are
right that we could put the burden on the user to ensure that they
don't have such devices. But most users are clueless and it's an easy
and safe thing to do. Okay, perhaps not so high on the priority list.
-- Peter
More information about the Nut-upsdev
mailing list