Set the LE host supported and disable simultaneous LE and BR/EDR flags

For BlueZ if the controller supports LE, extended feature mask shall be
set to indicate that the host supports LE and disable simultaneous LE and
BR/EDR for simplicity even if the controller supports simultaneous LE and
BR/EDR.
This commit is contained in:
Claudio Takahasi 2010-09-01 19:36:15 -03:00
parent d93f18c610
commit 7ff8fd32eb
4 changed files with 41 additions and 0 deletions

View File

@ -1225,6 +1225,13 @@ typedef struct {
} __attribute__ ((packed)) write_best_effort_flush_timeout_rp;
#define WRITE_BEST_EFFORT_FLUSH_TIMEOUT_RP_SIZE 1
#define OCF_WRITE_LE_HOST_SUPPORTED 0x006D
typedef struct {
uint8_t le;
uint8_t simul;
} __attribute__ ((packed)) write_le_host_supported_cp;
#define WRITE_LE_HOST_SUPPORTED_CP_SIZE 2
/* Informational Parameters */
#define OGF_INFO_PARAM 0x04

View File

@ -1310,6 +1310,29 @@ static int hciops_read_ssp_mode(int index)
return err;
}
static int hciops_write_le_host(int index, uint8_t le, uint8_t simul)
{
write_le_host_supported_cp cp;
int dd, err;
dd = hci_open_dev(index);
if (dd < 0)
return -errno;
memset(&cp, 0, sizeof(cp));
cp.le = le;
cp.simul = simul;
err = hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_LE_HOST_SUPPORTED,
WRITE_LE_HOST_SUPPORTED_CP_SIZE, &cp);
if (err < 0)
err = -errno;
hci_close_dev(dd);
return err;
}
static struct btd_adapter_ops hci_ops = {
.setup = hciops_setup,
.cleanup = hciops_cleanup,
@ -1352,6 +1375,7 @@ static struct btd_adapter_ops hci_ops = {
.get_auth_info = hciops_get_auth_info,
.read_scan_enable = hciops_read_scan_enable,
.read_ssp_mode = hciops_read_ssp_mode,
.write_le_host = hciops_write_le_host,
};
static int hciops_init(void)

View File

@ -2009,6 +2009,15 @@ static int adapter_setup(struct btd_adapter *adapter, const char *mode)
if (dev->features[7] & LMP_INQ_TX_PWR)
adapter_ops->read_inq_tx_pwr(adapter->dev_id);
if (dev->features[4] & LMP_LE) {
err = adapter_ops->write_le_host(adapter->dev_id, 0x01, 0x00);
if (err < 0) {
error("Can't write LE host supported for %s: %s(%d)",
adapter->path, strerror(-err), -err);
return err;
}
}
if (read_local_name(&adapter->bdaddr, name) < 0)
expand_name(name, MAX_NAME_LENGTH, main_opts.name,
adapter->dev_id);

View File

@ -221,6 +221,7 @@ struct btd_adapter_ops {
int (*get_auth_info) (int index, bdaddr_t *bdaddr, uint8_t *auth);
int (*read_scan_enable) (int index);
int (*read_ssp_mode) (int index);
int (*write_le_host) (int index, uint8_t le, uint8_t simul);
};
int btd_register_adapter_ops(struct btd_adapter_ops *btd_adapter_ops);