public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/2] main.conf: Enable passing false to DeviceID
@ 2021-03-05 23:00 Luiz Augusto von Dentz
  2021-03-05 23:00 ` [PATCH BlueZ 2/2] gatt: Fix registering DIS without a valid source Luiz Augusto von Dentz
  2021-03-05 23:38 ` [BlueZ,1/2] main.conf: Enable passing false to DeviceID bluez.test.bot
  0 siblings, 2 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2021-03-05 23:00 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds support for setting DeviceID to false so plaforms can disable
DeviceID.

Fixes: https://github.com/bluez/bluez/issues/101
---
 src/main.c    | 8 +++++++-
 src/main.conf | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/main.c b/src/main.c
index b66e2b8cb..572dc939c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -188,10 +188,16 @@ static void parse_did(const char *did)
 	int result;
 	uint16_t vendor, product, version , source;
 
-	/* version and source are optional */
+	vendor = 0x0000;
+	product = 0x0000;
 	version = 0x0000;
 	source = 0x0002;
 
+	if (!strcasecmp(did, "false")) {
+		source = 0x0000;
+		goto done;
+	}
+
 	result = sscanf(did, "bluetooth:%4hx:%4hx:%4hx",
 					&vendor, &product, &version);
 	if (result != EOF && result >= 2) {
diff --git a/src/main.conf b/src/main.conf
index ad36638b7..f47cab46d 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -26,7 +26,7 @@
 # Use vendor id source (assigner), vendor, product and version information for
 # DID profile support. The values are separated by ":" and assigner, VID, PID
 # and version.
-# Possible vendor id source values: bluetooth, usb (defaults to usb)
+# Possible vendor id source values: bluetooth, usb (default) or false (disabled)
 #DeviceID = bluetooth:1234:5678:abcd
 
 # Do reverse service discovery for previously unknown devices that connect to
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH BlueZ 2/2] gatt: Fix registering DIS without a valid source
  2021-03-05 23:00 [PATCH BlueZ 1/2] main.conf: Enable passing false to DeviceID Luiz Augusto von Dentz
@ 2021-03-05 23:00 ` Luiz Augusto von Dentz
  2021-03-05 23:38 ` [BlueZ,1/2] main.conf: Enable passing false to DeviceID bluez.test.bot
  1 sibling, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2021-03-05 23:00 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

If source has not been set don't register DIS as it would not contain
any useful information and by doing this it actually allows systems to
register their own DIS instance.
---
 src/gatt-database.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/src/gatt-database.c b/src/gatt-database.c
index bd5864bcd..be6dfb265 100644
--- a/src/gatt-database.c
+++ b/src/gatt-database.c
@@ -1241,22 +1241,22 @@ static void device_info_read_pnp_id_cb(struct gatt_db_attribute *attrib,
 static void populate_devinfo_service(struct btd_gatt_database *database)
 {
 	struct gatt_db_attribute *service;
+	struct gatt_db_attribute *attrib;
 	bt_uuid_t uuid;
 
+	if (!btd_opts.did_source)
+		return;
+
 	bt_uuid16_create(&uuid, UUID_DIS);
 	service = gatt_db_add_service(database->db, &uuid, true, 3);
 
-	if (btd_opts.did_source > 0) {
-		struct gatt_db_attribute *attrib;
-
-		bt_uuid16_create(&uuid, GATT_CHARAC_PNP_ID);
-		attrib = gatt_db_service_add_characteristic(service, &uuid,
+	bt_uuid16_create(&uuid, GATT_CHARAC_PNP_ID);
+	attrib = gatt_db_service_add_characteristic(service, &uuid,
 						BT_ATT_PERM_READ,
 						BT_GATT_CHRC_PROP_READ,
 						device_info_read_pnp_id_cb,
 						NULL, database);
-		gatt_db_attribute_set_fixed_length(attrib, 7);
-	}
+	gatt_db_attribute_set_fixed_length(attrib, 7);
 
 	gatt_db_service_set_active(service, true);
 
@@ -1267,10 +1267,7 @@ static void register_core_services(struct btd_gatt_database *database)
 {
 	populate_gap_service(database);
 	populate_gatt_service(database);
-
-	if (btd_opts.did_source > 0)
-		populate_devinfo_service(database);
-
+	populate_devinfo_service(database);
 }
 
 static void conf_cb(void *user_data)
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [BlueZ,1/2] main.conf: Enable passing false to DeviceID
  2021-03-05 23:00 [PATCH BlueZ 1/2] main.conf: Enable passing false to DeviceID Luiz Augusto von Dentz
  2021-03-05 23:00 ` [PATCH BlueZ 2/2] gatt: Fix registering DIS without a valid source Luiz Augusto von Dentz
@ 2021-03-05 23:38 ` bluez.test.bot
  2021-03-06  1:18   ` Luiz Augusto von Dentz
  1 sibling, 1 reply; 4+ messages in thread
From: bluez.test.bot @ 2021-03-05 23:38 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 557 bytes --]

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=443019

---Test result---

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

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

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

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



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BlueZ,1/2] main.conf: Enable passing false to DeviceID
  2021-03-05 23:38 ` [BlueZ,1/2] main.conf: Enable passing false to DeviceID bluez.test.bot
@ 2021-03-06  1:18   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2021-03-06  1:18 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org

Hi,

On Fri, Mar 5, 2021 at 3:38 PM <bluez.test.bot@gmail.com> wrote:
>
> 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=443019
>
> ---Test result---
>
> ##############################
> Test: CheckPatch - PASS
>
> ##############################
> Test: CheckGitLint - PASS
>
> ##############################
> Test: CheckBuild - PASS
>
> ##############################
> Test: MakeCheck - PASS
>
>
>
> ---
> Regards,
> Linux Bluetooth

Pushed.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-06  1:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-05 23:00 [PATCH BlueZ 1/2] main.conf: Enable passing false to DeviceID Luiz Augusto von Dentz
2021-03-05 23:00 ` [PATCH BlueZ 2/2] gatt: Fix registering DIS without a valid source Luiz Augusto von Dentz
2021-03-05 23:38 ` [BlueZ,1/2] main.conf: Enable passing false to DeviceID bluez.test.bot
2021-03-06  1:18   ` Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox