Bluetooth: Make LE only events conditional on supported commands
Subsystems (2)
Marcel Holtmann
maintainerPATCH 3/4 Bluetooth: Make LE only events conditional on supported commands
For the LE only controllers, there are events that should not be enabled if the corresponding command is not supported.
--- net/bluetooth/hci_core.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
net/bluetooth/hci_core.c +11 -4
@@ -534,13 +534,20 @@ static void hci_setup_event_mask(struct hci_request *req) }else {/* Use a different default for LE-only devices */ memset (events,0 ,sizeof (events)); - events[0 ] |=0x10 ;/* Disconnection Complete */ - events[1 ] |=0x08 ;/* Read Remote Version Information Complete */ events[1 ] |=0x20 ;/* Command Complete */ events[1 ] |=0x40 ;/* Command Status */ events[1 ] |=0x80 ;/* Hardware Error */ - events[2 ] |=0x04 ;/* Number of Completed Packets */ - events[3 ] |=0x02 ;/* Data Buffer Overflow */ + +if (hdev->commands[0 ] &0x20 ) { + events[0 ] |=0x10 ;/* Disconnection Complete */ + events[2 ] |=0x04 ;/* Number of Completed Packets */ + events[3 ] |=0x02 ;/* Data Buffer Overflow */ + } + +if (hdev->commands[2 ] &0x80 ) + events[1 ] |=0x08 ;/* Read Remote Version Information +* Complete +*/ if (hdev->le_features[0 ] &HCI_LE_ENCRYPTION ) { events[0 ] |=0x80 ;/* Encryption Change */
Signature · 1 line
2.4.3
Hi Marcel,
Quoted 7 lines · Marcel Holtmann
For the LE only controllers, there are events that should not be enabled if the corresponding command is not supported.
Signed-off-by Marcel Holtmann <[email protected]>--- net/bluetooth/hci_core.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
I've applied patches 1, 2 and 4 from this set, but could you add some clarifications to this one:
Quoted 7 lines
net/bluetooth/hci_core.c +0
-2@@ -534,13 +534,20 @@ static void hci_setup_event_mask(struct hci_request *req) }else {/* Use a different default for LE-only devices */ memset (events,0 ,sizeof (events)); - events[0 ] |=0x10 ;/* Disconnection Complete */ - events[1 ] |=0x08 ;/* Read Remote Version Information Complete */ events[1 ] |=0x20 ;/* Command Complete */
net/bluetooth/hci_core.c static void hci_setup_event_mask(struct hci_request *req) · line 545
Quoted 10 lines
net/bluetooth/hci_core.c +6
-2events[1 ] |=0x40 ;/* Command Status */ events[1 ] |=0x80 ;/* Hardware Error */ - events[2 ] |=0x04 ;/* Number of Completed Packets */ - events[3 ] |=0x02 ;/* Data Buffer Overflow */ + +if (hdev->commands[0 ] &0x20 ) { + events[0 ] |=0x10 ;/* Disconnection Complete */ + events[2 ] |=0x04 ;/* Number of Completed Packets */ + events[3 ] |=0x02 ;/* Data Buffer Overflow */ + }
Which exact command is "hdev->commands[0] & 0x20"? Could you add a code comment here to make it clear.
net/bluetooth/hci_core.c static void hci_setup_event_mask(struct hci_request *req) · line 550
Quoted 4 lines
net/bluetooth/hci_core.c +4
-0+if (hdev->commands[2 ] &0x80 ) + events[1 ] |=0x08 ;/* Read Remote Version Information +* Complete +*/
I assume this one is HCI_Read_Remote_Version_Information, but might be good to add a code comment for it too.
Johan