[Nut-upsdev] Changes to usbhid-ups driver

Arjen de Korte nut+devel at de-korte.org
Tue Aug 28 07:20:13 UTC 2007


> this certainly sounds like a good idea. However, this requires a lot
> of changes and testing. Perhaps it's more of a long-term plan? Can you
> think of a sequence of small, easy-to-test changes that would
> gradually lead from here to there?

Sure. My first proposal would be to always use the 'regex' matcher on
opening the USB device and only run the 'exact' matcher *after* applying
the subdriver specific ways to find the vendor, model and serial strings.

> One potential problem is that opening devices often requires detaching
> a linux kernel driver, and this can lead to mice and keyboards
> disconnected. So if there is, for example, a Belkin mouse, then there
> is a bit of a catch: you don't know if it's a UPS until you open it,
> but by the time you have opened it, it's already too late.

I hadn't thought about that, but indeed, that would be a problem. Relaxing
the device matching before making the decision to read the report
descriptor is not a good idea.

> Perhaps we are fixing a problem that nobody is having. I have not seen
> any report on any of the mailing lists by somebody who actually needed
> to distinguish devices by serial number, but couldn't.

It would probably only be a problem for devices that don't have their
serial number in (usb_device *)descriptor.iSerialNumber, but rather in
"UPS.PowerSummary.iSerialNumber" (like in the belkin-hid subdriver).

> A more minimalist solution would be to leave the exact matcher as it
> was, and wait until someone logs a feature request.

I'm not intending to change the exact matcher, just the place where we use
it. Assuming the device specific information will remain the same, the
only people that might see a difference would be Belkin HID UPS owners.

Best regards, Arjen





More information about the Nut-upsdev mailing list