Re: [PATCH] Fixed bug in prep_write_cb(): missing arguments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Roland,

On Wed, Jan 22, 2020 at 7:31 AM Roland Ruckerbauer
<roland.ruckerbauer@xxxxxxxxx> wrote:
>
> prep_write_cb() calls gatt_db_attribure_write(), but does not pass data
> and data length.
>
> Fixed by passing pdu as data, and skipping the first 4 bytes.
> ---
>  src/shared/gatt-server.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/shared/gatt-server.c b/src/shared/gatt-server.c
> index 0d9bb07..a235552 100644
> --- a/src/shared/gatt-server.c
> +++ b/src/shared/gatt-server.c
> @@ -1312,7 +1312,7 @@ static void prep_write_cb(uint8_t opcode, const void *pdu,
>         pwcd->length = length;
>         pwcd->server = server;
>
> -       status = gatt_db_attribute_write(attr, offset, NULL, 0,
> +       status = gatt_db_attribute_write(attr, offset, pdu + 4, length - 4,
>                                                 BT_ATT_OP_PREP_WRITE_REQ,
>                                                 server->att,
>                                                 prep_write_complete_cb, pwcd);
> --
> 2.19.1

I recall having similar discussion not long ago, not sure it was you
though, but if I recall this correct prepare is not actually suppose
to write anything until we receive execute so this write is mostly to
let the application authorize or not the prepare (which is kind dumb
if you ask me but there are qualification tests requiring a specific
error like that.)


-- 
Luiz Augusto von Dentz



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux