summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2021-05-21 09:55:56 +0100
committerRichard Hughes <richard@hughsie.com>2021-05-21 10:59:20 +0100
commitbd503d0b989d57e038435585eba3963c2d4e4588 (patch)
treec8f41958cfc89f4354490b964f0ccf429ee875f7
parenta050309250f87ec733469c6b8030757ab8304c42 (diff)
downloadgusb-bd503d0b989d57e038435585eba3963c2d4e4588.tar.gz
Do not depend on libusb_get_parent() to fix FreeBSD compile
-rw-r--r--gusb/gusb-device.c9
-rw-r--r--meson.build3
2 files changed, 12 insertions, 0 deletions
diff --git a/gusb/gusb-device.c b/gusb/gusb-device.c
index 3f782f3..32c3213 100644
--- a/gusb/gusb-device.c
+++ b/gusb/gusb-device.c
@@ -212,6 +212,15 @@ g_usb_device_init (GUsbDevice *device)
device->priv = g_usb_device_get_instance_private (device);
}
+/* not defined in FreeBSD */
+#ifndef HAVE_LIBUSB_GET_PARENT
+libusb_device *
+libusb_get_parent (libusb_device *dev)
+{
+ return NULL;
+}
+#endif
+
static void
g_usb_device_build_parent_port_number (GString *str, libusb_device *dev)
{
diff --git a/meson.build b/meson.build
index ba1f314..128ad6e 100644
--- a/meson.build
+++ b/meson.build
@@ -104,6 +104,9 @@ endif
if cc.has_header_symbol('libusb-1.0/libusb.h', 'libusb_set_option')
conf.set('HAVE_LIBUSB_SET_OPTION', '1')
endif
+if cc.has_header_symbol('libusb-1.0/libusb.h', 'libusb_get_parent')
+ conf.set('HAVE_LIBUSB_GET_PARENT', '1')
+endif
gusb_deps = [
libgio,