When the controller gets powered on via the management interface, then
register the supported SMP channels. There is no point in registering
these channels earlier since it is not know what identity address the
controller is going to operate with.
When powering down a controller unregister all SMP channels. This is
required since a powered down controller is allowed to change its
identity address.
In addition the SMP channels are only available when the controller
is powered via the management interface. When using legacy ioctl, then
Bluetooth Low Energy is not supported and registering kernel side SMP
integration may actually cause confusion.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
if (lmp_bredr_capable(hdev))
hci_debugfs_create_bredr(hdev);
- if (lmp_le_capable(hdev)) {
+ if (lmp_le_capable(hdev))
hci_debugfs_create_le(hdev);
- smp_register(hdev);
- }
return 0;
}
BT_DBG("%s", hdev->name);
hci_dev_do_close(hdev);
+
+ smp_unregister(hdev);
}
static void hci_discov_off(struct work_struct *work)
BT_DBG("status 0x%02x", status);
+ if (!status) {
+ /* Register the available SMP channels (BR/EDR and LE) only
+ * when successfully powering on the controller. This late
+ * registration is required so that LE SMP can clearly
+ * decide if the public address or static address is used.
+ */
+ smp_register(hdev);
+ }
+
hci_dev_lock(hdev);
mgmt_pending_foreach(MGMT_OP_SET_POWERED, hdev, settings_rsp, &match);