diff options
| -rw-r--r-- | daemon/Makefile.am | 4 | ||||
| -rw-r--r-- | daemon/main.c | 26 | 
2 files changed, 22 insertions, 8 deletions
| diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 12ff263b..5dcc90d6 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -3,9 +3,9 @@ noinst_PROGRAMS = bluetoothd  bluetoothd_SOURCES = main.c -bluetoothd_LDADD = @DBUS_LIBS@ @BLUEZ_LIBS@ $(top_builddir)/common/libhelper.a +bluetoothd_LDADD = @GLIB_LIBS@ @BLUEZ_LIBS@ $(top_builddir)/common/libhelper.a -AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ +AM_CFLAGS = @BLUEZ_CFLAGS@ @GLIB_CFLAGS@  INCLUDES = -I$(top_srcdir)/common diff --git a/daemon/main.c b/daemon/main.c index f23a1471..6ce8ef81 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -27,15 +27,29 @@  #include <stdio.h>  #include <errno.h> -#include <sys/socket.h> +#include <stdlib.h> -#include <bluetooth/bluetooth.h> -#include <bluetooth/hci.h> -#include <bluetooth/hci_lib.h> - -#include <dbus/dbus.h> +#include <dbus/dbus-glib.h>  int main(int argc, char *argv[])  { +	GMainLoop *mainloop; +	DBusGConnection *conn; +	GError *error = NULL; + +	g_type_init(); + +	mainloop = g_main_loop_new(NULL, FALSE); + +	conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error); +	if (error != NULL) { +		g_printerr("Connecting to system bus failed: %s\n", +							error->message); +		g_error_free(error); +		exit(EXIT_FAILURE); +	} + +	g_main_loop_run(mainloop); +  	return 0;  } | 
