Pārlūkot izejas kodu

Bluetooth: Fix incorrect bits for LE states

This patch fixes incorrect checks for LE states.
Issues found when doing mgmt tests for scenario
when Linux Kernel should do connectable advertising
while connected.

Signed-off-by: Łukasz Rymanowski <lukasz.rymanowski@codecoup.pl>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Łukasz Rymanowski 7 gadi atpakaļ
vecāks
revīzija
62ebdc25c4
1 mainītis faili ar 3 papildinājumiem un 3 dzēšanām
  1. 3 3
      net/bluetooth/hci_request.c

+ 3 - 3
net/bluetooth/hci_request.c

@@ -934,8 +934,8 @@ static bool is_advertising_allowed(struct hci_dev *hdev, bool connectable)
 		/* Slave connection state and connectable mode bit 38
 		/* Slave connection state and connectable mode bit 38
 		 * and scannable bit 21.
 		 * and scannable bit 21.
 		 */
 		 */
-		if (connectable && (!(hdev->le_states[4] & 0x01) ||
-				    !(hdev->le_states[2] & 0x40)))
+		if (connectable && (!(hdev->le_states[4] & 0x40) ||
+				    !(hdev->le_states[2] & 0x20)))
 			return false;
 			return false;
 	}
 	}
 
 
@@ -948,7 +948,7 @@ static bool is_advertising_allowed(struct hci_dev *hdev, bool connectable)
 		/* Master connection state and connectable mode bit 35 and
 		/* Master connection state and connectable mode bit 35 and
 		 * scannable 19.
 		 * scannable 19.
 		 */
 		 */
-		if (connectable && (!(hdev->le_states[4] & 0x10) ||
+		if (connectable && (!(hdev->le_states[4] & 0x08) ||
 				    !(hdev->le_states[2] & 0x08)))
 				    !(hdev->le_states[2] & 0x08)))
 			return false;
 			return false;
 	}
 	}