diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-06-09 16:29:21 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-06-09 16:29:21 +0000 |
commit | 6be25e8bc36656d6fd8ba61c8552f9596043eca6 (patch) | |
tree | 742ebec123521b0f1cd982cdf4d0e76acd52f4f1 /hcid/device.c | |
parent | 6d233f5d42352b2bb6ee93e91ba9d4dc9c6c580d (diff) |
Detect Simple Pairing support and enable it
Diffstat (limited to 'hcid/device.c')
-rw-r--r-- | hcid/device.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/hcid/device.c b/hcid/device.c index 95efe3af..57986f88 100644 --- a/hcid/device.c +++ b/hcid/device.c @@ -32,6 +32,7 @@ #include <stdarg.h> #include <sys/time.h> #include <sys/stat.h> +#include <sys/ioctl.h> #include <sys/param.h> #include <sys/socket.h> @@ -325,6 +326,11 @@ int start_adapter(uint16_t dev_id) if (!(features[6] & LMP_SIMPLE_PAIR)) goto setup; + if (hcid_dbus_use_experimental()) { + if (ioctl(dd, HCIGETAUTHINFO, NULL) < 0 && errno != EINVAL) + hci_write_simple_pairing_mode(dd, 0x01, 2000); + } + if (hci_read_simple_pairing_mode(dd, &dev->ssp_mode, 1000) < 0) { err = errno; error("Can't read simple pairing mode on hci%d: %s (%d)", @@ -377,7 +383,7 @@ setup: if (inqmode < 1) goto done; - if (hci_write_inquiry_mode(dd, inqmode, 1000) < 0) { + if (hci_write_inquiry_mode(dd, inqmode, 2000) < 0) { err = errno; error("Can't write inquiry mode for hci%d: %s (%d)", dev_id, strerror(err), err); |