mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-14 12:35:57 +00:00
Make GUsb optional for fuzzing
This commit is contained in:
parent
d1015cc2a2
commit
1a3d3b338e
@ -9,7 +9,9 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
#include <gusb.h>
|
#include <gusb.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "fu-device-locker.h"
|
#include "fu-device-locker.h"
|
||||||
#include "fu-usb-device.h"
|
#include "fu-usb-device.h"
|
||||||
@ -86,6 +88,7 @@ fu_device_locker_close (FuDeviceLocker *self, GError **error)
|
|||||||
if (!self->device_open)
|
if (!self->device_open)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (!self->close_func (self->device, &error_local)) {
|
if (!self->close_func (self->device, &error_local)) {
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
if (G_USB_IS_DEVICE (self->device) &&
|
if (G_USB_IS_DEVICE (self->device) &&
|
||||||
g_error_matches (error_local,
|
g_error_matches (error_local,
|
||||||
G_USB_DEVICE_ERROR,
|
G_USB_DEVICE_ERROR,
|
||||||
@ -96,6 +99,10 @@ fu_device_locker_close (FuDeviceLocker *self, GError **error)
|
|||||||
g_propagate_error (error, g_steal_pointer (&error_local));
|
g_propagate_error (error, g_steal_pointer (&error_local));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
g_propagate_error (error, g_steal_pointer (&error_local));
|
||||||
|
return FALSE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
self->device_open = FALSE;
|
self->device_open = FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -131,6 +138,7 @@ fu_device_locker_new (gpointer device, GError **error)
|
|||||||
g_return_val_if_fail (device != NULL, NULL);
|
g_return_val_if_fail (device != NULL, NULL);
|
||||||
g_return_val_if_fail (error != NULL, NULL);
|
g_return_val_if_fail (error != NULL, NULL);
|
||||||
|
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
/* GUsbDevice */
|
/* GUsbDevice */
|
||||||
if (G_USB_IS_DEVICE (device)) {
|
if (G_USB_IS_DEVICE (device)) {
|
||||||
return fu_device_locker_new_full (device,
|
return fu_device_locker_new_full (device,
|
||||||
@ -138,6 +146,7 @@ fu_device_locker_new (gpointer device, GError **error)
|
|||||||
(FuDeviceLockerFunc) g_usb_device_close,
|
(FuDeviceLockerFunc) g_usb_device_close,
|
||||||
error);
|
error);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* FuDevice */
|
/* FuDevice */
|
||||||
if (FU_IS_DEVICE (device)) {
|
if (FU_IS_DEVICE (device)) {
|
||||||
|
@ -82,6 +82,7 @@ fu_hid_device_open (FuUsbDevice *device, GError **error)
|
|||||||
{
|
{
|
||||||
FuHidDevice *self = FU_HID_DEVICE (device);
|
FuHidDevice *self = FU_HID_DEVICE (device);
|
||||||
FuHidDeviceClass *klass = FU_HID_DEVICE_GET_CLASS (device);
|
FuHidDeviceClass *klass = FU_HID_DEVICE_GET_CLASS (device);
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
FuHidDevicePrivate *priv = GET_PRIVATE (self);
|
FuHidDevicePrivate *priv = GET_PRIVATE (self);
|
||||||
GUsbDeviceClaimInterfaceFlags flags = 0;
|
GUsbDeviceClaimInterfaceFlags flags = 0;
|
||||||
GUsbDevice *usb_device = fu_usb_device_get_dev (device);
|
GUsbDevice *usb_device = fu_usb_device_get_dev (device);
|
||||||
@ -117,6 +118,7 @@ fu_hid_device_open (FuUsbDevice *device, GError **error)
|
|||||||
g_prefix_error (error, "failed to claim HID interface: ");
|
g_prefix_error (error, "failed to claim HID interface: ");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* subclassed */
|
/* subclassed */
|
||||||
if (klass->open != NULL) {
|
if (klass->open != NULL) {
|
||||||
@ -133,10 +135,12 @@ fu_hid_device_close (FuUsbDevice *device, GError **error)
|
|||||||
{
|
{
|
||||||
FuHidDevice *self = FU_HID_DEVICE (device);
|
FuHidDevice *self = FU_HID_DEVICE (device);
|
||||||
FuHidDeviceClass *klass = FU_HID_DEVICE_GET_CLASS (device);
|
FuHidDeviceClass *klass = FU_HID_DEVICE_GET_CLASS (device);
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
FuHidDevicePrivate *priv = GET_PRIVATE (self);
|
FuHidDevicePrivate *priv = GET_PRIVATE (self);
|
||||||
GUsbDeviceClaimInterfaceFlags flags = 0;
|
GUsbDeviceClaimInterfaceFlags flags = 0;
|
||||||
GUsbDevice *usb_device = fu_usb_device_get_dev (device);
|
GUsbDevice *usb_device = fu_usb_device_get_dev (device);
|
||||||
g_autoptr(GError) error_local = NULL;
|
g_autoptr(GError) error_local = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* subclassed */
|
/* subclassed */
|
||||||
if (klass->close != NULL) {
|
if (klass->close != NULL) {
|
||||||
@ -144,6 +148,7 @@ fu_hid_device_close (FuUsbDevice *device, GError **error)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
/* release */
|
/* release */
|
||||||
if ((priv->flags & FU_HID_DEVICE_FLAG_NO_KERNEL_REBIND) == 0)
|
if ((priv->flags & FU_HID_DEVICE_FLAG_NO_KERNEL_REBIND) == 0)
|
||||||
flags |= G_USB_DEVICE_CLAIM_INTERFACE_BIND_KERNEL_DRIVER;
|
flags |= G_USB_DEVICE_CLAIM_INTERFACE_BIND_KERNEL_DRIVER;
|
||||||
@ -162,6 +167,7 @@ fu_hid_device_close (FuUsbDevice *device, GError **error)
|
|||||||
"failed to release HID interface: ");
|
"failed to release HID interface: ");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* success */
|
/* success */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -237,6 +243,7 @@ fu_hid_device_set_report_internal (FuHidDevice *self,
|
|||||||
FuHidDeviceRetryHelper *helper,
|
FuHidDeviceRetryHelper *helper,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
FuHidDevicePrivate *priv = GET_PRIVATE (self);
|
FuHidDevicePrivate *priv = GET_PRIVATE (self);
|
||||||
GUsbDevice *usb_device;
|
GUsbDevice *usb_device;
|
||||||
gsize actual_len = 0;
|
gsize actual_len = 0;
|
||||||
@ -273,6 +280,7 @@ fu_hid_device_set_report_internal (FuHidDevice *self,
|
|||||||
actual_len, helper->bufsz);
|
actual_len, helper->bufsz);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,6 +350,7 @@ fu_hid_device_get_report_internal (FuHidDevice *self,
|
|||||||
FuHidDeviceRetryHelper *helper,
|
FuHidDeviceRetryHelper *helper,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
FuHidDevicePrivate *priv = GET_PRIVATE (self);
|
FuHidDevicePrivate *priv = GET_PRIVATE (self);
|
||||||
GUsbDevice *usb_device;
|
GUsbDevice *usb_device;
|
||||||
gsize actual_len = 0;
|
gsize actual_len = 0;
|
||||||
@ -384,6 +393,7 @@ fu_hid_device_get_report_internal (FuHidDevice *self,
|
|||||||
actual_len, helper->bufsz);
|
actual_len, helper->bufsz);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
#include <gusb.h>
|
#include <gusb.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "fu-common.h"
|
#include "fu-common.h"
|
||||||
#include "fu-common-guid.h"
|
#include "fu-common-guid.h"
|
||||||
|
@ -83,6 +83,7 @@ fu_usb_device_finalize (GObject *object)
|
|||||||
static void
|
static void
|
||||||
fu_usb_device_init (FuUsbDevice *device)
|
fu_usb_device_init (FuUsbDevice *device)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
fu_device_retry_add_recovery (FU_DEVICE (device),
|
fu_device_retry_add_recovery (FU_DEVICE (device),
|
||||||
G_USB_DEVICE_ERROR,
|
G_USB_DEVICE_ERROR,
|
||||||
G_USB_DEVICE_ERROR_NO_DEVICE,
|
G_USB_DEVICE_ERROR_NO_DEVICE,
|
||||||
@ -91,6 +92,7 @@ fu_usb_device_init (FuUsbDevice *device)
|
|||||||
G_USB_DEVICE_ERROR,
|
G_USB_DEVICE_ERROR,
|
||||||
G_USB_DEVICE_ERROR_PERMISSION_DENIED,
|
G_USB_DEVICE_ERROR_PERMISSION_DENIED,
|
||||||
NULL);
|
NULL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,6 +113,7 @@ fu_usb_device_is_open (FuUsbDevice *device)
|
|||||||
return priv->usb_device_locker != NULL;
|
return priv->usb_device_locker != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
static gboolean
|
static gboolean
|
||||||
fu_usb_device_query_hub (FuUsbDevice *self, GError **error)
|
fu_usb_device_query_hub (FuUsbDevice *self, GError **error)
|
||||||
{
|
{
|
||||||
@ -153,6 +156,7 @@ fu_usb_device_query_hub (FuUsbDevice *self, GError **error)
|
|||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
fu_usb_device_open (FuDevice *device, GError **error)
|
fu_usb_device_open (FuDevice *device, GError **error)
|
||||||
@ -160,8 +164,9 @@ fu_usb_device_open (FuDevice *device, GError **error)
|
|||||||
FuUsbDevice *self = FU_USB_DEVICE (device);
|
FuUsbDevice *self = FU_USB_DEVICE (device);
|
||||||
FuUsbDevicePrivate *priv = GET_PRIVATE (self);
|
FuUsbDevicePrivate *priv = GET_PRIVATE (self);
|
||||||
FuUsbDeviceClass *klass = FU_USB_DEVICE_GET_CLASS (device);
|
FuUsbDeviceClass *klass = FU_USB_DEVICE_GET_CLASS (device);
|
||||||
guint idx;
|
|
||||||
g_autoptr(FuDeviceLocker) locker = NULL;
|
g_autoptr(FuDeviceLocker) locker = NULL;
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
|
guint idx;
|
||||||
|
|
||||||
g_return_val_if_fail (FU_IS_USB_DEVICE (self), FALSE);
|
g_return_val_if_fail (FU_IS_USB_DEVICE (self), FALSE);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||||
@ -258,6 +263,7 @@ fu_usb_device_open (FuDevice *device, GError **error)
|
|||||||
if (!fu_usb_device_query_hub (self, error))
|
if (!fu_usb_device_query_hub (self, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* subclassed */
|
/* subclassed */
|
||||||
if (klass->open != NULL) {
|
if (klass->open != NULL) {
|
||||||
@ -299,6 +305,7 @@ fu_usb_device_probe (FuDevice *device, GError **error)
|
|||||||
{
|
{
|
||||||
FuUsbDevice *self = FU_USB_DEVICE (device);
|
FuUsbDevice *self = FU_USB_DEVICE (device);
|
||||||
FuUsbDeviceClass *klass = FU_USB_DEVICE_GET_CLASS (device);
|
FuUsbDeviceClass *klass = FU_USB_DEVICE_GET_CLASS (device);
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
FuUsbDevicePrivate *priv = GET_PRIVATE (self);
|
FuUsbDevicePrivate *priv = GET_PRIVATE (self);
|
||||||
guint16 release;
|
guint16 release;
|
||||||
g_autofree gchar *devid0 = NULL;
|
g_autofree gchar *devid0 = NULL;
|
||||||
@ -361,6 +368,7 @@ fu_usb_device_probe (FuDevice *device, GError **error)
|
|||||||
fu_device_add_instance_id_full (device, intid3,
|
fu_device_add_instance_id_full (device, intid3,
|
||||||
FU_DEVICE_INSTANCE_FLAG_ONLY_QUIRKS);
|
FU_DEVICE_INSTANCE_FLAG_ONLY_QUIRKS);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* subclassed */
|
/* subclassed */
|
||||||
if (klass->probe != NULL) {
|
if (klass->probe != NULL) {
|
||||||
@ -385,11 +393,15 @@ fu_usb_device_probe (FuDevice *device, GError **error)
|
|||||||
guint16
|
guint16
|
||||||
fu_usb_device_get_vid (FuUsbDevice *self)
|
fu_usb_device_get_vid (FuUsbDevice *self)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
FuUsbDevicePrivate *priv = GET_PRIVATE (self);
|
FuUsbDevicePrivate *priv = GET_PRIVATE (self);
|
||||||
g_return_val_if_fail (FU_IS_USB_DEVICE (self), 0x0000);
|
g_return_val_if_fail (FU_IS_USB_DEVICE (self), 0x0000);
|
||||||
if (priv->usb_device == NULL)
|
if (priv->usb_device == NULL)
|
||||||
return 0x0;
|
return 0x0;
|
||||||
return g_usb_device_get_vid (priv->usb_device);
|
return g_usb_device_get_vid (priv->usb_device);
|
||||||
|
#else
|
||||||
|
return 0x0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -405,11 +417,15 @@ fu_usb_device_get_vid (FuUsbDevice *self)
|
|||||||
guint16
|
guint16
|
||||||
fu_usb_device_get_pid (FuUsbDevice *self)
|
fu_usb_device_get_pid (FuUsbDevice *self)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
FuUsbDevicePrivate *priv = GET_PRIVATE (self);
|
FuUsbDevicePrivate *priv = GET_PRIVATE (self);
|
||||||
g_return_val_if_fail (FU_IS_USB_DEVICE (self), 0x0000);
|
g_return_val_if_fail (FU_IS_USB_DEVICE (self), 0x0000);
|
||||||
if (priv->usb_device == NULL)
|
if (priv->usb_device == NULL)
|
||||||
return 0x0;
|
return 0x0;
|
||||||
return g_usb_device_get_pid (priv->usb_device);
|
return g_usb_device_get_pid (priv->usb_device);
|
||||||
|
#else
|
||||||
|
return 0x0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -425,11 +441,15 @@ fu_usb_device_get_pid (FuUsbDevice *self)
|
|||||||
const gchar *
|
const gchar *
|
||||||
fu_usb_device_get_platform_id (FuUsbDevice *self)
|
fu_usb_device_get_platform_id (FuUsbDevice *self)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
FuUsbDevicePrivate *priv = GET_PRIVATE (self);
|
FuUsbDevicePrivate *priv = GET_PRIVATE (self);
|
||||||
g_return_val_if_fail (FU_IS_USB_DEVICE (self), NULL);
|
g_return_val_if_fail (FU_IS_USB_DEVICE (self), NULL);
|
||||||
if (priv->usb_device == NULL)
|
if (priv->usb_device == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
return g_usb_device_get_platform_id (priv->usb_device);
|
return g_usb_device_get_platform_id (priv->usb_device);
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -482,9 +502,11 @@ fu_usb_device_set_dev (FuUsbDevice *device, GUsbDevice *usb_device)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
/* set device ID automatically */
|
/* set device ID automatically */
|
||||||
fu_device_set_physical_id (FU_DEVICE (device),
|
fu_device_set_physical_id (FU_DEVICE (device),
|
||||||
g_usb_device_get_platform_id (usb_device));
|
g_usb_device_get_platform_id (usb_device));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -501,7 +523,7 @@ fu_usb_device_set_dev (FuUsbDevice *device, GUsbDevice *usb_device)
|
|||||||
GUdevDevice *
|
GUdevDevice *
|
||||||
fu_usb_device_find_udev_device (FuUsbDevice *device, GError **error)
|
fu_usb_device_find_udev_device (FuUsbDevice *device, GError **error)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_GUDEV
|
#if defined(HAVE_GUDEV) && defined(HAVE_GUSB)
|
||||||
FuUsbDevicePrivate *priv = GET_PRIVATE (device);
|
FuUsbDevicePrivate *priv = GET_PRIVATE (device);
|
||||||
g_autoptr(GList) devices = NULL;
|
g_autoptr(GList) devices = NULL;
|
||||||
g_autoptr(GUdevClient) gudev_client = g_udev_client_new (NULL);
|
g_autoptr(GUdevClient) gudev_client = g_udev_client_new (NULL);
|
||||||
@ -643,7 +665,11 @@ fu_usb_device_class_init (FuUsbDeviceClass *klass)
|
|||||||
device_class->unbind_driver = fu_udev_device_unbind_driver;
|
device_class->unbind_driver = fu_udev_device_unbind_driver;
|
||||||
|
|
||||||
pspec = g_param_spec_object ("usb-device", NULL, NULL,
|
pspec = g_param_spec_object ("usb-device", NULL, NULL,
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
G_USB_TYPE_DEVICE,
|
G_USB_TYPE_DEVICE,
|
||||||
|
#else
|
||||||
|
G_TYPE_OBJECT,
|
||||||
|
#endif
|
||||||
G_PARAM_READWRITE |
|
G_PARAM_READWRITE |
|
||||||
G_PARAM_CONSTRUCT |
|
G_PARAM_CONSTRUCT |
|
||||||
G_PARAM_STATIC_NAME);
|
G_PARAM_STATIC_NAME);
|
||||||
|
@ -7,7 +7,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
#include <gusb.h>
|
#include <gusb.h>
|
||||||
|
#else
|
||||||
|
typedef GObject GUsbContext;
|
||||||
|
typedef GObject GUsbDevice;
|
||||||
|
#define G_USB_CHECK_VERSION(a,c,b) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "fu-plugin.h"
|
#include "fu-plugin.h"
|
||||||
#include "fu-udev-device.h"
|
#include "fu-udev-device.h"
|
||||||
|
@ -92,9 +92,12 @@ introspection_deps = [
|
|||||||
libxmlb,
|
libxmlb,
|
||||||
libjcat,
|
libjcat,
|
||||||
giounix,
|
giounix,
|
||||||
gusb,
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if get_option('gusb')
|
||||||
|
introspection_deps += gusb
|
||||||
|
endif
|
||||||
|
|
||||||
if get_option('gudev')
|
if get_option('gudev')
|
||||||
fwupdplugin_headers_private += 'fu-udev-device-private.h'
|
fwupdplugin_headers_private += 'fu-udev-device-private.h'
|
||||||
introspection_deps += gudev
|
introspection_deps += gudev
|
||||||
@ -160,7 +163,7 @@ fwupdplugin_pkgg.generate(
|
|||||||
description : 'library for plugins to use to interact with fwupd daemon',
|
description : 'library for plugins to use to interact with fwupd daemon',
|
||||||
)
|
)
|
||||||
|
|
||||||
if get_option('introspection')
|
if get_option('introspection') and get_option('gusb')
|
||||||
gir_dep = declare_dependency(sources: fwupd_gir)
|
gir_dep = declare_dependency(sources: fwupd_gir)
|
||||||
if gusb.type_name() == 'internal'
|
if gusb.type_name() == 'internal'
|
||||||
libgusb_girtarget = subproject('gusb').get_variable('libgusb_girtarget')[0]
|
libgusb_girtarget = subproject('gusb').get_variable('libgusb_girtarget')[0]
|
||||||
|
15
meson.build
15
meson.build
@ -212,7 +212,10 @@ else
|
|||||||
gudev = dependency('', required : false)
|
gudev = dependency('', required : false)
|
||||||
endif
|
endif
|
||||||
libxmlb = dependency('xmlb', version : '>= 0.1.13', fallback : ['libxmlb', 'libxmlb_dep'])
|
libxmlb = dependency('xmlb', version : '>= 0.1.13', fallback : ['libxmlb', 'libxmlb_dep'])
|
||||||
gusb = dependency('gusb', version : '>= 0.3.5', fallback : ['gusb', 'gusb_dep'])
|
if get_option('gusb')
|
||||||
|
gusb = dependency('gusb', version : '>= 0.3.5', fallback : ['gusb', 'gusb_dep'])
|
||||||
|
conf.set('HAVE_GUSB', '1')
|
||||||
|
endif
|
||||||
sqlite = dependency('sqlite3')
|
sqlite = dependency('sqlite3')
|
||||||
if get_option('libarchive')
|
if get_option('libarchive')
|
||||||
libarchive = dependency('libarchive')
|
libarchive = dependency('libarchive')
|
||||||
@ -462,6 +465,11 @@ endif
|
|||||||
conf.set_quoted('FWUPD_PLUGINDIR', plugin_dir)
|
conf.set_quoted('FWUPD_PLUGINDIR', plugin_dir)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# sanity check, otherwise there is not point building
|
||||||
|
if host_machine.system() == 'windows' and not get_option('gusb')
|
||||||
|
error('-Dgusb=true is required for Windows build')
|
||||||
|
endif
|
||||||
|
|
||||||
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
|
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
|
||||||
conf.set_quoted('PACKAGE_NAME', meson.project_name())
|
conf.set_quoted('PACKAGE_NAME', meson.project_name())
|
||||||
conf.set_quoted('VERSION', meson.project_version())
|
conf.set_quoted('VERSION', meson.project_version())
|
||||||
@ -482,11 +490,14 @@ if build_standalone
|
|||||||
plugin_deps += gio
|
plugin_deps += gio
|
||||||
plugin_deps += giounix
|
plugin_deps += giounix
|
||||||
plugin_deps += gmodule
|
plugin_deps += gmodule
|
||||||
plugin_deps += gusb
|
|
||||||
plugin_deps += gudev
|
plugin_deps += gudev
|
||||||
plugin_deps += libjsonglib
|
plugin_deps += libjsonglib
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if get_option('gusb')
|
||||||
|
plugin_deps += gusb
|
||||||
|
endif
|
||||||
|
|
||||||
if get_option('libarchive')
|
if get_option('libarchive')
|
||||||
plugin_deps += libarchive
|
plugin_deps += libarchive
|
||||||
endif
|
endif
|
||||||
|
@ -8,6 +8,7 @@ option('lvfs', type : 'boolean', value : true, description : 'enable LVFS remote
|
|||||||
option('man', type : 'boolean', value : true, description : 'enable man pages')
|
option('man', type : 'boolean', value : true, description : 'enable man pages')
|
||||||
option('libarchive', type : 'boolean', value : true, description : 'enable libarchive support')
|
option('libarchive', type : 'boolean', value : true, description : 'enable libarchive support')
|
||||||
option('gudev', type : 'boolean', value : true, description : 'enable GUdev support')
|
option('gudev', type : 'boolean', value : true, description : 'enable GUdev support')
|
||||||
|
option('gusb', type : 'boolean', value : true, description : 'enable GUsb support')
|
||||||
option('polkit', type: 'boolean', value : true, description : 'enable PolKit support in daemon')
|
option('polkit', type: 'boolean', value : true, description : 'enable PolKit support in daemon')
|
||||||
option('plugin_altos', type : 'boolean', value : true, description : 'enable altos support')
|
option('plugin_altos', type : 'boolean', value : true, description : 'enable altos support')
|
||||||
option('plugin_amt', type : 'boolean', value : true, description : 'enable Intel AMT support')
|
option('plugin_amt', type : 'boolean', value : true, description : 'enable Intel AMT support')
|
||||||
|
@ -1,37 +1,19 @@
|
|||||||
subdir('acpi-dmar')
|
subdir('acpi-dmar')
|
||||||
subdir('acpi-facp')
|
subdir('acpi-facp')
|
||||||
subdir('bcm57xx')
|
subdir('bcm57xx')
|
||||||
subdir('ccgx')
|
|
||||||
subdir('cros-ec')
|
|
||||||
subdir('cpu')
|
subdir('cpu')
|
||||||
subdir('dfu')
|
|
||||||
subdir('colorhug')
|
|
||||||
subdir('ebitdo')
|
|
||||||
subdir('ep963x')
|
subdir('ep963x')
|
||||||
subdir('fastboot')
|
|
||||||
subdir('fresco-pd')
|
|
||||||
subdir('hailuck')
|
|
||||||
subdir('iommu')
|
subdir('iommu')
|
||||||
subdir('jabra')
|
|
||||||
subdir('linux-lockdown')
|
subdir('linux-lockdown')
|
||||||
subdir('linux-sleep')
|
subdir('linux-sleep')
|
||||||
subdir('linux-swap')
|
subdir('linux-swap')
|
||||||
subdir('linux-tainted')
|
subdir('linux-tainted')
|
||||||
subdir('steelseries')
|
|
||||||
subdir('dell-dock')
|
subdir('dell-dock')
|
||||||
subdir('nitrokey')
|
subdir('nitrokey')
|
||||||
subdir('pci-bcr')
|
subdir('pci-bcr')
|
||||||
subdir('pci-mei')
|
subdir('pci-mei')
|
||||||
subdir('rts54hid')
|
|
||||||
subdir('rts54hub')
|
|
||||||
subdir('solokey')
|
|
||||||
subdir('synaptics-cxaudio')
|
|
||||||
subdir('synaptics-prometheus')
|
|
||||||
subdir('test')
|
subdir('test')
|
||||||
subdir('upower')
|
subdir('upower')
|
||||||
subdir('wacom-usb')
|
|
||||||
subdir('vli')
|
|
||||||
subdir('goodix-moc')
|
|
||||||
subdir('pixart-rf')
|
subdir('pixart-rf')
|
||||||
|
|
||||||
if get_option('plugin_msr')
|
if get_option('plugin_msr')
|
||||||
@ -41,7 +23,6 @@ endif
|
|||||||
if get_option('gudev')
|
if get_option('gudev')
|
||||||
subdir('ata')
|
subdir('ata')
|
||||||
subdir('elantp')
|
subdir('elantp')
|
||||||
subdir('logitech-hidpp')
|
|
||||||
subdir('optionrom')
|
subdir('optionrom')
|
||||||
subdir('superio')
|
subdir('superio')
|
||||||
subdir('synaptics-rmi')
|
subdir('synaptics-rmi')
|
||||||
@ -49,12 +30,37 @@ subdir('thelio-io')
|
|||||||
subdir('wacom-raw')
|
subdir('wacom-raw')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if get_option('gudev') and get_option('gusb')
|
||||||
|
subdir('logitech-hidpp')
|
||||||
|
endif
|
||||||
|
|
||||||
if get_option('systemd')
|
if get_option('systemd')
|
||||||
subdir('logind')
|
subdir('logind')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if get_option('gusb')
|
||||||
|
subdir('ccgx')
|
||||||
|
subdir('colorhug')
|
||||||
|
subdir('cros-ec')
|
||||||
|
subdir('dfu')
|
||||||
|
subdir('ebitdo')
|
||||||
|
subdir('fastboot')
|
||||||
|
subdir('fresco-pd')
|
||||||
|
subdir('goodix-moc')
|
||||||
|
subdir('hailuck')
|
||||||
|
subdir('jabra')
|
||||||
|
subdir('rts54hid')
|
||||||
|
subdir('rts54hub')
|
||||||
|
subdir('solokey')
|
||||||
|
subdir('steelseries')
|
||||||
|
subdir('synaptics-cxaudio')
|
||||||
|
subdir('synaptics-prometheus')
|
||||||
|
subdir('vli')
|
||||||
|
subdir('wacom-usb')
|
||||||
|
|
||||||
# depends on dfu
|
# depends on dfu
|
||||||
subdir('csr')
|
subdir('csr')
|
||||||
|
endif
|
||||||
|
|
||||||
if get_option('tpm')
|
if get_option('tpm')
|
||||||
if not get_option('gudev')
|
if not get_option('gudev')
|
||||||
@ -83,8 +89,8 @@ subdir('modem-manager')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('plugin_altos')
|
if get_option('plugin_altos')
|
||||||
if not get_option('gudev')
|
if not get_option('gudev') or not get_option('gusb')
|
||||||
error('gudev is required for plugin_altos')
|
error('gudev and gusb is required for plugin_altos')
|
||||||
endif
|
endif
|
||||||
subdir('altos')
|
subdir('altos')
|
||||||
endif
|
endif
|
||||||
|
@ -63,10 +63,7 @@ fwupdate = executable(
|
|||||||
fwupdplugin_incdir,
|
fwupdplugin_incdir,
|
||||||
],
|
],
|
||||||
dependencies : [
|
dependencies : [
|
||||||
libxmlb,
|
plugin_deps,
|
||||||
giounix,
|
|
||||||
gusb,
|
|
||||||
gudev,
|
|
||||||
efiboot,
|
efiboot,
|
||||||
tpm2tss,
|
tpm2tss,
|
||||||
],
|
],
|
||||||
|
@ -6065,6 +6065,7 @@ fu_engine_get_archive_size_max (FuEngine *self)
|
|||||||
return fu_config_get_archive_size_max (self->config);
|
return fu_config_get_archive_size_max (self->config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
static void
|
static void
|
||||||
fu_engine_usb_device_removed_cb (GUsbContext *ctx,
|
fu_engine_usb_device_removed_cb (GUsbContext *ctx,
|
||||||
GUsbDevice *usb_device,
|
GUsbDevice *usb_device,
|
||||||
@ -6145,6 +6146,7 @@ fu_engine_usb_device_added_cb (GUsbContext *ctx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fu_engine_load_quirks (FuEngine *self, FuQuirksLoadFlags quirks_flags)
|
fu_engine_load_quirks (FuEngine *self, FuQuirksLoadFlags quirks_flags)
|
||||||
@ -6449,7 +6451,11 @@ fu_engine_load (FuEngine *self, FuEngineLoadFlags flags, GError **error)
|
|||||||
fu_engine_add_firmware_gtype (self, "smbios", FU_TYPE_SMBIOS);
|
fu_engine_add_firmware_gtype (self, "smbios", FU_TYPE_SMBIOS);
|
||||||
|
|
||||||
/* set shared USB context */
|
/* set shared USB context */
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
self->usb_ctx = g_usb_context_new (error);
|
self->usb_ctx = g_usb_context_new (error);
|
||||||
|
#else
|
||||||
|
self->usb_ctx = g_object_new (G_TYPE_OBJECT, NULL);
|
||||||
|
#endif
|
||||||
if (self->usb_ctx == NULL) {
|
if (self->usb_ctx == NULL) {
|
||||||
g_prefix_error (error, "Failed to get USB context: ");
|
g_prefix_error (error, "Failed to get USB context: ");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -6500,6 +6506,7 @@ fu_engine_load (FuEngine *self, FuEngineLoadFlags flags, GError **error)
|
|||||||
fu_engine_plugins_coldplug (self, FALSE);
|
fu_engine_plugins_coldplug (self, FALSE);
|
||||||
|
|
||||||
/* coldplug USB devices */
|
/* coldplug USB devices */
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
g_signal_connect (self->usb_ctx, "device-added",
|
g_signal_connect (self->usb_ctx, "device-added",
|
||||||
G_CALLBACK (fu_engine_usb_device_added_cb),
|
G_CALLBACK (fu_engine_usb_device_added_cb),
|
||||||
self);
|
self);
|
||||||
@ -6508,6 +6515,7 @@ fu_engine_load (FuEngine *self, FuEngineLoadFlags flags, GError **error)
|
|||||||
self);
|
self);
|
||||||
if (flags & FU_ENGINE_LOAD_FLAG_COLDPLUG)
|
if (flags & FU_ENGINE_LOAD_FLAG_COLDPLUG)
|
||||||
g_usb_context_enumerate (self->usb_ctx);
|
g_usb_context_enumerate (self->usb_ctx);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUDEV
|
#ifdef HAVE_GUDEV
|
||||||
/* coldplug udev devices */
|
/* coldplug udev devices */
|
||||||
@ -6668,13 +6676,14 @@ fu_engine_init (FuEngine *self)
|
|||||||
g_hash_table_insert (self->compile_versions,
|
g_hash_table_insert (self->compile_versions,
|
||||||
g_strdup ("org.freedesktop.fwupd"),
|
g_strdup ("org.freedesktop.fwupd"),
|
||||||
g_strdup (VERSION));
|
g_strdup (VERSION));
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
g_hash_table_insert (self->compile_versions,
|
g_hash_table_insert (self->compile_versions,
|
||||||
g_strdup ("org.freedesktop.gusb"),
|
g_strdup ("org.freedesktop.gusb"),
|
||||||
g_strdup_printf ("%i.%i.%i",
|
g_strdup_printf ("%i.%i.%i",
|
||||||
G_USB_MAJOR_VERSION,
|
G_USB_MAJOR_VERSION,
|
||||||
G_USB_MINOR_VERSION,
|
G_USB_MINOR_VERSION,
|
||||||
G_USB_MICRO_VERSION));
|
G_USB_MICRO_VERSION));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -10,7 +10,9 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
#include <gusb.h>
|
#include <gusb.h>
|
||||||
|
#endif
|
||||||
#include <xmlb.h>
|
#include <xmlb.h>
|
||||||
#include <fwupd.h>
|
#include <fwupd.h>
|
||||||
#ifdef HAVE_LIBCURL
|
#ifdef HAVE_LIBCURL
|
||||||
@ -286,11 +288,13 @@ fu_util_get_versions (void)
|
|||||||
g_string_append_printf (string, "client version:\t%s\n", SOURCE_VERSION);
|
g_string_append_printf (string, "client version:\t%s\n", SOURCE_VERSION);
|
||||||
g_string_append_printf (string,
|
g_string_append_printf (string,
|
||||||
"compile-time dependency versions\n");
|
"compile-time dependency versions\n");
|
||||||
|
#ifdef HAVE_GUSB
|
||||||
g_string_append_printf (string,
|
g_string_append_printf (string,
|
||||||
"\tgusb:\t%d.%d.%d\n",
|
"\tgusb:\t%d.%d.%d\n",
|
||||||
G_USB_MAJOR_VERSION,
|
G_USB_MAJOR_VERSION,
|
||||||
G_USB_MINOR_VERSION,
|
G_USB_MINOR_VERSION,
|
||||||
G_USB_MICRO_VERSION);
|
G_USB_MICRO_VERSION);
|
||||||
|
#endif
|
||||||
#ifdef EFIVAR_LIBRARY_VERSION
|
#ifdef EFIVAR_LIBRARY_VERSION
|
||||||
g_string_append_printf (string,
|
g_string_append_printf (string,
|
||||||
"\tefivar:\t%s",
|
"\tefivar:\t%s",
|
||||||
|
@ -13,11 +13,19 @@ daemon_dep = [
|
|||||||
giounix,
|
giounix,
|
||||||
gmodule,
|
gmodule,
|
||||||
gudev,
|
gudev,
|
||||||
gusb,
|
|
||||||
sqlite,
|
sqlite,
|
||||||
libjsonglib,
|
libjsonglib,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
client_dep = [
|
||||||
|
gudev,
|
||||||
|
]
|
||||||
|
|
||||||
|
if get_option('gusb')
|
||||||
|
daemon_dep += gusb
|
||||||
|
client_dep += gusb
|
||||||
|
endif
|
||||||
|
|
||||||
if get_option('libarchive')
|
if get_option('libarchive')
|
||||||
daemon_dep += libarchive
|
daemon_dep += libarchive
|
||||||
endif
|
endif
|
||||||
@ -66,8 +74,7 @@ fwupdmgr = executable(
|
|||||||
dependencies : [
|
dependencies : [
|
||||||
libfwupd_deps,
|
libfwupd_deps,
|
||||||
libxmlb,
|
libxmlb,
|
||||||
gudev,
|
client_dep,
|
||||||
gusb,
|
|
||||||
sqlite,
|
sqlite,
|
||||||
],
|
],
|
||||||
link_with : [
|
link_with : [
|
||||||
@ -96,8 +103,7 @@ fwupdagent = executable(
|
|||||||
dependencies : [
|
dependencies : [
|
||||||
libfwupd_deps,
|
libfwupd_deps,
|
||||||
libxmlb,
|
libxmlb,
|
||||||
gudev,
|
client_dep,
|
||||||
gusb,
|
|
||||||
],
|
],
|
||||||
link_with : [
|
link_with : [
|
||||||
fwupd,
|
fwupd,
|
||||||
@ -125,8 +131,7 @@ fwupdoffline = executable(
|
|||||||
],
|
],
|
||||||
dependencies : [
|
dependencies : [
|
||||||
libfwupd_deps,
|
libfwupd_deps,
|
||||||
gudev,
|
client_dep,
|
||||||
gusb,
|
|
||||||
libxmlb,
|
libxmlb,
|
||||||
sqlite,
|
sqlite,
|
||||||
],
|
],
|
||||||
@ -166,8 +171,7 @@ fwupdtool = executable(
|
|||||||
libfwupd_deps,
|
libfwupd_deps,
|
||||||
libxmlb,
|
libxmlb,
|
||||||
libgcab,
|
libgcab,
|
||||||
gudev,
|
client_dep,
|
||||||
gusb,
|
|
||||||
sqlite,
|
sqlite,
|
||||||
valgrind,
|
valgrind,
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user