Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend NUT USB drivers to allow iterating all of libusb discovered devices #1756

Closed
jimklimov opened this issue Jan 2, 2023 · 0 comments · Fixed by #1770
Closed

Extend NUT USB drivers to allow iterating all of libusb discovered devices #1756

jimklimov opened this issue Jan 2, 2023 · 0 comments · Fixed by #1770
Labels
service/daemon start/stop General subject for starting and stopping NUT daemons (drivers, server, monitor); also BG/FG/Debug USB USB-duplicate-devices Track bugs and issues about monitoring several devices that seem identical to NUT or libusb
Milestone

Comments

@jimklimov
Copy link
Member

Currently NUT drivers require an USB device which matches all configured criteria for detection. Unfortunately data points like bus or device may change over time (e.g. upon re-plugging), and VID:PID may be not unique if somebody monitors several closely related devices (from the same OEM or vendor, likely same model) while serial fields are not populated.

  • NOTE: At least in libusb-0.1 model, the OS-provided (possibly end-user tailored) device node paths are not a consulted data point, as far as is known/assumed, so a dummy port = auto is typically used (some port value is required for generic NUT driver config syntax). Related issue Extend NUT USB drivers with libusb-1 to not ignore "port" setting #1565 explores this direction.

If several drivers are started and may only realistically match e.g. VID:PID (same for several devices), currently one driver would get access and others would be denied with LIBUSB_ERROR_BUSY, at least if libusb returns the list of enumerated devices always in same order.

As discussed in #1744 this issue proposes to add an option to allow proceeding with device enumeration until all candidates from libusb have been looked at, instead of aborting at LIBUSB_ERROR_BUSY. Note that this inherently makes the device discovery non-deterministic - we have no practical way of saying which of the two identically looking devices is "A" and which is "B" - but in some cases we do not care (e.g. as long as one PSU of several is powered by whoever, we are satisfied).

@jimklimov jimklimov added USB USB-duplicate-devices Track bugs and issues about monitoring several devices that seem identical to NUT or libusb labels Jan 2, 2023
@jimklimov jimklimov added this to the 2.8.1 milestone Jan 2, 2023
@jimklimov jimklimov added the service/daemon start/stop General subject for starting and stopping NUT daemons (drivers, server, monitor); also BG/FG/Debug label Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/daemon start/stop General subject for starting and stopping NUT daemons (drivers, server, monitor); also BG/FG/Debug 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 a pull request may close this issue.

1 participant