[Nut-upsdev] Changes to usbhid-ups driver
Peter Selinger
selinger at mathstat.dal.ca
Tue Sep 4 18:34:18 UTC 2007
Arjen de Korte wrote:
>
> Peter Selinger wrote:
>
> >>> The Belkin device gives its serial number in both places. The one in
> >>> UPS.PowerSummary.iSerialNumber is strictly for the convenience of
> >>> being able to display the serial number with upsc. It's not necessary
> >>> for matching.
> >> In that case, the better option would be in the HID-to-NUT translation
> >> table for Belkin, like
> >>
> >> { "ups.serial", 0, 0, "UPS.PowerSummary.iSerialNumber", NULL, "%s",
> >> HU_FLAG_OK, stringid_conversion },
> > I just checked again, and it turns out that I misspoke. My Belkin
> > device shows the serial number only in UPS.PowerSummary.iSerialNumber,
> > and *not* in (usb_device *)descriptor.iSerialNumber, which is exactly
> > what you originally said. Sorry for that. -- Peter
>
> In that case, the 'matching = delayed' is just what you want. That will
> initially match only on the subdriver_matcher (ie, VendorID and
> ProductID), then read and parse the report descriptor, apply the vendor
> specific formatting and only then do the regex and exact matching. It
> will also check if all commands and variables are still available as a
> bonus (we need that, since all pointers for the HID-to-NUT translation
> will be changed because of parsing a new report descriptor).
>
> I just applied the patch (r1087) to make this effective (ie, let the
> belkin_format_serial() function modify hd->Serial, instead of just
> returning a pointer to the serial number). Is the same valid for the
> (usb_device *)descriptor.iManufacturer and (usb_device
> *)descriptor.iProduct by the way? There is no reason why we couldn't do
> the same for belkin_format_mfr() and belkin_format_model(), if that is
> useful.
Yes, that information is also unavailable in the usb_device
structure. I don't currently remember whether it is in the UPS.*
hierarchy, but I think it isn't. The belkin_format_mfr() etc functions
just return generic values unless better info is available. (From the
vendorid, we do know the manufacturer is Belkin).
-- Peter
More information about the Nut-upsdev
mailing list