Bluetooth: Fix Class of Device indication when powering off
Subsystems (2)
PATCH 1/1 Bluetooth: Fix Class of Device indication when powering off
From: Johan Hedberg <[email protected]>
When a HCI device is powered off the Management interface specification dictates that the class of device value is indicated as zero. This patch fixes sending of the appropriate class of device changed event when a HCI device is powered off.
--- net/bluetooth/mgmt.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/bluetooth/mgmt.c +6 -0
@@ -2987,7 +2987,13 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered) } }else {u8 status =MGMT_STATUS_NOT_POWERED ; +u8 zero_cod[] = {0 ,0 ,0 }; +mgmt_pending_foreach (0 , hdev, cmd_status_rsp, &status); + +if (memcmp (hdev->dev_class, zero_cod,sizeof (zero_cod)) !=0 ) +mgmt_event (MGMT_EV_CLASS_OF_DEV_CHANGED , hdev, + zero_cod,sizeof (zero_cod),NULL ); } err =new_settings (hdev, match.sk);
Signature · 1 line
1.7.10.4
Hi Johan,
Quoted 15 lines
When a HCI device is powered off the Management interface specification dictates that the class of device value is indicated as zero. This patch fixes sending of the appropriate class of device changed event when a HCI device is powered off.
Signed-off-by Johan Hedberg <[email protected]>--- net/bluetooth/mgmt.c | 6 ++++++ 1 file changed, 6 insertions(+)net/bluetooth/mgmt.c +0
-0
net/bluetooth/mgmt.c int mgmt_powered(struct hci_dev *hdev, u8 powered) · line 2994
Quoted 8 lines
net/bluetooth/mgmt.c +4
-0@@ -2987,7 +2987,13 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered) } }else {u8 status =MGMT_STATUS_NOT_POWERED ; +u8 zero_cod[] = {0 ,0 ,0 }; +mgmt_pending_foreach (0 , hdev, cmd_status_rsp, &status); + +if (memcmp (hdev->dev_class, zero_cod,sizeof (zero_cod)) !=0 )
shouldn't we better use if (memcmp( ...)) here.
net/bluetooth/mgmt.c int mgmt_powered(struct hci_dev *hdev, u8 powered) · line 2997
Quoted 3 lines
net/bluetooth/mgmt.c +2
-0+mgmt_event (MGMT_EV_CLASS_OF_DEV_CHANGED , hdev, + zero_cod,sizeof (zero_cod),NULL ); }
Otherwise this is fine with me.
Regards
Marcel
Hi Johan,
Quoted 11 lines · Johan Hedberg
From: Johan Hedberg <[email protected]>
When a HCI device is powered off the Management interface specification dictates that the class of device value is indicated as zero. This patch fixes sending of the appropriate class of device changed event when a HCI device is powered off.
Signed-off-by Johan Hedberg <[email protected]>--- net/bluetooth/mgmt.c | 6 ++++++ 1 file changed, 6 insertions(+)
Patch has been applied to bluetooth-next. Thanks.
Gustavo