2014-05-30 13:19:41

by Jakub Tyszkowski

[permalink] [raw]
Subject: [PATCH 1/2] android/gatt: Support find request in permission check

Permissions check was failing on those requests.
---
android/gatt.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/android/gatt.c b/android/gatt.c
index fcc91ff..a61d702 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -4007,6 +4007,8 @@ static uint8_t check_device_permissions(struct gatt_device *device,
case ATT_OP_READ_BLOB_REQ:
case ATT_OP_READ_MULTI_REQ:
case ATT_OP_READ_BY_GROUP_REQ:
+ case ATT_OP_FIND_BY_TYPE_REQ:
+ case ATT_OP_FIND_INFO_REQ:
if (!(permissions & GATT_PERM_READ))
return ATT_ECODE_READ_NOT_PERM;

--
1.9.3



2014-05-30 14:47:33

by Szymon Janc

[permalink] [raw]
Subject: Re: [PATCH 1/2] android/gatt: Support find request in permission check

Hi Jakub,

On Friday 30 of May 2014 15:19:41 Jakub Tyszkowski wrote:
> Permissions check was failing on those requests.
> ---
> android/gatt.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/android/gatt.c b/android/gatt.c
> index fcc91ff..a61d702 100644
> --- a/android/gatt.c
> +++ b/android/gatt.c
> @@ -4007,6 +4007,8 @@ static uint8_t check_device_permissions(struct
> gatt_device *device, case ATT_OP_READ_BLOB_REQ:
> case ATT_OP_READ_MULTI_REQ:
> case ATT_OP_READ_BY_GROUP_REQ:
> + case ATT_OP_FIND_BY_TYPE_REQ:
> + case ATT_OP_FIND_INFO_REQ:
> if (!(permissions & GATT_PERM_READ))
> return ATT_ECODE_READ_NOT_PERM;

Both patches applied, thanks.

--
BR
Szymon Janc

2014-05-30 13:19:42

by Jakub Tyszkowski

[permalink] [raw]
Subject: [PATCH 2/2] android/gatt: Fix not setting request as done on direct db read

Previously if read was succesfull - request was not marked as completed
because no callback was called for direct db read.
---
android/gatt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/android/gatt.c b/android/gatt.c
index a61d702..46dc7f6 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -4086,10 +4086,11 @@ static void read_requested_attributes(void *data, void *user_data)

/* We have value here already if no callback will be called */
if (value_len >= 0) {
+ resp_data->state = REQUEST_DONE;
+
resp_data->value = malloc0(value_len);
if (!resp_data->value) {
/* If data cannot be copied, act like when read fails */
- resp_data->state = REQUEST_DONE;
resp_data->error = ATT_ECODE_INSUFF_RESOURCES;
return;
}
--
1.9.3