summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Krasnyansky <maxk@qualcomm.com>2002-05-17 00:42:43 +0000
committerMax Krasnyansky <maxk@qualcomm.com>2002-05-17 00:42:43 +0000
commitcbc274c6e3ce3b2135c21c101d19271d66d3215e (patch)
tree8ba6a94cd33f31e73c78c8f10b9526d9061fe833
parentf7ab1ef143abdee16036e23e8cdf19d999d84916 (diff)
First bring device up then init everything else.
-rw-r--r--hcid/main.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/hcid/main.c b/hcid/main.c
index a1ac60c2..8f6ec8bc 100644
--- a/hcid/main.c
+++ b/hcid/main.c
@@ -163,6 +163,13 @@ static void init_device(int hdev)
exit(1);
}
+ /* Start HCI device */
+ if (ioctl(s, HCIDEVUP, hdev) < 0 && errno != EALREADY) {
+ syslog(LOG_ERR, "Can't init device hci%d. %s(%d)\n", hdev,
+ strerror(errno), errno);
+ exit(1);
+ }
+
dr.dev_id = hdev;
/* Set packet type */
@@ -192,13 +199,6 @@ static void init_device(int hdev)
}
}
- /* Start HCI device */
- if (ioctl(s, HCIDEVUP, hdev) < 0 && errno != EALREADY) {
- syslog(LOG_ERR, "Can't init device hci%d. %s(%d)\n", hdev,
- strerror(errno), errno);
- exit(1);
- }
-
exit(0);
}
@@ -226,10 +226,10 @@ static void init_all_devices(int ctl)
if (hcid.auto_init)
init_device(dr->dev_id);
- if (hcid.auto_init && (dr->dev_opt & (1<<HCI_UP)))
+ if (hcid.auto_init && hci_test_bit(HCI_UP, &dr->dev_opt))
configure_device(dr->dev_id);
- if (hcid.security && (dr->dev_opt & (1<<HCI_UP)))
+ if (hcid.security && hci_test_bit(HCI_UP, &dr->dev_opt))
start_security_manager(dr->dev_id);
}