Skip to content

Conversation

@jimklimov
Copy link
Member

Note: this is currently somewhat hardcoded for MSYS2 packaging of mingw-w64-x86_64-libusb-win32 so if other environments (32-bit MSYS2, cross-builds on Linux, etc) would be pursued, changes to m4 scripts here should get refactored for more flexibility.

Currently this allows to build against "modern" (post 2011) releases of libusb-win32, to let someone iterate on making it functional as a variant of libusb-0.1 implementation.

Currently the driver quickly refuses to start:

> usbhid-ups.exe -a nutdev1 -DDDDDD
Network UPS Tools - Generic HID driver 0.49 (Windows-v2.8.0-alpha3-754-g7ecd1949d)
USB communication driver (libusb 0.1) 0.43
   0.000000     [D1] debug level is '6'
   0.001401     [D5] send_to_all: SETINFO device.type "ups"
   0.003262     [D2] Initializing an USB-connected UPS with library libusb-0.1 (or compat) (NUT subdriver name='USB communication driver (libusb 0.1)' ver='0.43')
   0.007734     [D1] upsdrv_initups (non-SHUT)...
   0.009838     [D3] usb_busses=0000023602509310
   0.011122     [D2] libusb0: No appropriate HID device found
   0.012719     libusb0: Could not open any HID devices: no USB buses found
   0.015937     No matching HID UPS found

...making such builds less useful than libusb-1.0 (and 0.1-compat over it) which at least try to collect data.

Possibly libusb0.c and/or driver code has to grow some more ifdefs to differentiate assumptions about libusb implementation when building for WIN32 (perhaps ifdef HAVE_LUSB0_USB_H is a decent quick start for this use-case). In particular, seems another usb_busses detection method should be tried (library method vs. library public variable).

See also #1507

@jimklimov jimklimov added Windows refactor/fightwarn PR or issue proposal to improve code maintainability without functional changes, or to fix warnings labels Aug 28, 2022
@AppVeyorBot
Copy link

Typo fix for `ifdef HAVE_USB_H` (libusb-0.1 header)
Typo fix for `ifdef HAVE_USB_H` (libusb-0.1 header)
Detect configure script error: Neither HAVE_USB_H nor HAVE_LUSB0_USB_H is set for the WITH_LIBUSB_0_1 build
Detect configure script error: Neither HAVE_USB_H nor HAVE_LUSB0_USB_H is set for the WITH_LIBUSB_0_1 build
@AppVeyorBot
Copy link

@AppVeyorBot
Copy link

@AppVeyorBot
Copy link

@AppVeyorBot
Copy link

@jimklimov jimklimov merged commit b33e4fa into networkupstools:Windows-v2.8.0-1 Aug 30, 2022
@jimklimov jimklimov deleted the Windows-v2.8.0-libusb-win32 branch August 30, 2022 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor/fightwarn PR or issue proposal to improve code maintainability without functional changes, or to fix warnings Windows

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants