public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 1/2] main.conf: Enable passing false to DeviceID
Date: Fri,  5 Mar 2021 15:00:03 -0800	[thread overview]
Message-ID: <20210305230004.4010887-1-luiz.dentz@gmail.com> (raw)

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


             reply	other threads:[~2021-03-05 23:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05 23:00 Luiz Augusto von Dentz [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210305230004.4010887-1-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox