summaryrefslogtreecommitdiffstats
path: root/hcid/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'hcid/main.c')
-rw-r--r--hcid/main.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/hcid/main.c b/hcid/main.c
index 8abd3d40..5f05543b 100644
--- a/hcid/main.c
+++ b/hcid/main.c
@@ -302,10 +302,12 @@ static void configure_device(int hdev)
}
}
- dr.dev_opt = device_opts->scan;
- if (ioctl(s, HCISETSCAN, (unsigned long) &dr) < 0) {
- error("Can't set scan mode on hci%d: %s (%d)",
- hdev, strerror(errno), errno);
+ if (!(hcid.offmode == HCID_OFFMODE_DEVDOWN && !strcmp(mode, MODE_OFF))) {
+ dr.dev_opt = device_opts->scan;
+ if (ioctl(s, HCISETSCAN, (unsigned long) &dr) < 0) {
+ error("Can't set scan mode on hci%d: %s (%d)",
+ hdev, strerror(errno), errno);
+ }
}
/* Set device name */
@@ -417,6 +419,16 @@ static void init_device(int hdev)
if (hci_test_bit(HCI_RAW, &di.flags))
exit(0);
+ if (hcid.offmode == HCID_OFFMODE_DEVDOWN) {
+ char mode[16];
+
+ if (read_device_mode(&di.bdaddr, mode, sizeof(mode)) == 0
+ && strcmp(mode, "off") == 0) {
+ ioctl(dd, HCIDEVDOWN, dev_id);
+ exit(0);
+ }
+ }
+
memset(&dr, 0, sizeof(dr));
dr.dev_id = dev_id;
device_opts = get_device_opts(dd, dev_id);