tools_hwdb_LDADD = lib/libbluetooth-private.la
-tools_btmgmt_SOURCES = tools/btmgmt.c src/glib-helper.c src/eir.c
+tools_btmgmt_SOURCES = tools/btmgmt.c src/glib-helper.c src/eir.c \
+ src/shared/util.h src/shared/util.c \
+ src/shared/mgmt.h src/shared/mgmt.c
tools_btmgmt_LDADD = lib/libbluetooth-private.la @GLIB_LIBS@
tools_btiotest_SOURCES = tools/btiotest.c btio/btio.h btio/btio.c
#include <glib.h>
+#include "src/shared/mgmt.h"
#include "glib-helper.h"
#include "lib/mgmt.h"
#include "eir.h"
int opt, i, mgmt_sk;
uint16_t index = MGMT_INDEX_NONE;
struct pollfd pollfd;
+ struct mgmt *mgmt;
while ((opt = getopt_long(argc, argv, "+hvi:",
main_options, NULL)) != -1) {
return -1;
}
+ mgmt = mgmt_new_default();
+ if (!mgmt) {
+ fprintf(stderr, "Unable to open mgmt_socket\n");
+ close(mgmt_sk);
+ return -1;
+ }
+
pollfd.fd = mgmt_sk;
pollfd.events = POLLIN;
pollfd.revents = 0;
pollfd.revents = 0;
}
+ mgmt_cancel_all(mgmt);
+ mgmt_unregister_all(mgmt);
+ mgmt_unref(mgmt);
+
close(mgmt_sk);
return 0;