[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200728184205.2.Ib9bb75b65362d32104df86ffad479761680bb2cb@changeid>
Date: Tue, 28 Jul 2020 18:42:24 -0700
From: Abhishek Pandit-Subedi <abhishekpandit@...omium.org>
To: marcel@...tmann.org, luiz.dentz@...il.com
Cc: chromeos-bluetooth-upstreaming@...omium.org,
linux-bluetooth@...r.kernel.org,
Abhishek Pandit-Subedi <abhishekpandit@...omium.org>,
Miao-chen Chou <mcchou@...omium.org>,
Sonny Sasaka <sonnysasaka@...omium.org>,
"David S. Miller" <davem@...emloft.net>,
Johan Hedberg <johan.hedberg@...il.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Jakub Kicinski <kuba@...nel.org>
Subject: [PATCH 2/3] Bluetooth: Add suspend reason for device disconnect
Update device disconnect event with reason 0x5 to indicate that device
disconnected because the controller is suspending.
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@...omium.org>
Reviewed-by: Miao-chen Chou <mcchou@...omium.org>
Reviewed-by: Sonny Sasaka <sonnysasaka@...omium.org>
---
include/net/bluetooth/mgmt.h | 1 +
net/bluetooth/mgmt.c | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index d9a88cab379555..1a98f836aad126 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -840,6 +840,7 @@ struct mgmt_ev_device_connected {
#define MGMT_DEV_DISCONN_LOCAL_HOST 0x02
#define MGMT_DEV_DISCONN_REMOTE 0x03
#define MGMT_DEV_DISCONN_AUTH_FAILURE 0x04
+#define MGMT_DEV_DISCONN_LOCAL_HOST_SUSPEND 0x05
#define MGMT_EV_DEVICE_DISCONNECTED 0x000C
struct mgmt_ev_device_disconnected {
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 1c89ae819207ac..fcda479134c756 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -8124,6 +8124,10 @@ void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
ev.addr.type = link_to_bdaddr(link_type, addr_type);
ev.reason = reason;
+ /* Report disconnects due to suspend */
+ if (hdev->suspended)
+ ev.reason = MGMT_DEV_DISCONN_LOCAL_HOST_SUSPEND;
+
mgmt_event(MGMT_EV_DEVICE_DISCONNECTED, hdev, &ev, sizeof(ev), sk);
if (sk)
--
2.28.0.rc0.142.g3c755180ce-goog
Powered by blists - more mailing lists