summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-01-24 06:17:30 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-01-24 06:17:30 +0000
commit11588ef040b5fa0e1a22cea702eebcf1a80ce472 (patch)
tree5c6aaec2afbf4d2d35e1ef245254df28f71f9d14 /hcid
parentcb50607d568c96fb15dd435249868818d923c847 (diff)
Update option references
Diffstat (limited to 'hcid')
-rw-r--r--hcid/hcid.88
-rw-r--r--hcid/main.c73
2 files changed, 44 insertions, 37 deletions
diff --git a/hcid/hcid.8 b/hcid/hcid.8
index 767fc2ed..f9e3d7b6 100644
--- a/hcid/hcid.8
+++ b/hcid/hcid.8
@@ -26,8 +26,14 @@ can also provide a number of services via the D-BUS message bus
system.
.SH "OPTIONS"
.TP
-.B \-n
+.BI \-n
Don't fork to run daemon in background.
+.TP
+.BI \-d
+Enable debug information output.
+.TP
+.BI \-s
+Enable internal SDP server.
.TP
.BI \-f\ config\-file
Use alternate configuration file instead of /etc/bluetooth/hcid.conf
diff --git a/hcid/main.c b/hcid/main.c
index 6fb84bbc..2d19c373 100644
--- a/hcid/main.c
+++ b/hcid/main.c
@@ -58,15 +58,6 @@ struct device_opts default_device;
struct device_opts *parser_device;
static struct device_list *device_list = NULL;
-static GMainLoop *event_loop;
-
-static void usage(void)
-{
- printf("hcid - HCI daemon ver %s\n", VERSION);
- printf("Usage: \n");
- printf("\thcid [-n not_daemon] [-f config file]\n");
-}
-
static inline void init_device_defaults(struct device_opts *device_opts)
{
memset(device_opts, 0, sizeof(*device_opts));
@@ -554,32 +545,6 @@ static void init_defaults(void)
init_device_defaults(&default_device);
}
-static void sig_term(int sig)
-{
- g_main_loop_quit(event_loop);
-}
-
-static void sig_hup(int sig)
-{
- info("Reloading config file");
-
- free_device_opts();
-
- init_defaults();
-
- if (read_config(hcid.config_file) < 0)
- error("Config reload failed");
-
- init_security_data();
-
- init_all_devices(hcid.sock);
-}
-
-static void sig_debug(int sig)
-{
- toggle_debug();
-}
-
static inline void device_event(GIOChannel *chan, evt_stack_internal *si)
{
evt_si_device *sd = (void *) &si->data;
@@ -628,7 +593,6 @@ static gboolean io_stack_event(GIOChannel *chan, GIOCondition cond, gpointer dat
error("Read from control socket failed: %s (%d)",
strerror(errno), errno);
- g_main_loop_quit(event_loop);
return FALSE;
}
@@ -653,6 +617,41 @@ static gboolean io_stack_event(GIOChannel *chan, GIOCondition cond, gpointer dat
return TRUE;
}
+static GMainLoop *event_loop;
+
+static void sig_term(int sig)
+{
+ g_main_loop_quit(event_loop);
+}
+
+static void sig_hup(int sig)
+{
+ info("Reloading config file");
+
+ free_device_opts();
+
+ init_defaults();
+
+ if (read_config(hcid.config_file) < 0)
+ error("Config reload failed");
+
+ init_security_data();
+
+ init_all_devices(hcid.sock);
+}
+
+static void sig_debug(int sig)
+{
+ toggle_debug();
+}
+
+static void usage(void)
+{
+ printf("hcid - HCI daemon ver %s\n", VERSION);
+ printf("Usage: \n");
+ printf("\thcid [-n] [-d] [-s] [-f config file]\n");
+}
+
int main(int argc, char *argv[])
{
struct sockaddr_hci addr;
@@ -782,6 +781,8 @@ int main(int argc, char *argv[])
g_io_add_watch(ctl_io, G_IO_IN, io_stack_event, NULL);
+ g_io_channel_unref(ctl_io);
+
/* Initialize already connected devices */
init_all_devices(hcid.sock);