From 7d6bc43bca25515f46a7dc6829ec1c65bdf7b507 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 20 Mar 2014 09:36:14 +0200 Subject: [PATCH] tools/btinfo: Convert to using shared/timeout.h --- Makefile.tools | 2 ++ tools/btinfo.c | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile.tools b/Makefile.tools index c4a644154..00a70a532 100644 --- a/Makefile.tools +++ b/Makefile.tools @@ -296,6 +296,8 @@ tools_btmgmt_LDADD = lib/libbluetooth-internal.la tools_btinfo_SOURCES = tools/btinfo.c monitor/bt.h \ monitor/mainloop.h monitor/mainloop.c \ src/shared/io.h src/shared/io-mainloop.c \ + src/shared/timeout.h \ + src/shared/timeout-mainloop.c \ src/shared/hci.h src/shared/hci.c \ src/shared/util.h src/shared/util.c \ src/shared/queue.h src/shared/queue.c diff --git a/tools/btinfo.c b/tools/btinfo.c index 669313265..b838c2513 100644 --- a/tools/btinfo.c +++ b/tools/btinfo.c @@ -37,6 +37,7 @@ #include "monitor/mainloop.h" #include "monitor/bt.h" +#include "src/shared/timeout.h" #include "src/shared/util.h" #include "src/shared/hci.h" @@ -88,18 +89,19 @@ static struct bt_hci *hci_dev; static bool reset_on_init = false; static bool reset_on_shutdown = false; -static void shutdown_timeout(int id, void *user_data) +static bool shutdown_timeout(void *user_data) { - mainloop_remove_timeout(id); - mainloop_quit(); + + return false; } static void shutdown_complete(const void *data, uint8_t size, void *user_data) { unsigned int id = PTR_TO_UINT(user_data); - shutdown_timeout(id, NULL); + timeout_remove(id); + mainloop_quit(); } static void shutdown_device(void) @@ -109,7 +111,7 @@ static void shutdown_device(void) bt_hci_flush(hci_dev); if (reset_on_shutdown) { - id = mainloop_add_timeout(5000, shutdown_timeout, NULL, NULL); + id = timeout_add(5000, shutdown_timeout, NULL, NULL); bt_hci_send(hci_dev, BT_HCI_CMD_RESET, NULL, 0, shutdown_complete, UINT_TO_PTR(id), NULL); -- 2.47.3