Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Shawn Webb
Fwupd
Commits
a76de327
Commit
a76de327
authored
Feb 18, 2021
by
Richard Hughes
Committed by
Ricardo Cañuelo Navarro
Feb 22, 2021
Browse files
Add a test BLE plugin for a demo
parent
536fb85e
Changes
10
Hide whitespace changes
Inline
Side-by-side
contrib/debian/rules
View file @
a76de327
...
...
@@ -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
...
...
contrib/fwupd.spec.in
View file @
a76de327
...
...
@@ -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
...
...
data/daemon.conf
View file @
a76de327
...
...
@@ -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
...
...
libfwupdplugin/fu-bluez-device.c
View file @
a76de327
...
...
@@ -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
);
...
...
plugins/test/README.md
View file @
a76de327
...
...
@@ -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
------------------
...
...
plugins/test/fu-plugin-test-ble.c
0 → 100644
View file @
a76de327
/*
* 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
);
}
plugins/test/fu-test-ble-device.c
0 → 100644
View file @
a76de327
/*
* 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
)
{
}
plugins/test/fu-test-ble-device.h
0 → 100644
View file @
a76de327
/*
* 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
)
plugins/test/meson.build
View file @
a76de327
...
...
@@ -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
plugins/test/test-ble.quirk
0 → 100644
View file @
a76de327
[DeviceInstanceId=BLUETOOTH\VID_0461&PID_4EEE&REV_0001]
Plugin = test_ble
[DeviceInstanceId=BLUETOOTH\VID_0461&PID_4EEF&REV_0001]
Plugin = test_ble
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment