Skip to content

nut-scanner: report same USB matching values as seeked by libusb{0,1}.c#1795

Merged
jimklimov merged 3 commits intonetworkupstools:masterfrom
jimklimov:issue-1790
Jan 11, 2023
Merged

nut-scanner: report same USB matching values as seeked by libusb{0,1}.c#1795
jimklimov merged 3 commits intonetworkupstools:masterfrom
jimklimov:issue-1790

Conversation

@jimklimov
Copy link
Member

@jimklimov jimklimov commented Jan 10, 2023

Closes: #1790

Currently nut-scanner did not report a device value (should mean physical port number on a hub, where supported and not much guaranteed), so systems connected to two UPSes from same vendor could not discern between them (especially if handled by same USB bus, and lacking a serial number).

Many USB drivers use the common routine (more after #1763 was merged) which checks for device = NNN if provided.

For that matter, the common matcher also reports (and considers internally) the "bcdDevice" (version) although does not match it from user-provided configuration. FWIW this change prints that value out, commented.

Example output after the change:

:; ./tools/nut-scanner/nut-scanner -U
Scanning USB bus.
[nutdev1]
        driver = "usbhid-ups"
        port = "auto"
        vendorid = "0463"
        productid = "FFFF"
        product = "Ellipse ECO"
        serial = "000000000"
        vendor = "EATON"
        bus = "003"
        device = "002"
        ###NOTMATCHED-YET###bcdDevice = "0100"

which matches lsusb report:

:; lsusb | grep 463
Bus 003 Device 002: ID 0463:ffff MGE UPS Systems UPS

@jimklimov jimklimov added enhancement nut-scanner USB USB-duplicate-devices Track bugs and issues about monitoring several devices that seem identical to NUT or libusb labels Jan 10, 2023
@jimklimov jimklimov added this to the 2.8.1 milestone Jan 10, 2023
@clepple clepple removed their request for review January 11, 2023 01:56
@jimklimov jimklimov merged commit d111e73 into networkupstools:master Jan 11, 2023
@jimklimov jimklimov deleted the issue-1790 branch January 11, 2023 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement nut-scanner USB USB-duplicate-devices Track bugs and issues about monitoring several devices that seem identical to NUT or libusb

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nut-scanner does not suggest a "device" matching setting for USB

1 participant