summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2006-04-20 13:27:24 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2006-04-20 13:27:24 +0000
commitd7d52c07bd5c6ef4d1f411dc2ef57502ed028125 (patch)
tree26db9439ef592ed1312cec5bbcad1a52ad0030d2
parent7950cc52aba07e8323ddb275c25c454d4546daeb (diff)
Don't become discoverable on startup if mode is "discoverable" and timeout is 0
-rw-r--r--hcid/main.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/hcid/main.c b/hcid/main.c
index 4a3f0bc8..d3ff01c5 100644
--- a/hcid/main.c
+++ b/hcid/main.c
@@ -228,14 +228,23 @@ static void configure_device(int hdev)
dr.dev_id = hdev;
device_opts = get_device_opts(s, hdev);
+ /* 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 (!strcmp(mode, MODE_OFF))
device_opts->scan = SCAN_DISABLED;
else if (!strcmp(mode, MODE_CONNECTABLE))
device_opts->scan = SCAN_PAGE;
- else if (!strcmp(mode, MODE_DISCOVERABLE))
- device_opts->scan = SCAN_PAGE | SCAN_INQUIRY;
+ else if (!strcmp(mode, MODE_DISCOVERABLE)) {
+ /* Set discoverable only if timeout is 0 */
+ if (!get_discoverable_timeout(hdev))
+ device_opts->scan = SCAN_PAGE | SCAN_INQUIRY;
+ else
+ device_opts->scan = SCAN_PAGE;
+ }
}
dr.dev_opt = device_opts->scan;
@@ -358,10 +367,6 @@ static void configure_device(int hdev)
WRITE_PAGE_TIMEOUT_CP_SIZE, &cp);
}
- /* Set default discoverable timeout if not set */
- if (!(device_opts->flags & (1 << HCID_SET_DISCOVTO)))
- device_opts->discovto = HCID_DEFAULT_DISCOVERABLE_TIMEOUT;
-
exit(0);
}