summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2014-12-05 13:03:35 +0100
committerJohan Hedberg <johan.hedberg@intel.com>2014-12-05 14:14:28 +0200
commitda25cf6a9869cff52b4fd189fdcd322ad2daf023 (patch)
tree87fa00769125e8ee332b6346f24786bb4d6eb73a /net
parentefb2513fd6278d97d2114ab87f019f4fed01c037 (diff)
downloadop-kernel-dev-da25cf6a9869cff52b4fd189fdcd322ad2daf023.zip
op-kernel-dev-da25cf6a9869cff52b4fd189fdcd322ad2daf023.tar.gz
Bluetooth: Report invalid RSSI for service discovery and background scan
When using Start Service Discovery and when background scanning is used to report devices, the RSSI is reported or the value 127 is provided in case RSSI in unavailable. For Start Discovery the value 0 is reported to keep backwards compatibility with the existing users. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/mgmt.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 3ca2818..a91e484 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3912,6 +3912,7 @@ static int start_discovery(struct sock *sk, struct hci_dev *hdev,
hci_discovery_filter_clear(hdev);
hdev->discovery.type = cp->type;
+ hdev->discovery.report_invalid_rssi = false;
hci_req_init(&req, hdev);
@@ -7022,8 +7023,15 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
memset(buf, 0, sizeof(buf));
- /* Reset invalid RSSI to 0 to keep backwards API compliance */
- if (rssi == HCI_RSSI_INVALID)
+ /* In case of device discovery with BR/EDR devices (pre 1.2), the
+ * RSSI value was reported as 0 when not available. This behavior
+ * is kept when using device discovery. This is required for full
+ * backwards compatibility with the API.
+ *
+ * However when using service discovery, the value 127 will be
+ * returned when the RSSI is not available.
+ */
+ if (rssi == HCI_RSSI_INVALID && !hdev->discovery.report_invalid_rssi)
rssi = 0;
bacpy(&ev->addr.bdaddr, bdaddr);
OpenPOWER on IntegriCloud