diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2014-07-02 15:30:54 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-07-03 11:42:58 -0400 |
commit | 0602a8adc3ce3f592d03df426c92d1f36229403c (patch) | |
tree | 543da00ab4591166495a485e9344191839c59029 /net/bluetooth/hci_core.c | |
parent | 4a964404c08fed64d1afd8b0af1e7f2b8f7ae90e (diff) |
Bluetooth: Add support for Unconfigured Index Added events
When a controller is in unconfigured state it is currently hidden
from the management interface. This change now announces the new
controller with an Unconfigured Index Added event and allows clients
to easily detect the controller.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r-- | net/bluetooth/hci_core.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 395b014ad0e8..df25a8329ecc 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -2806,14 +2806,18 @@ static void hci_power_on(struct work_struct *work) | |||
2806 | if (test_and_clear_bit(HCI_SETUP, &hdev->dev_flags)) { | 2806 | if (test_and_clear_bit(HCI_SETUP, &hdev->dev_flags)) { |
2807 | /* For unconfigured devices, set the HCI_RAW flag | 2807 | /* For unconfigured devices, set the HCI_RAW flag |
2808 | * so that userspace can easily identify them. | 2808 | * so that userspace can easily identify them. |
2809 | * | ||
2810 | * If the device is fully configured and ready for | ||
2811 | * operation, announce it via management interface. | ||
2812 | */ | 2809 | */ |
2813 | if (test_bit(HCI_UNCONFIGURED, &hdev->dev_flags)) | 2810 | if (test_bit(HCI_UNCONFIGURED, &hdev->dev_flags)) |
2814 | set_bit(HCI_RAW, &hdev->flags); | 2811 | set_bit(HCI_RAW, &hdev->flags); |
2815 | else | 2812 | |
2816 | mgmt_index_added(hdev); | 2813 | /* For fully configured devices, this will send |
2814 | * the Index Added event. For unconfigured devices, | ||
2815 | * it will send Unconfigued Index Added event. | ||
2816 | * | ||
2817 | * Devices with HCI_QUIRK_RAW_DEVICE are ignored | ||
2818 | * and no event will be send. | ||
2819 | */ | ||
2820 | mgmt_index_added(hdev); | ||
2817 | } | 2821 | } |
2818 | } | 2822 | } |
2819 | 2823 | ||
@@ -4032,8 +4036,7 @@ void hci_unregister_dev(struct hci_dev *hdev) | |||
4032 | cancel_work_sync(&hdev->power_on); | 4036 | cancel_work_sync(&hdev->power_on); |
4033 | 4037 | ||
4034 | if (!test_bit(HCI_INIT, &hdev->flags) && | 4038 | if (!test_bit(HCI_INIT, &hdev->flags) && |
4035 | !test_bit(HCI_SETUP, &hdev->dev_flags) && | 4039 | !test_bit(HCI_SETUP, &hdev->dev_flags)) { |
4036 | !test_bit(HCI_UNCONFIGURED, &hdev->dev_flags)) { | ||
4037 | hci_dev_lock(hdev); | 4040 | hci_dev_lock(hdev); |
4038 | mgmt_index_removed(hdev); | 4041 | mgmt_index_removed(hdev); |
4039 | hci_dev_unlock(hdev); | 4042 | hci_dev_unlock(hdev); |