[Nut-upsuser] nut on armhf, r-pi4b IOW
Charles Lepple
clepple at gmail.com
Wed Jan 22 00:52:01 GMT 2020
On Jan 21, 2020, at 7:50 AM, Gene Heskett <gheskett at shentel.net> wrote:
>
> Now I've got another of those WTF questions. This ups doesn't ID itself
> the same to an lsusb as it does to upsc.
> From an lsusb:
> Bus 001 Device 004: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS
The two IDs are vendor (VID) and product (PID). lsusb looks them up in a text file, typically /usr/share/misc/usb.ids, and concatenates the vendor and product strings in the short output format that you quoted.
NUT reports those hex numbers as ups.vendorid and ups.productid, respectively, but doesn't look them up in usb.ids.
> From a upsc:
> device.mfr: CPS
> device.model: CP625HGa
>
These strings are retrieved from the UPS itself. If you run "lsusb -v -d 0764:0501" as root, you should see output similar to what I got from an APC:
$ sudo lsusb -v -d 051d:
Bus 006 Device 002: ID 051d:0003 American Power Conversion UPS
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x051d American Power Conversion
idProduct 0x0003 UPS
bcdDevice 1.06
iManufacturer 1 American Power Conversion
iProduct 2 Smart-UPS C 1000 FW:UPS 10.0 / ID=1005
...
The strings to the right of iManufacturer and iProduct are what the usbhid-ups driver returns under device.mfr and device.model. (Sometimes device.model is trimmed down, as is the case for APC firmware strings.)
lsusb won't show the strings if you don't run it as root, since it needs privileges to send the request to retrieve the strings. Since NUT drivers need read/write access to USB devices anyway, the NUT USB code retrieves the full strings.
More information about the Nut-upsuser
mailing list