Skip to content

Commit f0cfc48

Browse files
apanditholtmann
authored andcommitted
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 <[email protected]> Reviewed-by: Miao-chen Chou <[email protected]> Reviewed-by: Sonny Sasaka <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 346ce5b commit f0cfc48

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

include/net/bluetooth/mgmt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,7 @@ struct mgmt_ev_device_connected {
842842
#define MGMT_DEV_DISCONN_LOCAL_HOST 0x02
843843
#define MGMT_DEV_DISCONN_REMOTE 0x03
844844
#define MGMT_DEV_DISCONN_AUTH_FAILURE 0x04
845+
#define MGMT_DEV_DISCONN_LOCAL_HOST_SUSPEND 0x05
845846

846847
#define MGMT_EV_DEVICE_DISCONNECTED 0x000C
847848
struct mgmt_ev_device_disconnected {

net/bluetooth/mgmt.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8270,6 +8270,10 @@ void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
82708270
ev.addr.type = link_to_bdaddr(link_type, addr_type);
82718271
ev.reason = reason;
82728272

8273+
/* Report disconnects due to suspend */
8274+
if (hdev->suspended)
8275+
ev.reason = MGMT_DEV_DISCONN_LOCAL_HOST_SUSPEND;
8276+
82738277
mgmt_event(MGMT_EV_DEVICE_DISCONNECTED, hdev, &ev, sizeof(ev), sk);
82748278

82758279
if (sk)

0 commit comments

Comments
 (0)