zeus migration: bluez5: fix build error

https://jira.digi.com/browse/DEL-7013

Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
This commit is contained in:
Arturo Buzarra 2020-03-30 17:56:19 +02:00
parent ff08db0c2f
commit 028dd6c04b
2 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,84 @@
From: Marcel Holtmann <marcel@holtmann.org>
Date: Mon, 3 Dec 2018 19:48:08 +0100
Subject: [PATCH] tools: Use l_main_run_with_signal instead of open coding it
---
tools/btpclient.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/tools/btpclient.c b/tools/btpclient.c
index b217df58f..3f958e65c 100644
--- a/tools/btpclient.c
+++ b/tools/btpclient.c
@@ -27,10 +27,11 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <assert.h>
#include <getopt.h>
+#include <signal.h>
#include <ell/ell.h>
#include "lib/bluetooth.h"
#include "src/shared/btp.h"
@@ -2825,12 +2826,11 @@ static void register_core_service(void)
btp_register(btp, BTP_CORE_SERVICE, BTP_OP_CORE_UNREGISTER,
btp_core_unregister, NULL, NULL);
}
-static void signal_handler(struct l_signal *signal, uint32_t signo,
- void *user_data)
+static void signal_handler(uint32_t signo, void *user_data)
{
switch (signo) {
case SIGINT:
case SIGTERM:
l_info("Terminating");
@@ -3154,12 +3154,10 @@ static const struct option options[] = {
};
int main(int argc, char *argv[])
{
struct l_dbus_client *client;
- struct l_signal *signal;
- sigset_t mask;
int opt;
l_log_set_stderr();
while ((opt = getopt_long(argc, argv, "+hs:vq", options, NULL)) != -1) {
@@ -3192,15 +3190,10 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
adapters = l_queue_new();
- sigemptyset(&mask);
- sigaddset(&mask, SIGINT);
- sigaddset(&mask, SIGTERM);
- signal = l_signal_create(&mask, signal_handler, NULL, NULL);
-
dbus = l_dbus_new_default(L_DBUS_SYSTEM_BUS);
l_dbus_set_ready_handler(dbus, ready_callback, NULL, NULL);
client = l_dbus_client_new(dbus, "org.bluez", "/org/bluez");
l_dbus_client_set_connect_handler(client, client_connected, NULL, NULL);
@@ -3210,15 +3203,14 @@ int main(int argc, char *argv[])
l_dbus_client_set_proxy_handlers(client, proxy_added, proxy_removed,
property_changed, NULL, NULL);
l_dbus_client_set_ready_handler(client, client_ready, NULL, NULL);
- l_main_run();
+ l_main_run_with_signal(signal_handler, NULL);
l_dbus_client_destroy(client);
l_dbus_destroy(dbus);
- l_signal_remove(signal);
btp_cleanup(btp);
l_queue_destroy(adapters, (l_queue_destroy_func_t)btp_adapter_free);
l_free(socket_path);

View File

@ -10,6 +10,7 @@ SRC_URI += " \
file://0001-hcitool-do-not-show-unsupported-refresh-option.patch \ file://0001-hcitool-do-not-show-unsupported-refresh-option.patch \
file://0002-hcitool-increase-the-shown-connection-limit-to-20.patch \ file://0002-hcitool-increase-the-shown-connection-limit-to-20.patch \
file://0003-port-test-discovery-to-python3.patch \ file://0003-port-test-discovery-to-python3.patch \
file://0008-tools-Use-l_main_run_with_signal-instead-of-open-cod.patch \
" "
QCA65XX_COMMON_PATCHES = " \ QCA65XX_COMMON_PATCHES = " \