[Nut-upsuser] Issue with two UPS APC managed from a single PC.

Jim Klimov jimklimov+nut at gmail.com
Sun Feb 26 11:04:42 GMT 2023


Hello, and thanks for the details.

The device matcher goes through given configuration "clues" until something
does not match (so with few enough clues it could not discern several
identical devices causing a undefined behavior (for more info peruse
https://github.com/networkupstools/nut/issues?q=label%3AUSB-duplicate-devices+
issues and PRs).

Here the problem seems to be the lack of discovered "device" number
(possibly due to a NUT bug addressed this January in master branch, or
libusb did not report the value) while you try to match by it. "Unknown"
(or null) is not "005" hence no match. For the time being, comment that
line away (or try building current NUT :))

In earlier posts you also lacked the vendorid/productid matching, which got
me to notice that for your devices they are a different couple (PIDs
differ) so maybe specifying just them would suffice.

The "desc" field is not used for matching, it is a convenience description
like "UPS for Web server". You might have been after "product" (string or
regex generally) to get the particular device. Note that matching by this
exact string could be not future-proof - it seems to include the firmware
version, etc. On that note, we had reports of APC devices changing the
"productid" number with a major firmware version change upon flashing an
upgrade (e.g. "0003" => "0004"). Using the "serial" matching option is also
a good idea, when devices do provide a value (and it is stable and unique -
e.g. some respond, but spew an ambiguous line of zeroes).

Hope this helps,
Jim Klimov


On Fri, Feb 24, 2023 at 11:58 PM Laurent Taieb <laurenttaieb at free.fr> wrote:

> Sorry, but to add again
>
> I have further updated ups.conf
>
>
>
> *[myups1]*
>
>         driver = usbhid-ups
>
>         port = auto
>
>         vendorid = "051d"
>
>         productid = "0003"
>
>         desc = "Smart-UPS_1500 FW:UPS 04.6 / ID=1018"
>
>         bus = "002"
>
>         device = "005"
>
>         pollonly
>
>
>
>
>
> # To find out if your driver supports any extra settings, start it with
>
> # the -h option and/or read the driver's documentation.
>
>
>
> *[myups2]*
>
>         driver = usbhid-ups
>
>         port = auto
>
>         vendorid = "051d"
>
>         productid = "0002"
>
>         bus = "002"
>
>         device = "003"
>
>         pollony
>
>
>
>
>
>
>
> $ sudo ./usbhid-ups -a myups1 -DDD
>
> Network UPS Tools - Generic HID driver 0.47 (2.8.0)
>
> USB communication driver (libusb 1.0) 0.43
>
>    0.000000   [D1] debug level is '3'
>
>    0.001750   [D2] Initializing an USB-connected UPS with library
> libusb-1.0.26 (API: 0x1000109) (NUT subdriver name='USB communication
> driver (libusb 1.0)' ver='0.43')
>
>    0.001775   [D1] upsdrv_initups (non-SHUT)...
>
>    0.010544   [D2] Checking device 1 of 7 (051D/0003)
>
>    0.027034   [D2] - VendorID: 051d
>
>    0.027070   [D2] - ProductID: 0003
>
>    0.027124   [D2] - Manufacturer: American Power Conversion
>
>    0.027147   [D2] - Product: Smart-UPS_1500 FW:UPS 04.6 / ID=1018
>
>    0.027158   [D2] - Serial Number: AS2212262511
>
>    0.027178   [D2] - Bus: 002
>
>    0.027195   [D2] - Device: unknown
>
>    0.027208   [D2] - Device release number: 0001
>
>    0.027221   [D2] Trying to match device
>
>    0.027238   [D2] match_function_subdriver (non-SHUT mode): matching a
> device...
>
>    0.027264   interrupt pipe disabled (add 'pollonly' flag to 'ups.conf'
> to get rid of this message)
>
>    0.027280   [D3] match_function_regex: matching a device...
>
>    0.027400   [D2] match_function_regex: failed match of Device: (null)
>
>    0.027412   [D2] Device does not match - skipping
>
>    0.027444   [D2] Checking device 2 of 7 (051D/0002)
>
>    0.037719   [D2] - VendorID: 051d
>
>    0.037773   [D2] - ProductID: 0002
>
>    0.037785   [D2] - Manufacturer: American Power Conversion
>
>    0.037800   [D2] - Product: Back-UPS XS 1400U  FW:926.T2 .I USB FW:T2
>
>    0.037813   [D2] - Serial Number: 4B1835P44428
>
>    0.037826   [D2] - Bus: 002
>
>    0.037840   [D2] - Device: unknown
>
>    0.037854   [D2] - Device release number: 0106
>
>    0.037868   [D2] Trying to match device
>
>    0.037882   [D2] match_function_subdriver (non-SHUT mode): matching a
> device...
>
>    0.037900   [D3] match_function_regex: matching a device...
>
>    0.037920   [D2] match_function_regex: failed match of ProductID:    2
>
>    0.037942   [D2] Device does not match - skipping
>
>    0.037979   [D2] Checking device 3 of 7 (8087/0024)
>
>    0.038013   [D1] Failed to open device (8087/0024), skipping: Access
> denied (insufficient permissions)
>
>    0.038031   [D2] Checking device 4 of 7 (1D6B/0002)
>
>    0.038060   [D1] Failed to open device (1D6B/0002), skipping: Access
> denied (insufficient permissions)
>
>    0.038079   [D2] Checking device 5 of 7 (1BCF/2C18)
>
>    0.038107   [D1] Failed to open device (1BCF/2C18), skipping: Access
> denied (insufficient permissions)
>
>    0.038125   [D2] Checking device 6 of 7 (8087/0024)
>
>    0.038153   [D1] Failed to open device (8087/0024), skipping: Access
> denied (insufficient permissions)
>
>    0.038170   [D2] Checking device 7 of 7 (1D6B/0002)
>
>    0.038196   [D1] Failed to open device (1D6B/0002), skipping: Access
> denied (insufficient permissions)
>
>    0.038212   [D2] libusb1: No appropriate HID device found
>
>    0.038239   libusb1: Could not open any HID devices: insufficient
> permissions on everything
>
>    0.038253   No matching HID UPS found
>
> $
>
>
>
>
>
> *De : *Nut-upsuser <nut-upsuser-bounces+laurenttaieb=
> free.fr at alioth-lists.debian.net> au nom de Laurent Taieb via Nut-upsuser <
> nut-upsuser at alioth-lists.debian.net>
> *Répondre à : *"laurenttaieb at free.fr" <laurenttaieb at free.fr>
> *Date : *vendredi 24 février 2023 à 23:32
> *À : *Jim Klimov <jimklimov+nut at gmail.com>, nut-upsuser Mailing List <
> nut-upsuser at lists.alioth.debian.org>
> *Objet : *Re: [Nut-upsuser] Issue with two UPS APC managed from a single
> PC.
>
>
>
> To complement
>
> I’ve tried to launch the driver directly and got this error mesg
>
>
>
> $ sudo /lib/nut/usbhid-ups -a myups1 -DDD
>
>    0.000000   [D1] debug level is '3'
>
>    0.001656   [D2] Initializing an USB-connected UPS with library
> libusb-1.0.26 (API: 0x1000109) (NUT subdriver name='USB communication
> driver (libusb 1.0)' ver='0.43')
>
>    0.001680   [D1] upsdrv_initups (non-SHUT)...
>
>    0.009987   [D2] Checking device 1 of 7 (051D/0003)
>
>    0.026102   [D2] - VendorID: 051d
>
>    0.026123   [D2] - ProductID: 0003
>
>    0.026140   [D2] - Manufacturer: American Power Conversion
>
>    0.026156   [D2] - Product: Smart-UPS_1500 FW:UPS 04.6 / ID=1018
>
>    0.026169   [D2] - Serial Number: AS2212262511
>
>    0.026186   [D2] - Bus: 002
>
>    0.026221   [D2] - Device: unknown
>
>    0.026235   [D2] - Device release number: 0001
>
>    0.026269   [D2] Trying to match device
>
>    0.026282   [D2] match_function_subdriver (non-SHUT mode): matching a
> device...
>
>    0.026323   interrupt pipe disabled (add 'pollonly' flag to 'ups.conf'
> to get rid of this message)
>
>    0.026348   [D3] match_function_regex: matching a device...
>
>    0.026455   [D2] match_function_regex: failed match of Device: (null)
>
>    0.026475   [D2] Device does not match - skipping
>
>    0.026668   [D2] Checking device 2 of 7 (051D/0002)
>
>    0.036755   [D2] - VendorID: 051d
>
>    0.036775   [D2] - ProductID: 0002
>
>    0.036784   [D2] - Manufacturer: American Power Conversion
>
>    0.036792   [D2] - Product: Back-UPS XS 1400U  FW:926.T2 .I USB FW:T2
>
>    0.036800   [D2] - Serial Number: 4B1835P44428
>
>    0.036808   [D2] - Bus: 002
>
>    0.036817   [D2] - Device: unknown
>
>    0.036827   [D2] - Device release number: 0106
>
>    0.036841   [D2] Trying to match device
>
>    0.036858   [D2] match_function_subdriver (non-SHUT mode): matching a
> device...
>
>    0.036889   [D3] match_function_regex: matching a device...
>
>    0.036922   [D2] match_function_regex: failed match of Device: (null)
>
>    0.036938   [D2] Device does not match - skipping
>
>    0.036965   [D2] Checking device 3 of 7 (8087/0024)
>
>    0.037000   [D1] Failed to open device (8087/0024), skipping: Access
> denied (insufficient permissions)
>
>    0.037016   [D2] Checking device 4 of 7 (1D6B/0002)
>
>    0.037055   [D1] Failed to open device (1D6B/0002), skipping: Access
> denied (insufficient permissions)
>
>    0.037071   [D2] Checking device 5 of 7 (1BCF/2C18)
>
>    0.037097   [D1] Failed to open device (1BCF/2C18), skipping: Access
> denied (insufficient permissions)
>
>    0.037124   [D2] Checking device 6 of 7 (8087/0024)
>
>    0.037157   [D1] Failed to open device (8087/0024), skipping: Access
> denied (insufficient permissions)
>
>    0.037171   [D2] Checking device 7 of 7 (1D6B/0002)
>
>    0.037199   [D1] Failed to open device (1D6B/0002), skipping: Access
> denied (insufficient permissions)
>
>    0.037215   [D2] libusb1: No appropriate HID device found
>
>    0.037337   libusb1: Could not open any HID devices: insufficient
> permissions on everything
>
>    0.037374   No matching HID UPS found
>
>
>
> Definitions in ups.conf. I’m unsure whether I shall define port or other
> items.
>
>
>
> [myups1]
>
>        driver = usbhid-ups
>
>        port = auto
>
> #      port = /dev/usb/hiddev0
>
> #   cable = usb
>
>        desc = "Smart-UPS_1500 FW:UPS 04.6 / ID=1018"
>
>        bus = 002
>
>        device = 003
>
>
>
>        pollonly
>
>
>
>
>
> # To find out if your driver supports any extra settings, start it with
>
> # the -h option and/or read the driver's documentation.
>
>
>
> [myups2]
>
>        driver = usbhid-ups
>
>        port = auto
>
>        desc = "*500*"
>
>        bus = 002
>
>        device = 005
>
>
>
>        pollony
>
>
>
> Thanks
>
> Laurent
>
>
>
> *De : *Nut-upsuser <nut-upsuser-bounces+laurenttaieb=
> free.fr at alioth-lists.debian.net> au nom de Laurent Taieb via Nut-upsuser <
> nut-upsuser at alioth-lists.debian.net>
> *Répondre à : *"laurenttaieb at free.fr" <laurenttaieb at free.fr>
> *Date : *vendredi 24 février 2023 à 23:17
> *À : *Jim Klimov <jimklimov+nut at gmail.com>, nut-upsuser Mailing List <
> nut-upsuser at lists.alioth.debian.org>
> *Objet : *Re: [Nut-upsuser] Issue with two UPS APC managed from a single
> PC.
>
>
>
> Hi Jim,
>
> Yes both UPS are on the same machine.
>
> I moved away from Ubuntu and  tried with Kali and got a slightly different
> issue as the driver even doesn’t start properly.
>
> I used the standard apt-get command to download nut and added libusb-dev
> which wasn’t by default on kali.
>
>
>
> I went to Kali nut web page and downloaded all packages 😊
>
> hiddev0 and hiddev1 have been created in /dev/usb and changed the group to
> nut as they’ve been created with root group.
>
>
>
> I have attached the lsusb traces for the 2 UPS
>
>
>
> When starting the driver I got this message
>
>
>
> $ sudo upsdrvctl start
>
> Network UPS Tools - UPS driver controller 2.8.0
>
> Network UPS Tools - Generic HID driver 0.47 (2.8.0)
>
> USB communication driver (libusb 1.0) 0.43
>
> interrupt pipe disabled (add 'pollonly' flag to 'ups.conf' to get rid of
> this message)
>
> libusb1: Could not open any HID devices: insufficient permissions on
> everything
>
> No matching HID UPS found
>
> Driver failed to start (exit status=1)
>
>
>
>
>
> Thanks for your help and guidance.
>
> Laurent
>
>
>
> *De : *Jim Klimov <jimklimov+nut at gmail.com>
> *Date : *lundi 20 février 2023 à 13:43
> *À : *nut-upsuser Mailing List <nut-upsuser at lists.alioth.debian.org>
> *Cc : *"laurenttaieb at free.fr" <laurenttaieb at free.fr>
> *Objet : *Re: [Nut-upsuser] Issue with two UPS APC managed from a single
> PC.
>
>
>
> Is that with both UPSes on same machine?
>
>
>
> A quick guess would be that insufficient data points to identify the
> device are configured (vendorid, productid, serial...) in ups.conf, so both
> drivers connect to the first match. I'd expect them to conflict and one
> would die or both loop reconnecting, if both are running at once, though.
>
>
>
> Also, which NUT version? Custom build from GitHub or an (older?) distro
> package?
>
>
>
> Jim
>
>
>
> On Mon, Feb 20, 2023, 12:28 Manuel Wolfshant via Nut-upsuser <
> nut-upsuser at alioth-lists.debian.net> wrote:
>
>
>
> On February 20, 2023 12:01:46 PM GMT+02:00, Laurent Taieb via Nut-upsuser <
> nut-upsuser at alioth-lists.debian.net> wrote:
> >Hi mailing list,
> >I looked at all FAQ and docs and can’t find a solution.
> >I installed but on both Kali Linux and Ubuntu.
> >(For comparison purposes)
> >I’m trying to connect and monitor two UPS APC via usb.
> >One is a back-ups bx1400 which I can see via via upsc.
> >The second one is a more recent one smc 1500ic which when I poke it via
> upsc returns the data of the bx1400 one.
> >I tried by changing port and other tricks but no success.
> >Would anyone have a clue of what the issue could be ?
>
> Hello
>
> Can you please share the configuration you have used, as well as the
> output of lsusb ?
>
> wolfy
>
>
> >Thanks
> >
> >Laurent
> >_______________________________________________
> >Nut-upsuser mailing list
> >Nut-upsuser at alioth-lists.debian.net
> >https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
>
> _______________________________________________
> Nut-upsuser mailing list
> Nut-upsuser at alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
>
> _______________________________________________ Nut-upsuser mailing list
> Nut-upsuser at alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
>
> _______________________________________________ Nut-upsuser mailing list
> Nut-upsuser at alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/nut-upsuser/attachments/20230226/9ad73d65/attachment-0001.htm>


More information about the Nut-upsuser mailing list