mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-16 08:44:38 +08:00
Move inquiry mode setting to hciops
This commit is contained in:
parent
3e2860479c
commit
c0af129926
@ -842,6 +842,24 @@ static int hciops_set_event_mask(int index, uint8_t *events, size_t count)
|
||||
return err;
|
||||
}
|
||||
|
||||
static int hciops_write_inq_mode(int index, uint8_t mode)
|
||||
{
|
||||
int dd, err;
|
||||
|
||||
dd = hci_open_dev(index);
|
||||
if (dd < 0)
|
||||
return -errno;
|
||||
|
||||
if (hci_write_inquiry_mode(dd, mode, HCI_REQ_TIMEOUT) < 0)
|
||||
err = -errno;
|
||||
else
|
||||
err = 0;
|
||||
|
||||
hci_close_dev(dd);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static struct btd_adapter_ops hci_ops = {
|
||||
.setup = hciops_setup,
|
||||
.cleanup = hciops_cleanup,
|
||||
@ -864,6 +882,7 @@ static struct btd_adapter_ops hci_ops = {
|
||||
.write_eir_data = hciops_write_eir_data,
|
||||
.read_bdaddr = hciops_read_bdaddr,
|
||||
.set_event_mask = hciops_set_event_mask,
|
||||
.write_inq_mode = hciops_write_inq_mode,
|
||||
};
|
||||
|
||||
static int hciops_init(void)
|
||||
|
@ -1965,10 +1965,10 @@ static int adapter_setup(struct btd_adapter *adapter, const char *mode)
|
||||
if (inqmode < 1)
|
||||
goto done;
|
||||
|
||||
if (hci_write_inquiry_mode(dd, inqmode, HCI_REQ_TIMEOUT) < 0) {
|
||||
err = -errno;
|
||||
err = adapter_ops->write_inq_mode(adapter->dev_id, inqmode);
|
||||
if (err < 0) {
|
||||
error("Can't write inquiry mode for %s: %s (%d)",
|
||||
adapter->path, strerror(errno), errno);
|
||||
adapter->path, strerror(-err), -err);
|
||||
hci_close_dev(dd);
|
||||
return err;
|
||||
}
|
||||
|
@ -193,6 +193,7 @@ struct btd_adapter_ops {
|
||||
int (*write_eir_data) (int index, uint8_t *data);
|
||||
int (*read_bdaddr) (int index, bdaddr_t *bdaddr);
|
||||
int (*set_event_mask) (int index, uint8_t *events, size_t count);
|
||||
int (*write_inq_mode) (int index, uint8_t mode);
|
||||
};
|
||||
|
||||
int btd_register_adapter_ops(struct btd_adapter_ops *btd_adapter_ops);
|
||||
|
Loading…
Reference in New Issue
Block a user