Hi Manish, On Fri, Aug 7, 2020 at 2:24 PM Manish Mandlik <mmandlik@xxxxxxxxxx> wrote: > > While pairing process is in progress, service discovery starts in the > background. If HOG profile is detected, auto connect is enabled for > that device. This causes future advertisement from that device to > trigger a pairing even if the user has already cancelled the pairing. So it looks like something is not right if the user cancel the pairing process I would expect the device to be removed if this happens when setting up a new device or at least call Disconnect method which would disable auto_connect if the device is not trusted. > Reviewed-by: Sonny Sasaka <sonnysasaka@xxxxxxxxxxxx> > > Signed-off-by: Manish Mandlik <mmandlik@xxxxxxxxxx> > --- > > src/device.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/src/device.c b/src/device.c > index 470596ee4..ab5bb123e 100644 > --- a/src/device.c > +++ b/src/device.c > @@ -2870,6 +2870,15 @@ static void device_cancel_bonding(struct btd_device *device, uint8_t status) > if (!bonding) > return; > > + /* Auto connect may get enabled during the service discovery even > + * before the pairing process completes. In such case, disable it > + * when the user has cancelled the pairing process. > + */ > + if (device->auto_connect) { > + device->disable_auto_connect = TRUE; > + device_set_auto_connect(device, FALSE); > + } BlueZ has the trusted property so upper layer can actually flag if the device is trusted regardless if it is paired on not, so this seems out of place or we should at least check if if the device has been marked as trusted. > ba2str(&device->bdaddr, addr); > DBG("Canceling bonding request for %s", addr); > > -- > 2.28.0.236.gb10cc79966-goog > -- Luiz Augusto von Dentz