Re: [PATCH] ATT: Error (0x01) - Error: Unlikely error (14) Prepare Write req (0x16)

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

 



Hi Trey,

On Tue, Jul 9, 2024 at 1:34 PM Ramsay, Trey <Trey.Ramsay@xxxxxxxx> wrote:
>
> Bluez Maintainers,
> Here is a fix for attribute writes not working in src/shared/gatt-db.c. The prep_write_complete_cb was not getting called. The attrib->write_func code block should not be called when len is 0
>
> commit 5a9baa10d4fde7ca8ab88ecd68e17671c33cb587 (HEAD -> gat-db, master)
> Author: Trey_Ramsay <trey_ramsay@xxxxxxxx>
> Date:   Fri May 31 15:39:27 2024 -0500
>
>     shared/gatt-db: Prepare Write req error BT_ATT_ERROR_UNLIKELY
>
>     Fixes Prepare Write req error: BT_ATT_ERROR_UNLIKELY
>
>         ATT: Error (0x01)
>           Error: Unlikely error (14)
>           Prepare Write req (0x16) on handle 0x0069
>
>     The prep_write_complete_cb was not getting called
>     The attrib->write_func code block does not need to be called when len is 0

This doesn't sound quite right, 0 length still needs to be passed to
the attribute to confirm since we don't know if it could be a
procedure or not. Can you explain what attribute is being written and
if it could be due to the application not responding and the procedure
timing out (e.g. write_timeout is called?), perhaps if you can paste a
btmon trace as well that could help checking what attribute it is
trying to use prepare write.

> diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c
> index 2c8e7d31e..678aef4cf 100644
> --- a/src/shared/gatt-db.c
> +++ b/src/shared/gatt-db.c
> @@ -2127,6 +2127,10 @@ bool gatt_db_attribute_write(struct gatt_db_attribute *attrib, uint16_t offset,
>      if (!attrib || (!func && attrib->write_func))
>          return false;
>
> +    /* Nothing to write just skip */
> +    if (len == 0)
> +        goto done;
> +
>      if (attrib->write_func) {
>          struct pending_write *p;
>
> @@ -2162,10 +2166,6 @@ bool gatt_db_attribute_write(struct gatt_db_attribute *attrib, uint16_t offset,
>          return true;
>      }
>
> -    /* Nothing to write just skip */
> -    if (len == 0)
> -        goto done;
> -
>      /* For values stored in db allocate on demand */
>      if (!attrib->value || offset >= attrib->value_len ||
>                  len > (unsigned) (attrib->value_len - offset)) {
>
>
>
> -----Original Message-----
> From: Ramsay, Trey <Trey.Ramsay@xxxxxxxx>
> Sent: Thursday, June 20, 2024 1:58 PM
> To: linux-bluetooth@xxxxxxxxxxxxxxx
> Subject: [PATCH] ATT: Error (0x01) - Error: Unlikely error (14) Prepare Write req (0x16)
>
>
> Bluez Maintainers
> Here is a fix for attribute writes not working in src/shared/gatt-db.c
>
> https://urldefense.com/v3/__https://github.com/tramsay/bluez-tramsay/commit/246bc960629dff34e744c728f048e9f50f1a005d__;!!LpKI!jkJYamzU8bOdd1qt-sWpj6gy1YwS30UyamHLUJj9Uy0UecrB6QxvCdSWFAUH7Dvq2wVJqu1C5jjoX5amywJH$ [github[.]com]
>
> shared/gatt-db: Prepare Write req error BT_ATT_ERROR_UNLIKELY Fixes Prepare Write req error: BT_ATT_ERROR_UNLIKELY
>
>     ATT: Error (0x01)
>       Error: Unlikely error (14)
>       Prepare Write req (0x16) on handle 0x0069
>
> The prep_write_complete_cb was not getting called The attrib->write_func code block should not be called when len is 0
>


-- 
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