summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-01-23 12:58:50 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-01-23 12:58:50 +0000
commit7852b73496883c9a8585cbd6441e5d96300b600e (patch)
tree4f659d7f51805f93ff95a6802c343d23055c1323
parent9069c486ecd182ce5c5095f45c9748b175b36f1f (diff)
Get basic adapter information before changing the defaul options
-rw-r--r--hcid/main.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/hcid/main.c b/hcid/main.c
index 5ba69bac..efef8e36 100644
--- a/hcid/main.c
+++ b/hcid/main.c
@@ -298,12 +298,18 @@ static void configure_device(int dev_id)
device_opts = get_device_opts(dev_id);
+ if (hci_devinfo(dev_id, &di) < 0)
+ return;
+
+ if (hci_test_bit(HCI_RAW, &di.flags))
+ return;
+
/* Set default discoverable timeout if not set */
if (!(device_opts->flags & (1 << HCID_SET_DISCOVTO)))
device_opts->discovto = HCID_DEFAULT_DISCOVERABLE_TIMEOUT;
/* Set scan mode */
- if (!read_device_mode(&di.bdaddr, mode, sizeof(mode))) {
+ if (read_device_mode(&di.bdaddr, mode, sizeof(mode)) == 0) {
if (!strcmp(mode, MODE_OFF) && hcid.offmode == HCID_OFFMODE_NOSCAN)
device_opts->scan = SCAN_DISABLED;
else if (!strcmp(mode, MODE_CONNECTABLE))
@@ -335,12 +341,6 @@ static void configure_device(int dev_id)
return;
}
- if (hci_devinfo(dev_id, &di) < 0)
- exit(1);
-
- if (hci_test_bit(HCI_RAW, &di.flags))
- exit(0);
-
memset(&dr, 0, sizeof(dr));
dr.dev_id = dev_id;