Bug 275293 - sysutils/nut: CyberPower SX650G no longer works with nut 2.8.1
Summary: sysutils/nut: CyberPower SX650G no longer works with nut 2.8.1
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Cy Schubert
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-24 07:34 UTC by Xin LI
Modified: 2023-11-24 16:10 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (cy)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xin LI freebsd_committer freebsd_triage 2023-11-24 07:34:57 UTC
I have a CyberPower SX650G which is connected via USB cable.  After upgrading to nut-2.8.1_1 from nut-2.8.0_24, the USB connectivity appeared to stop working.

It seems that there is a bug introduced in upstream cbfe3a8ccd72cd890a72bc2d81c293d849e5cb23 that introduced a requirement that bus number has to be non-zero, which doesn't make sense because the 0 is a valid bus number.

I have submitted a patch to upstream at https://github.com/networkupstools/nut/pull/2198 to address this.  The patch applies cleanly on nut 2.8.1 so please consider including it in the port too.
Comment 1 commit-hook freebsd_committer freebsd_triage 2023-11-24 16:06:57 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8d2996f519277001777d07bd61c9cdab77a5c334

commit 8d2996f519277001777d07bd61c9cdab77a5c334
Author:     Xin LI <delphij@FreeBSD.org>
AuthorDate: 2023-11-24 15:52:06 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2023-11-24 16:03:39 +0000

    sysutils/nut: Remove unnecessary validation for bus_num

    The libusb_get_bus_number() function serves as a simple accessor for
    the bus number of the opaque device struct. Unlike
    libusb_get_port_number(), it does not have the ability to convey
    errors back to the caller, and a bus number of 0 is a valid value.
    Therefore, any validation around bus_num is redundant.

    This commit removes the unnecessary validation code related to bus_num.

    Signed-off-by: Xin LI <delphij@FreeBSD.org>

    PR:                     275293
    Upstream commit:        4aeb199eb
    Upstream Pull Request:  https://github.com/networkupstools/nut/pull/2198/

 sysutils/nut/Makefile                            |  2 +-
 sysutils/nut/files/patch-drivers_libusb1.c (new) | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
Comment 2 Cy Schubert freebsd_committer freebsd_triage 2023-11-24 16:10:06 UTC
Thanks.

Incorporated your commit into the port and updated the nut-devel port to the latest upstream commit.