diff mbox series

[BlueZ,v1] core: Disable advmon manager interface for old kernel

Message ID 20201216151748.BlueZ.v1.1.I6e3ace32f08a22879ede97a1433f524189bf24df@changeid (mailing list archive)
State New, archived
Headers show
Series [BlueZ,v1] core: Disable advmon manager interface for old kernel | expand

Commit Message

Howard Chung Dec. 16, 2020, 7:18 a.m. UTC
This disables Advertisement monitor manager interface if the underlying
kernel does not support necessary MGMT commands such as add/remove
filters, so clients can know that they are not able to register any
filters before actually register one.
---

 src/adapter.c | 9 +++++++--
 src/adapter.h | 1 +
 2 files changed, 8 insertions(+), 2 deletions(-)

Comments

bluez.test.bot@gmail.com Dec. 16, 2020, 7:36 a.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=402711

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

##############################
Test: MakeCheck - PASS



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/src/adapter.c b/src/adapter.c
index ec6a6a64c50a..cbfbd5feecd9 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -8649,7 +8649,8 @@  static int adapter_register(struct btd_adapter *adapter)
 	adapter->adv_manager = btd_adv_manager_new(adapter, adapter->mgmt);
 
 	if (g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL) {
-		if (adapter->supported_settings & MGMT_SETTING_LE) {
+		if (adapter->supported_settings & MGMT_SETTING_LE &&
+			btd_has_kernel_features(KERNEL_ADV_MONITOR_CMDS)) {
 			adapter->adv_monitor_manager =
 				btd_adv_monitor_manager_create(adapter,
 								adapter->mgmt);
@@ -8661,7 +8662,7 @@  static int adapter_register(struct btd_adapter *adapter)
 			}
 		} else {
 			btd_info(adapter->dev_id, "Adv Monitor Manager "
-					"skipped, LE unavailable");
+					"skipped, kernel or LE unavailable");
 		}
 	}
 
@@ -9721,6 +9722,10 @@  static void read_commands_complete(uint8_t status, uint16_t length,
 			DBG("kernel supports controller cap command");
 			kernel_features |= KERNEL_HAS_CONTROLLER_CAP_CMD;
 			break;
+		case MGMT_OP_ADD_ADV_PATTERNS_MONITOR:
+			DBG("kernel supports adv monitor commands");
+			kernel_features |= KERNEL_ADV_MONITOR_CMDS;
+			break;
 		default:
 			break;
 		}
diff --git a/src/adapter.h b/src/adapter.h
index 60b5e3bcca34..39bb3990abbe 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -237,6 +237,7 @@  enum kernel_features {
 	KERNEL_HAS_RESUME_EVT		= 1 << 4,
 	KERNEL_HAS_EXT_ADV_ADD_CMDS	= 1 << 5,
 	KERNEL_HAS_CONTROLLER_CAP_CMD	= 1 << 6,
+	KERNEL_ADV_MONITOR_CMDS		= 1 << 7,
 };
 
 bool btd_has_kernel_features(uint32_t feature);