Skip to content

Fix common USB matching options for bcmxcp_usb#2270

Draft
jimklimov wants to merge 12 commits intonetworkupstools:masterfrom
jimklimov:issue-1754-bcmxcp
Draft

Fix common USB matching options for bcmxcp_usb#2270
jimklimov wants to merge 12 commits intonetworkupstools:masterfrom
jimklimov:issue-1754-bcmxcp

Conversation

@jimklimov
Copy link
Member

@jimklimov jimklimov commented Jan 19, 2024

Parked per #1764 and #1763, something like this should be needed to solve #597 (but progress on development should better be tested against real devices):

Note: "bcmxcp_usb" driver suffers a similar problem but was not easy to fix in a similar fashion (conflicts with symbols in the built LIBUSB_IMPL of the day, and impacts nut-scanner build per different dependency chain), so attempt to fix it along with others was shelved.

Posting as a PR to avoid dropping the source branch (and to let CI give it a shot) :)

@jimklimov jimklimov added MGE MGE branded devices and (USB) chipsets, now part of Eaton; mostly bcmxcp drivers Qx protocol driver Driver based on Megatec Q<number> such as new nutdrv_qx, or obsoleted blazer and some others USB-duplicate-devices Track bugs and issues about monitoring several devices that seem identical to NUT or libusb and removed Qx protocol driver Driver based on Megatec Q<number> such as new nutdrv_qx, or obsoleted blazer and some others labels Jan 19, 2024
@jimklimov jimklimov added need testing Code looks reasonable, but the feature would better be tested against hardware or OSes needs-work PR discussion concluded that some work is needed from the contributor labels Jan 19, 2024
@jimklimov jimklimov marked this pull request as draft January 19, 2024 13:21
@AppVeyorBot
Copy link

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@AppVeyorBot
Copy link

@jimklimov
Copy link
Member Author

Resyncing with main NUT code base after v2.8.3 release.

@jimklimov jimklimov marked this pull request as ready for review April 25, 2025 08:27
@jimklimov jimklimov added this to the 2.8.4 milestone Apr 25, 2025
@jimklimov
Copy link
Member Author

Parked code has got a few issues to address:

/usr/bin/ld: ./.libs/libnutscan.so: undefined reference to `bcmxcp_makevartable'
/usr/bin/ld: libusb0.o:(.data+0x0): multiple definition of `comm_upsdrv_info'; bcmxcp_usb.o:(.data+0x0): first defined here

@jimklimov jimklimov marked this pull request as draft April 25, 2025 08:49
@jimklimov jimklimov modified the milestones: 2.8.4, 2.8.5 Jul 29, 2025
…om PR networkupstools#2270

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…cp sources [networkupstools#2270]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…o avoid linker conflict with libusb{0,1}.c [networkupstools#2270]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…s#2270

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov jimklimov marked this pull request as ready for review January 27, 2026 16:23
@jimklimov
Copy link
Member Author

jimklimov commented Jan 27, 2026

Resolved the basic language/recipe conflicts at least, so the driver variables should be there. Whether they get picked up by *usb_open() is a matter to be tested.

jimklimov added a commit to jimklimov/nut that referenced this pull request Jan 27, 2026
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
jimklimov added a commit to jimklimov/nut that referenced this pull request Jan 27, 2026
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov
Copy link
Member Author

Seems these common options are not used still, but at least are recognized:

:; NUT_STATEPATH=/tmp ./drivers/bcmxcp_usb -s test -DDDDDDD -x port=auto -x vendorid=2131 -x productid=1231

   0.000000     [D5] send_to_all: SETINFO driver.state "init.starting"
Network UPS Tools 2.8.4.1223.26-1249+g025370490 (development iteration after 2.8.4) - BCMXCP UPS driver 0.40
USB communication subdriver 0.29
   0.000119     [D5] send_to_all: SETINFO driver.version.usb "libusb-1.0.26 (API: 0x01000109)"
   0.000125     [D1] Using USB implementation: libusb-1.0.26 (API: 0x01000109)
   0.000146     [D3] main_arg: var='port' val='auto'
   0.000150     [D6] testinfo_reloadable: var=port, infoname=driver.parameter.port, newval=auto, reloadable=0, reload_flag=0
   0.000157     [D6] testinfo_reloadable: verdict for (re)loading var=port value: 1
   0.000163     [D5] send_to_all: SETINFO driver.parameter.port "auto"
   0.000173     [D3] main_arg: var='vendorid' val='2131'
   0.000178     [D5] send_to_all: SETINFO driver.parameter.vendorid "2131"
   0.000181     [D3] main_arg: var='productid' val='1231'
   0.000185     [D5] send_to_all: SETINFO driver.parameter.productid "1231"
   0.000188     [D1] Network UPS Tools version 2.8.4.1223.26-1249+g025370490 (development iteration after 2.8.4), 64-bit build for x86_64, built with Ubuntu clang version 16.0.6 (15); Target: x86_64-pc-linux-gnu; Thread model: posix and configured with flags: --enable-Wcolor --enable-configure-debug --enable-warnings --enable-Werror --enable-keep_nut_report_feature --with-all=auto --with-cgi=auto --with-serial=auto --with-dev=auto --with-nut_monitor=auto --with-pynut=auto --disable-force-nut-version-header --enable-check-NIT --enable-maintainer-mode --with-doc=skip --enable-docs-man-for-progs-built-only=no PKG_CONFIG_PATH=/usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig --disable-silent-rules --enable-docs-changelog=no --with-unmapped-data-points --with-debuginfo=auto CC=/usr/lib/ccache/clang CXX=/usr/lib/ccache/clang++ CPP='clang -E' CCACHE_BASEDIR=/home/abuild/nut CCACHE_DIR=/home/abuild/.ccache CCACHE_PATH=/home/abuild/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin CCACHE_NAMESPACE=nut:x86_64-pc-linux-gnu --no-create --no-recursion
   0.000222     [D1] debug level is '7'
   0.000227     [D5] send_to_all: SETINFO driver.debug "7"
   0.000233     [D5] send_to_all: SETFLAGS driver.debug RW NUMBER
   0.000336     [D1] Can not become_user(nobody): not root initially, remaining UID=399 GID=399
   0.000359     [D1] Signalling UPS [test]: driver.exit (quietly, no fuss if no driver is running or responding)
   0.000383     Can't open /tmp/bcmxcp_usb-test: No such file or directory
   0.000388     [D1] Request for other driver to exit returned code -1
   0.000392     [D1] Socket dialog with the other driver instance (may be absent) failed: No such file or directory
   0.000397     [D5] send_to_all: SETINFO device.type "ups"
   0.000401     [D5] send_to_all: SETINFO driver.state "init.device"
   0.000404     [D1] entering nutusb_open()
   0.004588     [D1] Can't open POWERWARE USB device
   0.004596     [D1] Can't open POWERWARE USB device
   0.004600     [D1] Can't open POWERWARE USB device
   0.004603     [D1] Can't open POWERWARE USB device
Unable to find POWERWARE UPS device on USB bus (USB)

Things to try:

 - Connect UPS device to USB bus

 - Run this driver as another user (upsdrvctl -u or 'user=...' in ups.conf).
   See upsdrvctl(8) and ups.conf(5).

   0.004629     Fatal error: unusable configuration
   0.004635     [D5] send_to_all: SETINFO driver.state "cleanup.exit"
   0.004667     upsnotify: notify about state NOTIFY_STATE_STOPPING with libsystemd: was requested, but not running as a service unit now, will not spam more about it
   0.004674     [D1] On systems without service units, consider `export NUT_QUIET_INIT_UPSNOTIFY=true`
   0.004678     [D1] upsnotify: failed to notify about state NOTIFY_STATE_STOPPING: no notification tech defined, will not spam more about it

@jimklimov
Copy link
Member Author

Yeah, with added debugging we can see this driver deals with its device table only (e.g. no custom vendorid/productid/bus... matching like done with most other drivers):

...
   0.003256     [D1] entering nutusb_open()
   0.008781     [D3] is_usb_device_supported: checking if this driver can support USB device VID:PID 0x0463:0xFFFF
   0.009194     [D4] is_usb_device_supported: checking table entry for VID:PID 0x0592:0x0002 (custom init handler is available)
   0.009536     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.009876     [D4] is_usb_device_supported: checking table entry for VID:PID 0x06DA:0x0002 (custom init handler is available)
   0.010207     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010212     [D4] is_usb_device_supported: checking table entry for VID:PID 0x03F0:0x1F01 (custom init handler is available)
   0.010216     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010219     [D4] is_usb_device_supported: checking table entry for VID:PID 0x03F0:0x1F02 (custom init handler is available)
   0.010223     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010227     [D3] is_usb_device_supported: checking if this driver can support USB device VID:PID 0x048D:0x5702
   0.010231     [D4] is_usb_device_supported: checking table entry for VID:PID 0x0592:0x0002 (custom init handler is available)
   0.010234     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010237     [D4] is_usb_device_supported: checking table entry for VID:PID 0x06DA:0x0002 (custom init handler is available)
   0.010241     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010244     [D4] is_usb_device_supported: checking table entry for VID:PID 0x03F0:0x1F01 (custom init handler is available)
   0.010247     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010251     [D4] is_usb_device_supported: checking table entry for VID:PID 0x03F0:0x1F02 (custom init handler is available)
   0.010254     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010258     [D1] Can't open POWERWARE USB device
   0.010265     [D3] is_usb_device_supported: checking if this driver can support USB device VID:PID 0x0463:0xFFFF
   0.010268     [D4] is_usb_device_supported: checking table entry for VID:PID 0x0592:0x0002 (custom init handler is available)
   0.010272     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010275     [D4] is_usb_device_supported: checking table entry for VID:PID 0x06DA:0x0002 (custom init handler is available)
   0.010278     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010281     [D4] is_usb_device_supported: checking table entry for VID:PID 0x03F0:0x1F01 (custom init handler is available)
   0.010284     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010287     [D4] is_usb_device_supported: checking table entry for VID:PID 0x03F0:0x1F02 (custom init handler is available)
   0.010291     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010294     [D3] is_usb_device_supported: checking if this driver can support USB device VID:PID 0x048D:0x5702
   0.010297     [D4] is_usb_device_supported: checking table entry for VID:PID 0x0592:0x0002 (custom init handler is available)
   0.010300     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010303     [D4] is_usb_device_supported: checking table entry for VID:PID 0x06DA:0x0002 (custom init handler is available)
   0.010306     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010309     [D4] is_usb_device_supported: checking table entry for VID:PID 0x03F0:0x1F01 (custom init handler is available)
   0.010312     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010315     [D4] is_usb_device_supported: checking table entry for VID:PID 0x03F0:0x1F02 (custom init handler is available)
   0.010318     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010320     [D1] Can't open POWERWARE USB device
   0.010325     [D3] is_usb_device_supported: checking if this driver can support USB device VID:PID 0x0463:0xFFFF
   0.010328     [D4] is_usb_device_supported: checking table entry for VID:PID 0x0592:0x0002 (custom init handler is available)
   0.010331     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010334     [D4] is_usb_device_supported: checking table entry for VID:PID 0x06DA:0x0002 (custom init handler is available)
   0.010337     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010340     [D4] is_usb_device_supported: checking table entry for VID:PID 0x03F0:0x1F01 (custom init handler is available)
   0.010343     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010346     [D4] is_usb_device_supported: checking table entry for VID:PID 0x03F0:0x1F02 (custom init handler is available)
   0.010349     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010353     [D3] is_usb_device_supported: checking if this driver can support USB device VID:PID 0x048D:0x5702
   0.010356     [D4] is_usb_device_supported: checking table entry for VID:PID 0x0592:0x0002 (custom init handler is available)
   0.010359     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010362     [D4] is_usb_device_supported: checking table entry for VID:PID 0x06DA:0x0002 (custom init handler is available)
   0.010364     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010367     [D4] is_usb_device_supported: checking table entry for VID:PID 0x03F0:0x1F01 (custom init handler is available)
   0.010370     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010373     [D4] is_usb_device_supported: checking table entry for VID:PID 0x03F0:0x1F02 (custom init handler is available)
   0.010376     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010379     [D1] Can't open POWERWARE USB device
   0.010384     [D3] is_usb_device_supported: checking if this driver can support USB device VID:PID 0x0463:0xFFFF
   0.010387     [D4] is_usb_device_supported: checking table entry for VID:PID 0x0592:0x0002 (custom init handler is available)
   0.010390     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010394     [D4] is_usb_device_supported: checking table entry for VID:PID 0x06DA:0x0002 (custom init handler is available)
   0.010396     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010399     [D4] is_usb_device_supported: checking table entry for VID:PID 0x03F0:0x1F01 (custom init handler is available)
   0.010402     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010405     [D4] is_usb_device_supported: checking table entry for VID:PID 0x03F0:0x1F02 (custom init handler is available)
   0.010408     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010411     [D3] is_usb_device_supported: checking if this driver can support USB device VID:PID 0x048D:0x5702
   0.010414     [D4] is_usb_device_supported: checking table entry for VID:PID 0x0592:0x0002 (custom init handler is available)
   0.010417     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010420     [D4] is_usb_device_supported: checking table entry for VID:PID 0x06DA:0x0002 (custom init handler is available)
   0.010423     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010425     [D4] is_usb_device_supported: checking table entry for VID:PID 0x03F0:0x1F01 (custom init handler is available)
   0.010428     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010431     [D4] is_usb_device_supported: checking table entry for VID:PID 0x03F0:0x1F02 (custom init handler is available)
   0.010434     [D4] is_usb_device_supported: NOT_SUPPORTED: vendor ID mismatch
   0.010437     [D1] Can't open POWERWARE USB device
Unable to find POWERWARE UPS device on USB bus (USB)
...

jimklimov added a commit to jimklimov/nut that referenced this pull request Jan 27, 2026
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov
Copy link
Member Author

Recap: so far this PR got updated to pass the builds with code "knowing" about the common driver option names, but the rest (actually honouring them) still needs to be implemented, and falls out of the nearest release cycle.

@jimklimov jimklimov modified the milestones: 2.8.5, 2.8.6 Jan 28, 2026
@jimklimov jimklimov marked this pull request as draft January 28, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

MGE MGE branded devices and (USB) chipsets, now part of Eaton; mostly bcmxcp drivers need testing Code looks reasonable, but the feature would better be tested against hardware or OSes needs-work PR discussion concluded that some work is needed from the contributor 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.

2 participants