summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-02-26 00:15:27 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-02-26 00:15:27 +0000
commite6fe40e5e92a6942869a2fc7e7cb210d18da3929 (patch)
treecd616e10a6507ddf4987f2aea8d3ce45533be7f7
parent6d7bf9b20d5e2bcf93d8a50de710f668fcbafbf3 (diff)
Add skeleton for serial port service
-rw-r--r--serial/Makefile.am11
-rw-r--r--serial/main.c60
2 files changed, 71 insertions, 0 deletions
diff --git a/serial/Makefile.am b/serial/Makefile.am
index 02742923..7cb86842 100644
--- a/serial/Makefile.am
+++ b/serial/Makefile.am
@@ -1,2 +1,13 @@
+noinst_PROGRAMS = bluetoothd-service-serial
+
+bluetoothd_service_serial_SOURCES = main.c
+
+LDADD = $(top_builddir)/common/libhelper.a \
+ @GLIB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@
+
+AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@
+
+INCLUDES = -I$(top_srcdir)/common
+
MAINTAINERCLEANFILES = Makefile.in
diff --git a/serial/main.c b/serial/main.c
new file mode 100644
index 00000000..b6f52d46
--- /dev/null
+++ b/serial/main.c
@@ -0,0 +1,60 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2004-2007 Marcel Holtmann <marcel@holtmann.org>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <signal.h>
+
+#include "logging.h"
+
+static void sig_term(int sig)
+{
+}
+
+int main(int argc, char *argv[])
+{
+ struct sigaction sa;
+
+ start_logging("serial", "Bluetooth Serial Port daemon");
+
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_flags = SA_NOCLDSTOP;
+ sa.sa_handler = sig_term;
+ sigaction(SIGTERM, &sa, NULL);
+ sigaction(SIGINT, &sa, NULL);
+
+ sa.sa_handler = SIG_IGN;
+ sigaction(SIGCHLD, &sa, NULL);
+ sigaction(SIGPIPE, &sa, NULL);
+
+ enable_debug();
+
+ info("Exit");
+
+ stop_logging();
+
+ return 0;
+}