All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrejs Hanins <andrejs.hanins@ubnt.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Lukasz Rymanowski <lukasz.rymanowski@gmail.com>,
	Arman Uguray <armansito@chromium.org>,
	"linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>,
	Marcin Kraglak <marcin.kraglak@tieto.com>,
	Szymon Janc <szymon.janc@tieto.com>
Subject: Re: Non-consecutive handle values in GATT
Date: Wed, 18 Mar 2015 15:54:37 +0200	[thread overview]
Message-ID: <5509839D.3080506@ubnt.com> (raw)
In-Reply-To: <CABBYNZLK-rf8Mw-5GuW-UEi1SwRw6R9c-OOd4VwL3wY9c1q++g@mail.gmail.com>

Hi Luiz,

On 2015.03.18. 15:27, Luiz Augusto von Dentz wrote:
> Hi Andrejs,
> 
> On Tue, Mar 17, 2015 at 5:01 PM, Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
>> Hi Andrejs,
>>
>> On Tue, Mar 17, 2015 at 3:33 PM, Andrejs Hanins <andrejs.hanins@ubnt.com> wrote:
>>> Hi Luiz,
>>>
>>> On 2015.03.17. 15:07, Luiz Augusto von Dentz wrote:
>>>> Hi Andrejs,
>>>>
>>>>
>>>>>>>> ACL data: handle 64 flags 0x02 dlen 20
>>>>>>>     ATT: Read By Type resp (0x09)
>>>>>>>       length: 7
>>>>>>>         handle 0x0110, value 0x02 0x11 0x01 0x00 0x2a
>>>>>>>         handle 0x0120, value 0x02 0x21 0x01 0x01 0x2a
>>>>>>> < ACL data: handle 64 flags 0x00 dlen 11
>>>>>>>     ATT: Read By Type req (0x08)
>>>>>>>       start 0x0121, end 0x0121
>>>>>>>       type-uuid 0x2803      <--- as without patch, this seems to be suspicious. Single att read request with wrong UUID.
>>>>>>
>>>>>> Maybe this is off by 1 error except if start 0x0100, end 0x0121 range
>>>>>> actually exclude the last, but it would be still wrong the start
>>>>>> 0x0121, end 0x0121, anyway this seems to be some other problem.
>>>>
>>>> Actually this is fine, we are discovering the characteristics since
>>>> they may not fit in a single frame we just continue from where we stop
>>>> at 0x0121 until the end of the service range with just happen to be
>>>> 0x0121.
>>>>
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> HCI Event: Number of Completed Packets (0x13) plen 5
>>>>>>>     handle 64 packets 2
>>>>>>>> ACL data: handle 64 flags 0x02 dlen 9
>>>>>>>     ATT: Error (0x01)
>>>>>>>       Error: Attribute not found (10)
>>>>>>>       Read By Type req (0x08) on handle 0x0121
>>>>>>> < ACL data: handle 64 flags 0x00 dlen 9
>>>>>>>     ATT: Find Information req (0x04)
>>>>>>>       start 0x0112, end 0x011f
>>>>>>>> ACL data: handle 64 flags 0x02 dlen 9
>>>>>>>     ATT: Error (0x01)
>>>>>>>       Error: Attribute not found (10)
>>>>>>>       Find Information req (0x04) on handle 0x0112
>>>>>>> < ACL data: handle 64 flags 0x00 dlen 11
>>>>>>>     ATT: Read By Type req (0x08)
>>>>>>>       start 0x0300, end 0x0320
>>>>>>>       type-uuid 0x2803
>>>>>>>> HCI Event: Number of Completed Packets (0x13) plen 5
>>>>>>>     handle 64 packets 1
>>>>>>>> ACL data: handle 64 flags 0x02 dlen 27
>>>>>>>     ATT: Read By Type resp (0x09)
>>>>>>>       length: 21
>>>>>>>         handle 0x0310, value 0x3e 0x11 0x03 0x34 0x5b 0xe2 0x12 0x5e 0xb1 0x45 0x03 0xb6 0x29 0x24 0x55 0x8a 0x11 0x1e 0x36
>>>>>>> < ACL data: handle 64 flags 0x00 dlen 11
>>>>>>>     ATT: Read By Type req (0x08)
>>>>>>>       start 0x0311, end 0x0320
>>>>>>>       type-uuid 0x2803
>>>>>>>> HCI Event: Number of Completed Packets (0x13) plen 5
>>>>>>>     handle 64 packets 2
>>>>>>>> ACL data: handle 64 flags 0x02 dlen 9
>>>>>>>     ATT: Error (0x01)
>>>>>>>       Error: Attribute not found (10)
>>>>>>>       Read By Type req (0x08) on handle 0x0311
>>>>>>
>>>>>> Can you collect the trace in binary format, e.g. btmon -w <file>, I
>>>>>> can perhaps try to create the very same database for unit tests, also
>>>>>> it would be good to have bluetoothd traces.
>>>>> Traces attached.
>>>>
>>>> Can you please enable bt_gatt_client debug with the following patch:
>>>>
>>>> diff --git a/src/device.c b/src/device.c
>>>> index aaa9f43..6a23adc 100644
>>>> --- a/src/device.c
>>>> +++ b/src/device.c
>>>> @@ -3989,6 +3989,11 @@ static void
>>>> gatt_client_service_changed(uint16_t start_handle,
>>>>         DBG("start 0x%04x, end: 0x%04x", start_handle, end_handle);
>>>>  }
>>>>
>>>> +static void gatt_debug(const char *str, void *user_data)
>>>> +{
>>>> +       DBG("%s", str);
>>>> +}
>>>> +
>>>>  static void gatt_client_init(struct btd_device *device)
>>>>  {
>>>>         gatt_client_cleanup(device);
>>>> @@ -4000,6 +4005,8 @@ static void gatt_client_init(struct btd_device *device)
>>>>                 return;
>>>>         }
>>>>
>>>> +       bt_gatt_client_set_debug(device->client, gatt_debug, NULL, NULL);
>>>> +
>>>>         /* Notify attio so it can react to notifications */
>>>>         g_slist_foreach(device->attios, attio_connected, device->attrib);
>>>>
>>>>
>>> See attachments. Fresh dumps from both btmon and daemon. With your patch "shared/gatt-client: Fix handling of services" applied.
>>
>> Still not sure what is going own, it seems the 10 is
>> BT_ATT_ERROR_ATTRIBUTE_NOT_FOUND but I suspect there is something else
>> wrong since in this case we should just proceed to the next operation.
>> Anyway I will send some cleanup patches and Im also planning to have
>> proper errors so in future we can tell what is going on.
> 
> Can you confirm that you have the following attributes:
> 
> bluetoothd[12005]: src/device.c:gatt_debug() Primary services found: 3
> bluetoothd[12005]: src/device.c:gatt_debug() start: 0x0100, end:
> 0x0121, uuid: 00001800-0000-1000-8000-00805f9b34fb
> bluetoothd[12005]: src/device.c:gatt_debug() start: 0x0200, end:
> 0x0200, uuid: 00001801-0000-1000-8000-00805f9b34fb
> bluetoothd[12005]: src/device.c:gatt_debug() start: 0x0300, end:
> 0x0320, uuid: 8832ab08-ba2d-0184-004c-68c08e2190bf
> bluetoothd[12005]: src/device.c:gatt_debug() Characteristics found: 2
> bluetoothd[12005]: src/device.c:gatt_debug() start: 0x0110, end:
> 0x011f, value: 0x0111, props: 0x02, uuid: 00002a00-0000-1
> bluetoothd[12005]: src/device.c:gatt_debug() start: 0x0120, end:
> 0x0121, value: 0x0121, props: 0x02, uuid: 00002a01-0000-1
> bluetoothd[12005]: src/device.c:gatt_debug() Characteristics found: 1
> bluetoothd[12005]: src/device.c:gatt_debug() start: 0x0310, end:
> 0x0320, value: 0x0311, props: 0x3e, uuid: 361e118a-5524-2

Full UUID should be { 0x361e118a, 0x5524, 0x29b6, { 0x03, 0x45, 0xb1, 0x5e, 0x12, 0xe2, 0x5b, 0x34 } }. I guess, it is just truncated output.
There should be also a CCC (UUID 0x2902) with handle 0x0320 for this characteristic.
Otherwise is OK.

> 
> Anything missing?
> 

      reply	other threads:[~2015-03-18 13:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-04 18:45 Non-consecutive handle values in GATT Andrejs Hanins
2015-03-04 21:39 ` Arman Uguray
2015-03-04 22:21   ` Lukasz Rymanowski
2015-03-04 22:34     ` Andrejs Hanins
2015-03-05  8:39       ` Luiz Augusto von Dentz
2015-03-16 11:05         ` Luiz Augusto von Dentz
2015-03-16 13:20           ` Andrejs Hanins
2015-03-16 13:54             ` Andrejs Hanins
2015-03-16 14:13               ` Luiz Augusto von Dentz
2015-03-16 14:22                 ` Andrejs Hanins
2015-03-17 13:07                   ` Luiz Augusto von Dentz
2015-03-17 13:33                     ` Andrejs Hanins
2015-03-17 15:01                       ` Luiz Augusto von Dentz
2015-03-18 13:27                         ` Luiz Augusto von Dentz
2015-03-18 13:54                           ` Andrejs Hanins [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5509839D.3080506@ubnt.com \
    --to=andrejs.hanins@ubnt.com \
    --cc=armansito@chromium.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=lukasz.rymanowski@gmail.com \
    --cc=marcin.kraglak@tieto.com \
    --cc=szymon.janc@tieto.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.