Bug 279556

Summary: libusb_hotplug_callback_handle type incompatibility between FreeBSD and libusb
Product: Base System Reporter: Ed Maste <emaste>
Component: usbAssignee: freebsd-usb (Nobody) <usb>
Status: New ---    
Severity: Affects Only Me CC: jlduran, mohammad, vsasjason
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277652

Description Ed Maste freebsd_committer freebsd_triage 2024-06-06 13:52:00 UTC
See PR277799 for background. libusb_hotplug_callback_handle_struct has a different type between FreeBSD and libusb

FreeBSD:

lib/libusb/libusb.h:typedef struct libusb_hotplug_callback_handle_struct *libusb_hotplug_callback_handle;

libusb:

libusb/libusb.h:typedef int libusb_hotplug_callback_handle;

which caused a build failure:

../keepassxc-2.7.7/src/gui/osutils/nixutils/DeviceListenerLibUsb.cpp:71:21: error: no matching function for call to 'libusb_hotplug_register_callback'
   71 |     const int ret = libusb_hotplug_register_callback(
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/libusb.h:597:5: note: candidate function not viable: no known conversion from 'int *' to 'libusb_hotplug_callback_handle *' (aka 'libusb_hotplug_callback_handle_struct **') for 9th argument
  597 | int     libusb_hotplug_register_callback(libusb_context *ctx, libusb_hotplug_event events, libusb_hotplug_flag flags, int vendor_id, int product_id, int dev_class, libusb_hotplug_callback_fn cb_fn, void *user_data, libusb_hotplug_callback_handle *handle);
      |         ^                                                                                                                                                                                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~