mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-16 08:44:38 +08:00
Fix remote name resolution for interleave discovery
Remote name discovery shall be executed after the interleave discovery for dual mode adapters or after the inquiry complete for BR/EDR only.
This commit is contained in:
parent
ab851736fa
commit
d93f18c610
@ -1270,6 +1270,9 @@ static int start_discovery(struct btd_adapter *adapter)
|
||||
|
||||
pending_remote_name_cancel(adapter);
|
||||
|
||||
if (main_opts.name_resolv)
|
||||
adapter->state |= RESOLVE_NAME;
|
||||
|
||||
/* BR/EDR only? */
|
||||
if (le_capable(adapter) == FALSE)
|
||||
return adapter_ops->start_discovery(adapter->dev_id,
|
||||
@ -1307,9 +1310,6 @@ static DBusMessage *adapter_start_discovery(DBusConnection *conn,
|
||||
if (adapter->disc_sessions)
|
||||
goto done;
|
||||
|
||||
if (main_opts.name_resolv)
|
||||
adapter->state |= RESOLVE_NAME;
|
||||
|
||||
err = start_discovery(adapter);
|
||||
if (err < 0)
|
||||
return failed_strerror(msg, -err);
|
||||
@ -2663,7 +2663,7 @@ void adapter_set_state(struct btd_adapter *adapter, int state)
|
||||
previous = adapter->state;
|
||||
adapter->state = state;
|
||||
|
||||
switch (state) {
|
||||
switch (state & 0x0f) {
|
||||
case STD_INQUIRY:
|
||||
discov_active = TRUE;
|
||||
break;
|
||||
@ -2698,9 +2698,11 @@ void adapter_set_state(struct btd_adapter *adapter, int state)
|
||||
break;
|
||||
}
|
||||
|
||||
if (discov_active == FALSE)
|
||||
if (discov_active == FALSE) {
|
||||
adapter_update_oor_devices(adapter);
|
||||
else if (adapter->disc_sessions && main_opts.discov_interval)
|
||||
if (state & RESOLVE_NAME && adapter_resolve_names(adapter) == 0)
|
||||
return;
|
||||
} else if (adapter->disc_sessions && main_opts.discov_interval)
|
||||
adapter->scheduler_id = g_timeout_add_seconds(
|
||||
main_opts.discov_interval,
|
||||
(GSourceFunc) start_discovery,
|
||||
|
@ -569,8 +569,7 @@ proceed:
|
||||
return;
|
||||
|
||||
state = adapter_get_state(adapter);
|
||||
state &= ~PERIODIC_INQUIRY;
|
||||
state &= ~STD_INQUIRY;
|
||||
state &= ~RESOLVE_NAME;
|
||||
adapter_set_state(adapter, state);
|
||||
}
|
||||
|
||||
@ -752,7 +751,7 @@ void hcid_dbus_le_set_scan_enable_complete(bdaddr_t *local, uint8_t status)
|
||||
state = adapter_get_state(adapter);
|
||||
|
||||
/* Enabling or disabling ? */
|
||||
if (state == LE_SCAN)
|
||||
if (state & LE_SCAN)
|
||||
state &= ~LE_SCAN;
|
||||
else
|
||||
state |= LE_SCAN;
|
||||
|
@ -652,25 +652,6 @@ static void inquiry_complete(bdaddr_t *local, uint8_t status, gboolean periodic)
|
||||
|
||||
state &= ~STD_INQUIRY;
|
||||
adapter_set_state(adapter, state);
|
||||
|
||||
if (adapter_resolve_names(adapter) == 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* workaround to identify situation when there is no devices around
|
||||
* but periodic inquiry is active.
|
||||
*/
|
||||
if (!(state & STD_INQUIRY) && !(state & PERIODIC_INQUIRY)) {
|
||||
state |= PERIODIC_INQUIRY;
|
||||
adapter_set_state(adapter, state);
|
||||
return;
|
||||
}
|
||||
|
||||
/* reset the discover type to be able to handle D-Bus and non D-Bus
|
||||
* requests */
|
||||
state &= ~STD_INQUIRY;
|
||||
state &= ~PERIODIC_INQUIRY;
|
||||
adapter_set_state(adapter, state);
|
||||
}
|
||||
|
||||
static inline void remote_features_notify(int dev, bdaddr_t *sba, void *ptr)
|
||||
|
Loading…
Reference in New Issue
Block a user