* [PATCH BlueZ] src/gatt-client: allow "command" even when property not set
@ 2020-04-28 17:51 David Lechner
2020-04-29 0:37 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 2+ messages in thread
From: David Lechner @ 2020-04-28 17:51 UTC (permalink / raw)
To: linux-bluetooth; +Cc: David Lechner
This modifies the GATT client characteristic WriteValue D-Bus method to
not check that the characteristic supports the requested type of
write when the "type" option is set to "command".
Before this change, if the "type" option was used and it was set to
"reliable" or "request", then BlueZ would attempt the write even if the
characteristic does not support that write type. On the other hand, if
"type" was set to "command" or was not specified, the method would
return a org.bluez.Error.NotSupported error without attempting to write.
After this change, the WriteValue method will consistently always
ignore the characteristic properties and attempt to write when the
"type" option is used instead of having a different behavior for the
"command" type.
---
Related discussion:
https://lore.kernel.org/linux-bluetooth/685ddf1b-c824-9c45-298f-97b70cbf975f@lechnology.com
src/gatt-client.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/gatt-client.c b/src/gatt-client.c
index a9bfc2802..20c3fbec2 100644
--- a/src/gatt-client.c
+++ b/src/gatt-client.c
@@ -1050,8 +1050,8 @@ static DBusMessage *characteristic_write_value(DBusConnection *conn,
return NULL;
}
- if ((type && strcasecmp(type, "command")) || offset ||
- !(chrc->props & BT_GATT_CHRC_PROP_WRITE_WITHOUT_RESP))
+ if ((type && strcasecmp(type, "command")) || offset || (!type &&
+ !(chrc->props & BT_GATT_CHRC_PROP_WRITE_WITHOUT_RESP)))
goto fail;
supported = true;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH BlueZ] src/gatt-client: allow "command" even when property not set
2020-04-28 17:51 [PATCH BlueZ] src/gatt-client: allow "command" even when property not set David Lechner
@ 2020-04-29 0:37 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2020-04-29 0:37 UTC (permalink / raw)
To: David Lechner; +Cc: linux-bluetooth
Hi David,
On Tue, Apr 28, 2020 at 10:59 AM David Lechner <david@lechnology.com> wrote:
>
> This modifies the GATT client characteristic WriteValue D-Bus method to
> not check that the characteristic supports the requested type of
> write when the "type" option is set to "command".
>
> Before this change, if the "type" option was used and it was set to
> "reliable" or "request", then BlueZ would attempt the write even if the
> characteristic does not support that write type. On the other hand, if
> "type" was set to "command" or was not specified, the method would
> return a org.bluez.Error.NotSupported error without attempting to write.
>
> After this change, the WriteValue method will consistently always
> ignore the characteristic properties and attempt to write when the
> "type" option is used instead of having a different behavior for the
> "command" type.
> ---
>
> Related discussion:
> https://lore.kernel.org/linux-bluetooth/685ddf1b-c824-9c45-298f-97b70cbf975f@lechnology.com
>
>
> src/gatt-client.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/gatt-client.c b/src/gatt-client.c
> index a9bfc2802..20c3fbec2 100644
> --- a/src/gatt-client.c
> +++ b/src/gatt-client.c
> @@ -1050,8 +1050,8 @@ static DBusMessage *characteristic_write_value(DBusConnection *conn,
> return NULL;
> }
>
> - if ((type && strcasecmp(type, "command")) || offset ||
> - !(chrc->props & BT_GATT_CHRC_PROP_WRITE_WITHOUT_RESP))
> + if ((type && strcasecmp(type, "command")) || offset || (!type &&
> + !(chrc->props & BT_GATT_CHRC_PROP_WRITE_WITHOUT_RESP)))
> goto fail;
>
> supported = true;
> --
> 2.17.1
Applied, thanks.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-29 0:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28 17:51 [PATCH BlueZ] src/gatt-client: allow "command" even when property not set David Lechner
2020-04-29 0:37 ` 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;
as well as URLs for NNTP newsgroup(s).