All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bluez PATCH v3 0/3] Adding bonded flag to D-Bus property
@ 2022-05-04 21:09 Zhengping Jiang
  2022-05-04 21:09 ` [Bluez PATCH v3 1/3] device: Add "Bonded" flag to dbus property Zhengping Jiang
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Zhengping Jiang @ 2022-05-04 21:09 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz
  Cc: chromeos-bluetooth-upstreaming, Zhengping Jiang

Currently BlueZ client can't know easily whether a device is bonded or
not. This is causing issues for a number of applications. For example,
in the Nearby Share case, the peer device is paired, but not bonded.
This series will add the "Bonded" property in org.bluez.Device1 D-Bus
interface. Changes are also made in bluetoothctl to show the status of
the bonded flag as well as a list of bonded devices.

Changes in v3:
- Move documentation update to a separate patch
- Add description to bonded and paired
- Add an optional argument to the devices command to filter device list
- Remove paired-devices command

Changes in v2:
- Move one variable declaration to the top following C90 standard

Changes in v1:
- Add "Bonded" to D-Bus interface
- Send property changed signal if the bonded flag is changed
- Show the status of the "Bonded" flag in bluetoothctl
- Add option to show list of bonded devices

Zhengping Jiang (3):
  device: Add "Bonded" flag to dbus property
  doc: add "Bonded" flag to dbus property
  client: Add filter to devices and show Bonded in info

 client/main.c      | 72 ++++++++++++++++++++++++++++++----------------
 doc/device-api.txt | 12 +++++++-
 src/device.c       | 38 ++++++++++++++++++++----
 3 files changed, 91 insertions(+), 31 deletions(-)

-- 
2.36.0.464.gb9c8b46e94-goog


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

* [Bluez PATCH v3 1/3] device: Add "Bonded" flag to dbus property
  2022-05-04 21:09 [Bluez PATCH v3 0/3] Adding bonded flag to D-Bus property Zhengping Jiang
@ 2022-05-04 21:09 ` Zhengping Jiang
  2022-05-04 22:40   ` Adding bonded flag to D-Bus property bluez.test.bot
  2022-05-04 21:09 ` [Bluez PATCH v3 2/3] doc: add "Bonded" flag to dbus property Zhengping Jiang
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Zhengping Jiang @ 2022-05-04 21:09 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz
  Cc: chromeos-bluetooth-upstreaming, Zhengping Jiang, Sonny Sasaka,
	Yun-Hao Chung

Add "Bonded" to dbus device property table. When setting the "Bonded
flag, check the status of the Bonded property first. If the Bonded
property is changed, send property changed signal.

Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
Reviewed-by: Yun-Hao Chung <howardchung@chromium.org>

Signed-off-by: Zhengping Jiang <jiangzp@google.com>
---

(no changes since v2)

Changes in v2:
- Move one variable declaration to the top following C90 standard

Changes in v1:
- Add "Bonded" to D-Bus interface
- Send property changed signal if the bonded flag is changed

 src/device.c | 38 +++++++++++++++++++++++++++++++++-----
 1 file changed, 33 insertions(+), 5 deletions(-)

diff --git a/src/device.c b/src/device.c
index a62564b14f49..72804713b25b 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1143,6 +1143,22 @@ static gboolean dev_property_get_paired(const GDBusPropertyTable *property,
 	return TRUE;
 }
 
+static gboolean dev_property_get_bonded(const GDBusPropertyTable *property,
+					DBusMessageIter *iter, void *data)
+{
+	struct btd_device *dev = data;
+	dbus_bool_t val;
+
+	if (dev->bredr_state.bonded || dev->le_state.bonded)
+		val = TRUE;
+	else
+		val = FALSE;
+
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &val);
+
+	return TRUE;
+}
+
 static gboolean dev_property_get_legacy(const GDBusPropertyTable *property,
 					DBusMessageIter *iter, void *data)
 {
@@ -4033,6 +4049,7 @@ static const GDBusPropertyTable device_properties[] = {
 	{ "Icon", "s", dev_property_get_icon, NULL,
 					dev_property_exists_icon },
 	{ "Paired", "b", dev_property_get_paired },
+	{ "Bonded", "b", dev_property_get_bonded },
 	{ "Trusted", "b", dev_property_get_trusted, dev_property_set_trusted },
 	{ "Blocked", "b", dev_property_get_blocked, dev_property_set_blocked },
 	{ "LegacyPairing", "b", dev_property_get_legacy },
@@ -7065,14 +7082,25 @@ void device_set_bonded(struct btd_device *device, uint8_t bdaddr_type)
 	if (!device)
 		return;
 
-	DBG("");
+	struct bearer_state *state = get_state(device, bdaddr_type);
 
-	if (bdaddr_type == BDADDR_BREDR)
-		device->bredr_state.bonded = true;
-	else
-		device->le_state.bonded = true;
+	if (state->bonded)
+		return;
+
+	DBG("setting bonded for device to true");
+
+	state->bonded = true;
 
 	btd_device_set_temporary(device, false);
+
+	/* If the other bearer state was already true we don't need to
+	 * send any property signals.
+	 */
+	if (device->bredr_state.bonded == device->le_state.bonded)
+		return;
+
+	g_dbus_emit_property_changed(dbus_conn, device->path,
+						DEVICE_INTERFACE, "Bonded");
 }
 
 void device_set_legacy(struct btd_device *device, bool legacy)
-- 
2.36.0.464.gb9c8b46e94-goog


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

* [Bluez PATCH v3 2/3] doc: add "Bonded" flag to dbus property
  2022-05-04 21:09 [Bluez PATCH v3 0/3] Adding bonded flag to D-Bus property Zhengping Jiang
  2022-05-04 21:09 ` [Bluez PATCH v3 1/3] device: Add "Bonded" flag to dbus property Zhengping Jiang
@ 2022-05-04 21:09 ` Zhengping Jiang
  2022-05-04 21:37   ` Bastien Nocera
  2022-05-04 21:09 ` [Bluez PATCH v3 3/3] client: Add filter to devices and show Bonded in info Zhengping Jiang
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Zhengping Jiang @ 2022-05-04 21:09 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz
  Cc: chromeos-bluetooth-upstreaming, Zhengping Jiang, Sonny Sasaka,
	Yun-Hao Chung

Bonded flag is used to indicate the link key or ltk of the remote
device has been stored.

Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
Reviewed-by: Yun-Hao Chung <howardchung@chromium.org>

Signed-off-by: Zhengping Jiang <jiangzp@google.com>
---

Changes in v3:
- Move documentation update to a separate patch
- Add description to bonded and paired

 doc/device-api.txt | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/doc/device-api.txt b/doc/device-api.txt
index 1e8590b27d58..c7e217c07526 100644
--- a/doc/device-api.txt
+++ b/doc/device-api.txt
@@ -246,7 +246,17 @@ Properties	string Address [readonly]
 
 		boolean Paired [readonly]
 
-			Indicates if the remote device is paired.
+			Indicates if the remote device is paired. Pairing is
+			the process where devices exchange the information to
+			establish an encrypted connection.
+
+		boolean Bonded [readonly]
+
+			Indicates if the remote device is bonded. Bonded means
+			the link key or the ltk from the pairing process has
+			been stored.
+			A PropertiesChanged signal indicate changes to this
+			status.
 
 		boolean Connected [readonly]
 
-- 
2.36.0.464.gb9c8b46e94-goog


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

* [Bluez PATCH v3 3/3] client: Add filter to devices and show Bonded in info
  2022-05-04 21:09 [Bluez PATCH v3 0/3] Adding bonded flag to D-Bus property Zhengping Jiang
  2022-05-04 21:09 ` [Bluez PATCH v3 1/3] device: Add "Bonded" flag to dbus property Zhengping Jiang
  2022-05-04 21:09 ` [Bluez PATCH v3 2/3] doc: add "Bonded" flag to dbus property Zhengping Jiang
@ 2022-05-04 21:09 ` Zhengping Jiang
  2022-05-04 21:49 ` [Bluez PATCH v3 0/3] Adding bonded flag to D-Bus property Luiz Augusto von Dentz
  2022-05-04 22:50 ` patchwork-bot+bluetooth
  4 siblings, 0 replies; 11+ messages in thread
From: Zhengping Jiang @ 2022-05-04 21:09 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz
  Cc: chromeos-bluetooth-upstreaming, Zhengping Jiang, Sonny Sasaka,
	Yun-Hao Chung

Use the property name as optional filters to the command "devices" and
show the "Bonded" property for the command "info".

Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
Reviewed-by: Yun-Hao Chung <howardchung@chromium.org>

Signed-off-by: Zhengping Jiang <jiangzp@google.com>
---

Changes in v3:
- Add an optional argument to the devices command to filter device list
- Remove paired-devices command

Changes in v1:
- Show the status of the "Bonded" flag in bluetoothctl
- Add option to show list of bonded devices

 client/main.c | 72 +++++++++++++++++++++++++++++++++------------------
 1 file changed, 47 insertions(+), 25 deletions(-)

diff --git a/client/main.c b/client/main.c
index 29a2f882e5c8..58678224f93f 100644
--- a/client/main.c
+++ b/client/main.c
@@ -95,6 +95,14 @@ static const char *ad_arguments[] = {
 	NULL
 };
 
+static const char * const device_arguments[] = {
+	"Paired",
+	"Bonded",
+	"Trusted",
+	"Connected",
+	NULL
+};
+
 static void proxy_leak(gpointer data)
 {
 	printf("Leaking proxy %p\n", data);
@@ -929,6 +937,28 @@ static gboolean check_default_ctrl(void)
 	return TRUE;
 }
 
+static gboolean parse_argument_devices(int argc, char *argv[],
+				       const char * const *arg_table,
+				       const char **option)
+{
+	const char * const *opt;
+
+	if (argc < 2) {
+		*option = NULL;
+		return TRUE;
+	}
+
+	for (opt = arg_table; opt && *opt; opt++) {
+		if (strcmp(argv[1], *opt) == 0) {
+			*option = *opt;
+			return TRUE;
+		}
+	}
+
+	bt_shell_printf("Invalid argument %s\n", argv[1]);
+	return FALSE;
+}
+
 static gboolean parse_argument(int argc, char *argv[], const char **arg_table,
 					const char *msg, dbus_bool_t *value,
 					const char **option)
@@ -1068,22 +1098,11 @@ static void cmd_select(int argc, char *argv[])
 static void cmd_devices(int argc, char *argv[])
 {
 	GList *ll;
+	const char *property;
 
-	if (check_default_ctrl() == FALSE)
-		return bt_shell_noninteractive_quit(EXIT_SUCCESS);
-
-	for (ll = g_list_first(default_ctrl->devices);
-			ll; ll = g_list_next(ll)) {
-		GDBusProxy *proxy = ll->data;
-		print_device(proxy, NULL);
-	}
-
-	return bt_shell_noninteractive_quit(EXIT_SUCCESS);
-}
-
-static void cmd_paired_devices(int argc, char *argv[])
-{
-	GList *ll;
+	if (!parse_argument_devices(argc, argv, device_arguments,
+					&property))
+		return bt_shell_noninteractive_quit(EXIT_FAILURE);
 
 	if (check_default_ctrl() == FALSE)
 		return bt_shell_noninteractive_quit(EXIT_SUCCESS);
@@ -1092,15 +1111,17 @@ static void cmd_paired_devices(int argc, char *argv[])
 			ll; ll = g_list_next(ll)) {
 		GDBusProxy *proxy = ll->data;
 		DBusMessageIter iter;
-		dbus_bool_t paired;
+		dbus_bool_t status;
 
-		if (g_dbus_proxy_get_property(proxy, "Paired", &iter) == FALSE)
-			continue;
-
-		dbus_message_iter_get_basic(&iter, &paired);
-		if (!paired)
-			continue;
+		if (property) {
+			if (g_dbus_proxy_get_property(proxy,
+					property, &iter) == FALSE)
+				continue;
 
+			dbus_message_iter_get_basic(&iter, &status);
+			if (!status)
+				continue;
+		}
 		print_device(proxy, NULL);
 	}
 
@@ -1787,6 +1808,7 @@ static void cmd_info(int argc, char *argv[])
 	print_property(proxy, "Appearance");
 	print_property(proxy, "Icon");
 	print_property(proxy, "Paired");
+	print_property(proxy, "Bonded");
 	print_property(proxy, "Trusted");
 	print_property(proxy, "Blocked");
 	print_property(proxy, "Connected");
@@ -3170,9 +3192,9 @@ static const struct bt_shell_menu main_menu = {
 							ctrl_generator },
 	{ "select",       "<ctrl>",   cmd_select, "Select default controller",
 							ctrl_generator },
-	{ "devices",      NULL,       cmd_devices, "List available devices" },
-	{ "paired-devices", NULL,     cmd_paired_devices,
-					"List paired devices"},
+	{ "devices",      "[Paired/Bonded/Trusted/Connected]", cmd_devices,
+					"List available devices, with an "
+					"optional property as the filter" },
 	{ "system-alias", "<name>",   cmd_system_alias,
 					"Set controller alias" },
 	{ "reset-alias",  NULL,       cmd_reset_alias,
-- 
2.36.0.464.gb9c8b46e94-goog


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

* Re: [Bluez PATCH v3 2/3] doc: add "Bonded" flag to dbus property
  2022-05-04 21:09 ` [Bluez PATCH v3 2/3] doc: add "Bonded" flag to dbus property Zhengping Jiang
@ 2022-05-04 21:37   ` Bastien Nocera
       [not found]     ` <CAB4PzUq0FKEE2JbwO6nss3s42M6rbNSt6BGGoGVhuzzR2+1mNw@mail.gmail.com>
  2022-05-04 22:19     ` Luiz Augusto von Dentz
  0 siblings, 2 replies; 11+ messages in thread
From: Bastien Nocera @ 2022-05-04 21:37 UTC (permalink / raw)
  To: Zhengping Jiang, linux-bluetooth, luiz.dentz
  Cc: chromeos-bluetooth-upstreaming, Sonny Sasaka, Yun-Hao Chung

On Wed, 2022-05-04 at 14:09 -0700, Zhengping Jiang wrote:
> Bonded flag is used to indicate the link key or ltk of the remote
> device has been stored.
> 
> Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
> Reviewed-by: Yun-Hao Chung <howardchung@chromium.org>
> 
> Signed-off-by: Zhengping Jiang <jiangzp@google.com>
> ---
> 
> Changes in v3:
> - Move documentation update to a separate patch
> - Add description to bonded and paired
> 
>  doc/device-api.txt | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/device-api.txt b/doc/device-api.txt
> index 1e8590b27d58..c7e217c07526 100644
> --- a/doc/device-api.txt
> +++ b/doc/device-api.txt
> @@ -246,7 +246,17 @@ Properties string Address [readonly]
>  
>                 boolean Paired [readonly]
>  
> -                       Indicates if the remote device is paired.
> +                       Indicates if the remote device is paired. Pairing is
> +                       the process where devices exchange the information to
> +                       establish an encrypted connection.
> +
> +               boolean Bonded [readonly]
> +
> +                       Indicates if the remote device is bonded. Bonded means
> +                       the link key or the ltk from the pairing process has
> +                       been stored.

"long-term key (LTK)"

Is Paired effectively the same as Bonded for Classic devices? If so,
would be great to mention.

> +                       A PropertiesChanged signal indicate changes to this
> +                       status.
>  
>                 boolean Connected [readonly]
>  


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

* Re: [Bluez PATCH v3 0/3] Adding bonded flag to D-Bus property
  2022-05-04 21:09 [Bluez PATCH v3 0/3] Adding bonded flag to D-Bus property Zhengping Jiang
                   ` (2 preceding siblings ...)
  2022-05-04 21:09 ` [Bluez PATCH v3 3/3] client: Add filter to devices and show Bonded in info Zhengping Jiang
@ 2022-05-04 21:49 ` Luiz Augusto von Dentz
       [not found]   ` <CAB4PzUrFr+ZXMNpToM+c4pfNJoAdVyfV2XoCGKtUGg_3MMCtag@mail.gmail.com>
  2022-05-04 22:50 ` patchwork-bot+bluetooth
  4 siblings, 1 reply; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2022-05-04 21:49 UTC (permalink / raw)
  To: Zhengping Jiang; +Cc: linux-bluetooth, ChromeOS Bluetooth Upstreaming

Hi Zhengping,

On Wed, May 4, 2022 at 2:09 PM Zhengping Jiang <jiangzp@google.com> wrote:
>
> Currently BlueZ client can't know easily whether a device is bonded or
> not. This is causing issues for a number of applications. For example,
> in the Nearby Share case, the peer device is paired, but not bonded.
> This series will add the "Bonded" property in org.bluez.Device1 D-Bus
> interface. Changes are also made in bluetoothctl to show the status of
> the bonded flag as well as a list of bonded devices.
>
> Changes in v3:
> - Move documentation update to a separate patch
> - Add description to bonded and paired
> - Add an optional argument to the devices command to filter device list
> - Remove paired-devices command
>
> Changes in v2:
> - Move one variable declaration to the top following C90 standard
>
> Changes in v1:
> - Add "Bonded" to D-Bus interface
> - Send property changed signal if the bonded flag is changed
> - Show the status of the "Bonded" flag in bluetoothctl
> - Add option to show list of bonded devices
>
> Zhengping Jiang (3):
>   device: Add "Bonded" flag to dbus property
>   doc: add "Bonded" flag to dbus property
>   client: Add filter to devices and show Bonded in info
>
>  client/main.c      | 72 ++++++++++++++++++++++++++++++----------------
>  doc/device-api.txt | 12 +++++++-
>  src/device.c       | 38 ++++++++++++++++++++----
>  3 files changed, 91 insertions(+), 31 deletions(-)
>
> --
> 2.36.0.464.gb9c8b46e94-goog

src/device.c: In function ‘device_set_bonded’:
src/device.c:6141:9: error: ISO C90 forbids mixed declarations and
code [-Werror=declaration-after-statement]
 6141 |         struct bearer_state *state = get_state(device, bdaddr_type);
      |


-- 
Luiz Augusto von Dentz

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

* Re: [Bluez PATCH v3 0/3] Adding bonded flag to D-Bus property
       [not found]   ` <CAB4PzUrFr+ZXMNpToM+c4pfNJoAdVyfV2XoCGKtUGg_3MMCtag@mail.gmail.com>
@ 2022-05-04 21:57     ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2022-05-04 21:57 UTC (permalink / raw)
  To: Zhengping Jiang; +Cc: linux-bluetooth, ChromeOS Bluetooth Upstreaming

Hi Zhengping,

On Wed, May 4, 2022 at 2:54 PM Zhengping Jiang <jiangzp@google.com> wrote:
>
> Hi Luiz,
>
> Sorry for the error. It should have been fixed in patch 2. I think I updated the wrong version.

Don't worry, I'm fixing it myself.

> Thanks,
> Zhengping
>
> On Wed, May 4, 2022 at 2:49 PM Luiz Augusto von Dentz <luiz.dentz@gmail.com> wrote:
>>
>> Hi Zhengping,
>>
>> On Wed, May 4, 2022 at 2:09 PM Zhengping Jiang <jiangzp@google.com> wrote:
>> >
>> > Currently BlueZ client can't know easily whether a device is bonded or
>> > not. This is causing issues for a number of applications. For example,
>> > in the Nearby Share case, the peer device is paired, but not bonded.
>> > This series will add the "Bonded" property in org.bluez.Device1 D-Bus
>> > interface. Changes are also made in bluetoothctl to show the status of
>> > the bonded flag as well as a list of bonded devices.
>> >
>> > Changes in v3:
>> > - Move documentation update to a separate patch
>> > - Add description to bonded and paired
>> > - Add an optional argument to the devices command to filter device list
>> > - Remove paired-devices command
>> >
>> > Changes in v2:
>> > - Move one variable declaration to the top following C90 standard
>> >
>> > Changes in v1:
>> > - Add "Bonded" to D-Bus interface
>> > - Send property changed signal if the bonded flag is changed
>> > - Show the status of the "Bonded" flag in bluetoothctl
>> > - Add option to show list of bonded devices
>> >
>> > Zhengping Jiang (3):
>> >   device: Add "Bonded" flag to dbus property
>> >   doc: add "Bonded" flag to dbus property
>> >   client: Add filter to devices and show Bonded in info
>> >
>> >  client/main.c      | 72 ++++++++++++++++++++++++++++++----------------
>> >  doc/device-api.txt | 12 +++++++-
>> >  src/device.c       | 38 ++++++++++++++++++++----
>> >  3 files changed, 91 insertions(+), 31 deletions(-)
>> >
>> > --
>> > 2.36.0.464.gb9c8b46e94-goog
>>
>> src/device.c: In function ‘device_set_bonded’:
>> src/device.c:6141:9: error: ISO C90 forbids mixed declarations and
>> code [-Werror=declaration-after-statement]
>>  6141 |         struct bearer_state *state = get_state(device, bdaddr_type);
>>       |
>>
>>
>> --
>> Luiz Augusto von Dentz



-- 
Luiz Augusto von Dentz

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

* Re: [Bluez PATCH v3 2/3] doc: add "Bonded" flag to dbus property
       [not found]       ` <CAB4PzUoPyD2KyN4mRbUKGw5BbbyysaZdi7+0hmWrGDJdmk7Www@mail.gmail.com>
@ 2022-05-04 22:08         ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2022-05-04 22:08 UTC (permalink / raw)
  To: Zhengping Jiang
  Cc: Bastien Nocera, linux-bluetooth, ChromeOS Bluetooth Upstreaming,
	Sonny Sasaka, Yun-Hao Chung

Hi Zhengping,

On Wed, May 4, 2022 at 3:04 PM Zhengping Jiang <jiangzp@google.com> wrote:
>
> Hi Bastien,
>
> To avoid confusion, I would propose to update the description to "key information".
>
>                         Indicates if the remote device is bonded. Bonded means
>                         the key information created from the pairing process
>                         has been stored.
>
> Thanks,
> Zhengping
>

Ive changed it a little bit:

https://gist.github.com/Vudentz/ca59d846b4ff840e2ee4c01f6965def6

> On Wed, May 4, 2022 at 2:47 PM Zhengping Jiang <jiangzp@google.com> wrote:
>>
>> Hi Bastien,
>>
>> Thanks for the comment. They are not the same for Classic. "Bonded" means the key information is persistent for both LE and classic.
>> For classic the stored information is "Link key" for LE it will be "LTK". But I think if a device has both classic and LE, the two types of keys can be converted.
>>
>> Thanks,
>> Zhengping
>>
>>
>> On Wed, May 4, 2022 at 2:37 PM Bastien Nocera <hadess@hadess.net> wrote:
>>>
>>> On Wed, 2022-05-04 at 14:09 -0700, Zhengping Jiang wrote:
>>> > Bonded flag is used to indicate the link key or ltk of the remote
>>> > device has been stored.
>>> >
>>> > Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
>>> > Reviewed-by: Yun-Hao Chung <howardchung@chromium.org>
>>> >
>>> > Signed-off-by: Zhengping Jiang <jiangzp@google.com>
>>> > ---
>>> >
>>> > Changes in v3:
>>> > - Move documentation update to a separate patch
>>> > - Add description to bonded and paired
>>> >
>>> >  doc/device-api.txt | 12 +++++++++++-
>>> >  1 file changed, 11 insertions(+), 1 deletion(-)
>>> >
>>> > diff --git a/doc/device-api.txt b/doc/device-api.txt
>>> > index 1e8590b27d58..c7e217c07526 100644
>>> > --- a/doc/device-api.txt
>>> > +++ b/doc/device-api.txt
>>> > @@ -246,7 +246,17 @@ Properties string Address [readonly]
>>> >
>>> >                 boolean Paired [readonly]
>>> >
>>> > -                       Indicates if the remote device is paired.
>>> > +                       Indicates if the remote device is paired. Pairing is
>>> > +                       the process where devices exchange the information to
>>> > +                       establish an encrypted connection.
>>> > +
>>> > +               boolean Bonded [readonly]
>>> > +
>>> > +                       Indicates if the remote device is bonded. Bonded means
>>> > +                       the link key or the ltk from the pairing process has
>>> > +                       been stored.
>>>
>>> "long-term key (LTK)"
>>>
>>> Is Paired effectively the same as Bonded for Classic devices? If so,
>>> would be great to mention.
>>>
>>> > +                       A PropertiesChanged signal indicate changes to this
>>> > +                       status.
>>> >
>>> >                 boolean Connected [readonly]
>>> >
>>>


-- 
Luiz Augusto von Dentz

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

* Re: [Bluez PATCH v3 2/3] doc: add "Bonded" flag to dbus property
  2022-05-04 21:37   ` Bastien Nocera
       [not found]     ` <CAB4PzUq0FKEE2JbwO6nss3s42M6rbNSt6BGGoGVhuzzR2+1mNw@mail.gmail.com>
@ 2022-05-04 22:19     ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2022-05-04 22:19 UTC (permalink / raw)
  To: Bastien Nocera
  Cc: Zhengping Jiang, linux-bluetooth, ChromeOS Bluetooth Upstreaming,
	Sonny Sasaka, Yun-Hao Chung

Hi Bastien,

On Wed, May 4, 2022 at 2:37 PM Bastien Nocera <hadess@hadess.net> wrote:
>
> On Wed, 2022-05-04 at 14:09 -0700, Zhengping Jiang wrote:
> > Bonded flag is used to indicate the link key or ltk of the remote
> > device has been stored.
> >
> > Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
> > Reviewed-by: Yun-Hao Chung <howardchung@chromium.org>
> >
> > Signed-off-by: Zhengping Jiang <jiangzp@google.com>
> > ---
> >
> > Changes in v3:
> > - Move documentation update to a separate patch
> > - Add description to bonded and paired
> >
> >  doc/device-api.txt | 12 +++++++++++-
> >  1 file changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/doc/device-api.txt b/doc/device-api.txt
> > index 1e8590b27d58..c7e217c07526 100644
> > --- a/doc/device-api.txt
> > +++ b/doc/device-api.txt
> > @@ -246,7 +246,17 @@ Properties string Address [readonly]
> >
> >                 boolean Paired [readonly]
> >
> > -                       Indicates if the remote device is paired.
> > +                       Indicates if the remote device is paired. Pairing is
> > +                       the process where devices exchange the information to
> > +                       establish an encrypted connection.
> > +
> > +               boolean Bonded [readonly]
> > +
> > +                       Indicates if the remote device is bonded. Bonded means
> > +                       the link key or the ltk from the pairing process has
> > +                       been stored.
>
> "long-term key (LTK)"
>
> Is Paired effectively the same as Bonded for Classic devices? If so,
> would be great to mention.

There are some rare occasion where the link-keys cannot be
persisted/stored (e.g. debug keys), but in the other hand Bonded would
always means Paired, perhaps this is useful if you want to persist
some device information at upper layers otherwise I can't think of any
other use of Bonded over Paired.

> > +                       A PropertiesChanged signal indicate changes to this
> > +                       status.
> >
> >                 boolean Connected [readonly]
> >
>


-- 
Luiz Augusto von Dentz

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

* RE: Adding bonded flag to D-Bus property
  2022-05-04 21:09 ` [Bluez PATCH v3 1/3] device: Add "Bonded" flag to dbus property Zhengping Jiang
@ 2022-05-04 22:40   ` bluez.test.bot
  0 siblings, 0 replies; 11+ messages in thread
From: bluez.test.bot @ 2022-05-04 22:40 UTC (permalink / raw)
  To: linux-bluetooth, jiangzp

[-- Attachment #1: Type: text/plain, Size: 5827 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=638455

---Test result---

Test Summary:
CheckPatch                    PASS      4.37 seconds
GitLint                       PASS      2.85 seconds
Prep - Setup ELL              PASS      43.69 seconds
Build - Prep                  PASS      0.69 seconds
Build - Configure             PASS      8.79 seconds
Build - Make                  FAIL      1282.94 seconds
Make Check                    FAIL      5.14 seconds
Make Check w/Valgrind         FAIL      308.39 seconds
Make Distcheck                PASS      235.79 seconds
Build w/ext ELL - Configure   PASS      8.96 seconds
Build w/ext ELL - Make        FAIL      1253.26 seconds
Incremental Build with patchesFAIL      1279.49 seconds

Details
##############################
Test: Build - Make - FAIL
Desc: Build the BlueZ source tree
Output:
tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12364:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12364 | int main(int argc, char *argv[])
      |     ^~~~
unit/test-avdtp.c: In function ‘main’:
unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
  766 | int main(int argc, char *argv[])
      |     ^~~~
unit/test-avrcp.c: In function ‘main’:
unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
  989 | int main(int argc, char *argv[])
      |     ^~~~
src/device.c: In function ‘device_set_bonded’:
src/device.c:6141:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
 6141 |  struct bearer_state *state = get_state(device, bdaddr_type);
      |  ^~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:10248: src/bluetoothd-device.o] Error 1
make: *** [Makefile:4310: all] Error 2


##############################
Test: Make Check - FAIL
Desc: Run 'make check'
Output:
src/device.c: In function ‘device_set_bonded’:
src/device.c:6141:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
 6141 |  struct bearer_state *state = get_state(device, bdaddr_type);
      |  ^~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:10248: src/bluetoothd-device.o] Error 1
make: *** [Makefile:11283: check] Error 2


##############################
Test: Make Check w/Valgrind - FAIL
Desc: Run 'make check' with Valgrind
Output:
tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12364:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12364 | int main(int argc, char *argv[])
      |     ^~~~
src/device.c: In function ‘device_set_bonded’:
src/device.c:6141:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
 6141 |  struct bearer_state *state = get_state(device, bdaddr_type);
      |  ^~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:10248: src/bluetoothd-device.o] Error 1
make: *** [Makefile:4310: all] Error 2


##############################
Test: Build w/ext ELL - Make - FAIL
Desc: Build BlueZ source with '--enable-external-ell' configuration
Output:
tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12364:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12364 | int main(int argc, char *argv[])
      |     ^~~~
unit/test-avdtp.c: In function ‘main’:
unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
  766 | int main(int argc, char *argv[])
      |     ^~~~
unit/test-avrcp.c: In function ‘main’:
unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
  989 | int main(int argc, char *argv[])
      |     ^~~~
src/device.c: In function ‘device_set_bonded’:
src/device.c:6141:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
 6141 |  struct bearer_state *state = get_state(device, bdaddr_type);
      |  ^~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:10248: src/bluetoothd-device.o] Error 1
make: *** [Makefile:4310: all] Error 2


##############################
Test: Incremental Build with patches - FAIL
Desc: Incremental build per patch in the series
Output:
tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12364:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12364 | int main(int argc, char *argv[])
      |     ^~~~
unit/test-avdtp.c: In function ‘main’:
unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
  766 | int main(int argc, char *argv[])
      |     ^~~~
unit/test-avrcp.c: In function ‘main’:
unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
  989 | int main(int argc, char *argv[])
      |     ^~~~
src/device.c: In function ‘device_set_bonded’:
src/device.c:6141:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
 6141 |  struct bearer_state *state = get_state(device, bdaddr_type);
      |  ^~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:10248: src/bluetoothd-device.o] Error 1
make: *** [Makefile:4310: all] Error 2




---
Regards,
Linux Bluetooth


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

* Re: [Bluez PATCH v3 0/3] Adding bonded flag to D-Bus property
  2022-05-04 21:09 [Bluez PATCH v3 0/3] Adding bonded flag to D-Bus property Zhengping Jiang
                   ` (3 preceding siblings ...)
  2022-05-04 21:49 ` [Bluez PATCH v3 0/3] Adding bonded flag to D-Bus property Luiz Augusto von Dentz
@ 2022-05-04 22:50 ` patchwork-bot+bluetooth
  4 siblings, 0 replies; 11+ messages in thread
From: patchwork-bot+bluetooth @ 2022-05-04 22:50 UTC (permalink / raw)
  To: Zhengping Jiang
  Cc: linux-bluetooth, luiz.dentz, chromeos-bluetooth-upstreaming

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Wed,  4 May 2022 14:09:45 -0700 you wrote:
> Currently BlueZ client can't know easily whether a device is bonded or
> not. This is causing issues for a number of applications. For example,
> in the Nearby Share case, the peer device is paired, but not bonded.
> This series will add the "Bonded" property in org.bluez.Device1 D-Bus
> interface. Changes are also made in bluetoothctl to show the status of
> the bonded flag as well as a list of bonded devices.
> 
> [...]

Here is the summary with links:
  - [Bluez,v3,1/3] device: Add "Bonded" flag to dbus property
    (no matching commit)
  - [Bluez,v3,2/3] doc: add "Bonded" flag to dbus property
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=5c05df7c7607
  - [Bluez,v3,3/3] client: Add filter to devices and show Bonded in info
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=bda2a9e6f902

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-05-04 22:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-04 21:09 [Bluez PATCH v3 0/3] Adding bonded flag to D-Bus property Zhengping Jiang
2022-05-04 21:09 ` [Bluez PATCH v3 1/3] device: Add "Bonded" flag to dbus property Zhengping Jiang
2022-05-04 22:40   ` Adding bonded flag to D-Bus property bluez.test.bot
2022-05-04 21:09 ` [Bluez PATCH v3 2/3] doc: add "Bonded" flag to dbus property Zhengping Jiang
2022-05-04 21:37   ` Bastien Nocera
     [not found]     ` <CAB4PzUq0FKEE2JbwO6nss3s42M6rbNSt6BGGoGVhuzzR2+1mNw@mail.gmail.com>
     [not found]       ` <CAB4PzUoPyD2KyN4mRbUKGw5BbbyysaZdi7+0hmWrGDJdmk7Www@mail.gmail.com>
2022-05-04 22:08         ` Luiz Augusto von Dentz
2022-05-04 22:19     ` Luiz Augusto von Dentz
2022-05-04 21:09 ` [Bluez PATCH v3 3/3] client: Add filter to devices and show Bonded in info Zhengping Jiang
2022-05-04 21:49 ` [Bluez PATCH v3 0/3] Adding bonded flag to D-Bus property Luiz Augusto von Dentz
     [not found]   ` <CAB4PzUrFr+ZXMNpToM+c4pfNJoAdVyfV2XoCGKtUGg_3MMCtag@mail.gmail.com>
2022-05-04 21:57     ` Luiz Augusto von Dentz
2022-05-04 22:50 ` patchwork-bot+bluetooth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.