From e733d343943a632585d9e8dcfa143bc5d9bd2568 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 21 May 2021 11:08:47 +0100 Subject: Do not depend on libusb_get_port_number() to fix DragonFlyBSD compile --- gusb/gusb-device.c | 11 ++++++++++- meson.build | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gusb/gusb-device.c b/gusb/gusb-device.c index 32c3213..16a5527 100644 --- a/gusb/gusb-device.c +++ b/gusb/gusb-device.c @@ -214,13 +214,22 @@ g_usb_device_init (GUsbDevice *device) /* not defined in FreeBSD */ #ifndef HAVE_LIBUSB_GET_PARENT -libusb_device * +static libusb_device * libusb_get_parent (libusb_device *dev) { return NULL; } #endif +/* not defined in DragonFlyBSD */ +#ifndef HAVE_LIBUSB_GET_PORT_NUMBER +static guint8 +libusb_get_port_number (libusb_device *dev) +{ + return 0xff; +} +#endif + static void g_usb_device_build_parent_port_number (GString *str, libusb_device *dev) { diff --git a/meson.build b/meson.build index 128ad6e..3f50b7c 100644 --- a/meson.build +++ b/meson.build @@ -107,6 +107,9 @@ endif if cc.has_header_symbol('libusb-1.0/libusb.h', 'libusb_get_parent') conf.set('HAVE_LIBUSB_GET_PARENT', '1') endif +if cc.has_header_symbol('libusb-1.0/libusb.h', 'libusb_get_port_number') + conf.set('HAVE_LIBUSB_GET_PORT_NUMBER', '1') +endif gusb_deps = [ libgio, -- cgit v1.2.1