Hi Johan, > When we're removing the last item in the white list or adding the first > one to it and HCI_CONNECTABLE is not set we need to update the current > page scan. This patch adds a simple helper function for the purpose and > calls it from the respective mgmt command handlers. > > Signed-off-by: Johan Hedberg <johan.hedberg@xxxxxxxxx> > --- > net/bluetooth/mgmt.c | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c > index 431d5e4aa34b..f5f0763266e0 100644 > --- a/net/bluetooth/mgmt.c > +++ b/net/bluetooth/mgmt.c > @@ -5198,6 +5198,24 @@ unlock: > return err; > } > > +/* Helper for Add/Remove Device commands */ > +static void update_page_scan(struct hci_dev *hdev, u8 scan) > +{ > + if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags)) > + return; > + > + if (!hdev_is_powered(hdev)) > + return; > + > + if (test_bit(HCI_CONNECTABLE, &hdev->dev_flags)) > + return; wouldn't it be better to check the HCI_PSCAN flag here to see if page scan is actually enabled on the controller? > + > + if (test_bit(HCI_DISCOVERABLE, &hdev->dev_flags)) > + scan |= SCAN_INQUIRY; > + > + hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan); > +} > + Regards Marcel -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html