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 | |
| parent | 6d233f5d42352b2bb6ee93e91ba9d4dc9c6c580d (diff) | |
Detect Simple Pairing support and enable it
| -rw-r--r-- | hcid/dbus-hci.c | 8 | ||||
| -rw-r--r-- | hcid/dbus-hci.h | 8 | ||||
| -rw-r--r-- | hcid/device.c | 8 | 
3 files changed, 15 insertions, 9 deletions
| diff --git a/hcid/dbus-hci.c b/hcid/dbus-hci.c index f57d65bc..01a37455 100644 --- a/hcid/dbus-hci.c +++ b/hcid/dbus-hci.c @@ -2469,14 +2469,6 @@ void hcid_dbus_pin_code_reply(bdaddr_t *local, void *ptr)  	}  } -#ifndef HCIGETAUTHINFO -#define HCIGETAUTHINFO _IOR('H', 215, int) -struct hci_auth_info_req { -	bdaddr_t bdaddr; -	uint8_t  type; -}; -#endif -  static uint8_t get_auth_type(bdaddr_t *local, bdaddr_t *remote)  {  	struct hci_auth_info_req req; diff --git a/hcid/dbus-hci.h b/hcid/dbus-hci.h index d92a4f30..00d6540a 100644 --- a/hcid/dbus-hci.h +++ b/hcid/dbus-hci.h @@ -22,6 +22,14 @@   *   */ +#ifndef HCIGETAUTHINFO +#define HCIGETAUTHINFO _IOR('H', 215, int) +struct hci_auth_info_req { +	bdaddr_t bdaddr; +	uint8_t  type; +}; +#endif +  void hcid_dbus_set_experimental();  int hcid_dbus_use_experimental();  int hcid_dbus_register_device(uint16_t id); 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); | 
