Commit a76de327 authored by Richard Hughes's avatar Richard Hughes Committed by Ricardo Cañuelo Navarro
Browse files

Add a test BLE plugin for a demo

parent 536fb85e
......@@ -87,6 +87,7 @@ override_dh_install:
#this is placed in fwupd-tests
rm -f debian/fwupd/usr/lib/*/fwupd-plugins-3/libfu_plugin_test.so
rm -f debian/fwupd/usr/lib/*/fwupd-plugins-3/libfu_plugin_test_ble.so
rm -f debian/fwupd/usr/lib/*/fwupd-plugins-3/libfu_plugin_invalid.so
rm -f debian/fwupd/etc/fwupd/remotes.d/fwupd-tests.conf
......
......@@ -454,6 +454,7 @@ done
%{_libdir}/fwupd-plugins-3/libfu_plugin_system76_launch.so
%if 0%{?enable_dummy}
%{_libdir}/fwupd-plugins-3/libfu_plugin_test.so
%{_libdir}/fwupd-plugins-3/libfu_plugin_test_ble.so
%{_libdir}/fwupd-plugins-3/libfu_plugin_invalid.so
%endif
%{_libdir}/fwupd-plugins-3/libfu_plugin_thelio_io.so
......
......@@ -6,7 +6,7 @@ DisabledDevices=
# Allow blocking specific plugins
# Uses semicolons as delimiter
DisabledPlugins=test;invalid
DisabledPlugins=test;test_ble;invalid
# Maximum archive size that can be loaded in Mb, with 0 for the default
ArchiveSizeMax=0
......
......@@ -19,9 +19,9 @@
/**
* SECTION:fu-bluez-device
* @short_description: a Bluez Bluetooth LE device
* @short_description: a Bluez Bluetooth device
*
* An object that represents a Bluez Bluetooth LE device.
* An object that represents a Bluez Bluetooth device.
*
* See also: #FuBluezDevice
*/
......@@ -220,7 +220,6 @@ static gboolean
fu_bluez_device_setup (FuDevice *device, GError **error)
{
FuBluezDevice *self = FU_BLUEZ_DEVICE (device);
FuBluezDevicePrivate *priv = GET_PRIVATE (self);
fu_bluez_device_add_device_uuids (self);
......
......@@ -12,6 +12,10 @@ GUID Generation
The devices created by this plugin use hardcoded GUIDs that do not correspond
to any kind of DeviceInstanceId values.
In other cases devices use the standard BLE DeviceInstanceId values, e.g.
* `USB\VID_2DC8&PID_AB11`
Vendor ID Security
------------------
......
/*
* Copyright (C) 2021 Richard Hughes <richard@hughsie.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
#include "fu-test-ble-device.h"
#include "fu-plugin-vfuncs.h"
void
fu_plugin_init (FuPlugin *plugin)
{
fu_plugin_set_build_hash (plugin, FU_BUILD_HASH);
fu_plugin_set_device_gtype (plugin, FU_TYPE_TEST_BLE_DEVICE);
}
/*
* Copyright (C) 2021 Richard Hughes <richard@hughsie.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
#include "fu-test-ble-device.h"
struct _FuTestBleDevice {
FuBluezDevice parent_instance;
};
G_DEFINE_TYPE (FuTestBleDevice, fu_test_ble_device, FU_TYPE_BLUEZ_DEVICE)
static void
fu_test_ble_device_init (FuTestBleDevice *self)
{
fu_device_set_protocol (FU_DEVICE (self), "org.test.testble");
fu_device_add_flag (FU_DEVICE (self), FWUPD_DEVICE_FLAG_UPDATABLE);
}
static void
fu_test_ble_device_class_init (FuTestBleDeviceClass *klass)
{
}
/*
* Copyright (C) 2021 Richard Hughes <richard@hughsie.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#pragma once
#include "fu-plugin.h"
#define FU_TYPE_TEST_BLE_DEVICE (fu_test_ble_device_get_type ())
G_DECLARE_FINAL_TYPE (FuTestBleDevice, fu_test_ble_device, FU, TEST_BLE_DEVICE, FuBluezDevice)
......@@ -5,6 +5,12 @@ if get_option('plugin_dummy')
install_dummy = true
endif
if get_option('bluez')
install_data(['test-ble.quirk'],
install_dir: join_paths(datadir, 'fwupd', 'quirks.d')
)
endif
shared_module('fu_plugin_test',
fu_hash,
sources : [
......@@ -46,3 +52,28 @@ shared_module('fu_plugin_invalid',
plugin_deps,
],
)
if get_option('bluez')
shared_module('fu_plugin_test_ble',
fu_hash,
sources : [
'fu-plugin-test-ble.c',
'fu-test-ble-device.c',
],
include_directories : [
root_incdir,
fwupd_incdir,
fwupdplugin_incdir,
],
install : install_dummy,
install_dir: plugin_dir,
link_with : [
fwupd,
fwupdplugin,
],
c_args : cargs,
dependencies : [
plugin_deps,
],
)
endif
[DeviceInstanceId=BLUETOOTH\VID_0461&PID_4EEE&REV_0001]
Plugin = test_ble
[DeviceInstanceId=BLUETOOTH\VID_0461&PID_4EEF&REV_0001]
Plugin = test_ble
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment