Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Mar 2015 23:45:59 -0700
From:      Waitman Gobble <gobble.wa@gmail.com>
To:        Maksim Yevmenkin <maksim.yevmenkin@gmail.com>
Cc:        "freebsd-bluetooth@freebsd.org" <freebsd-bluetooth@freebsd.org>, Iain Hibbert <plunky@ogmig.net>
Subject:   Re: register HID with SDP error
Message-ID:  <CAFuo_fwBcBQOZzFNntBSP0AwyAkGq=s-eeKJ1CCgjPp5tWdG=A@mail.gmail.com>
In-Reply-To: <CAFuo_fy%2BdmpcswwLMV3LaGGkN6VyQ%2B=ieEzYUT=omSLkhS8=EA@mail.gmail.com>
References:  <CAFuo_fy9xRU2T3GUPY8116yZCUd8sL9pBQ9ixXnMwO56niJFog@mail.gmail.com> <CAFuo_fzdmB79qdoH8P5EcO_ZZoa=_id6h=eqFBXvP_a%2B3WMkLw@mail.gmail.com> <CAFuo_fzB3A5L3vivH7Z80OEoBtVEHftEYE4LUkhnrkguzL5GDA@mail.gmail.com> <CAFuo_fzrk%2BWLXivZrnTsGQD%2BS7mq%2BUSXB7Mn6%2BJT=y64JakGSw@mail.gmail.com> <CAFPOs6q3iVcNthF=S--UgTm=5wA0HM6coqB7AcmCKb=55OWdTQ@mail.gmail.com> <CAFuo_fxgBVKxmzbJs%2B-XDz%2Bu4tb2_i3eYXSa-oiOoU%2BQD6ApwQ@mail.gmail.com> <CAFPOs6r_D7bcGCMP_bP%2BQtZgKt7Oj5jRJ2v872RODekn%2B6xv1Q@mail.gmail.com> <CAFuo_fwPuaD4bYwfZou0RBswZsTmdtVZA1B2GqUdo3ZJJiWRQg@mail.gmail.com> <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> <CAFuo_fye5RWNtjsutHa%2BbXL0AYHYRpJxW-b=48o0iMwX227wdA@mail.gmail.com> <alpine.NEB.2.11.1503170658130.4414@galant.ogmig.net> <CAFuo_fx47uRC-eKD_KtsSsrMCQZauyHyCOgRxGbtp_WEZ49o_Q@mail.gmail.com> <alpine.NEB.2.11.1503171759510.4792@galant.ogmig.net> <CAFPOs6omaOOOumNk2Zg=YBgK9cy7JumOZ6k-89oTbVw-3PgAvg@mail.gmail.com> <CAFuo_fy%2BdmpcswwLMV3LaGGkN6VyQ%2B=ieEzYUT=omSLkhS8=EA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Mar 22, 2015 at 10:39 PM, Waitman Gobble <gobble.wa@gmail.com> wrote:
> On Tue, Mar 17, 2015 at 11:33 AM, Maksim Yevmenkin
> <maksim.yevmenkin@gmail.com> wrote:
>> On Tue, Mar 17, 2015 at 11:20 AM, Iain Hibbert <plunky@ogmig.net> wrote:
>>> On Tue, 17 Mar 2015, Waitman Gobble wrote:
>>>
>>>> hcidump log https://gist.github.com/waitman/c3f8a3bc9b046e36dbb5
>>>
>>> Kind of unrelatedly, from that log, the Linux machine requests a search
>>> for Protocol UUID 0x0100 (L2CAP) but gets nothing in return..
>>>
>>>> ACL data: handle 0x0048 flags 0x02 dlen 24
>>>     L2CAP(d): cid 0x44 len 20 [psm 1]
>>>       SDP SSA Req: tid 0x0 len 0xf
>>>         pat uuid-16 0x0100 (L2CAP)
>>>         max 0xffff
>>>         aid(s) 0x0000 - 0xffff
>>>         cont 00
>>> < ACL data: handle 0x0048 flags 0x02 dlen 15
>>>     L2CAP(d): cid 0x40 len 11 [psm 1]
>>>       SDP SSA Rsp: tid 0x0 len 0x6
>>>         cnt 0x3
>>>         cont 00
>>>
>>> ..does the SDP server not return results for that, Max?
>>
>> well, i don't think i ever got around to adding a feature that looks
>> for uuid inside records. it currently only matches service class
>> uuid's. so, yes, query for l2cap uuid will return nothing currently.
>> its trivial to add this though. i think i even have a patch somewhere.
>>
>> [...]
>>
>>> btw .. if you use sdpcontrol(1) to query the local SDP server (see -l)
>>> then hcidump will not see anything of the interchange, since it does not
>>> go through the Bluetooth stack.
>>
>> absolutely correct
>>
>> thanks,
>> max
>
>
> I'm tracking down a client connection problem, maybe this is causing
> the issue... checking it out.
>
> https://gist.github.com/waitman/c51ea08ebb6a2898f33f
>
> client gives up and never opens PSM channel 17 or 19
>
> I did notice some clients request 0x1200 'pnp info' so I added
> SDP_SERVICE_CLASS_PNP_DEVICE handler to sdpd to see what would happen.
> The code is here -> https://github.com/waitman/sdpd/blob/master/pnp.c
> But the configuration parameters should be set by the request, not
> hardcoded into pnp.c (also hid.c should be fixed)
>
>
>
>
> --
> Waitman Gobble
> Los Altos California USA
> 510-830-7975


Through trial and error I found that this code is preventing the
response to the  0x0100 (L2CAP) query.

in sdpd/ssar.c around line 230 or so.

if (memcmp(&uuid, &puuid, sizeof(uuid)) != 0 &&
   memcmp(&uuid, &uuid_public_browse_group, sizeof(uuid)) != 0)
continue;


When I comment that code out then it responds to the request with the
list of registered and advertised services and my clients then
magically connect.

A Linux client connecting to the HID service on my FreeBSD machine
doesn't seem to care about the empty response, it opens L2CAP 17&19
and works right away. However Android and some other clients fail
after the query returns no results.

The good news for me is that my clients are connecting to the HID
service, the bad news is I don't yet know what I broke to get it
working :)


Can you please explain the purpose of that code so I can fully
understand what I'm commenting out of the provider lookup loop in
sdpd/ssar.c ?


in the example below, with the code in place, if it makes it past that
statement then "cs #" appears in the log, and rsp > 0. If it doesn't
make it past the conditional then it does not send "cs #" to the log
and rsp size is 0.
Note that it looks like there are always two requests, first one has
rsp size, second one is zild. However despite the two requests the
server never actually sends the list back to the requesting client.

Mar 22 23:31:04 afia hcsecd[29896]: Could not find entry for remote
bdaddr bc:44:86:13:0f:ff
Mar 22 23:31:04 afia sdpd[37406]: SDP_PDU_SERVICE_SEARCH_ATTRIBUTE_REQUEST
Mar 22 23:31:04 afia sdpd[37406]: SDP_DATA_SEQ8
Mar 22 23:31:04 afia sdpd[37406]: SDP_DATA_UUID16 type
Mar 22 23:31:04 afia sdpd[37406]: 4096
Mar 22 23:31:04 afia sdpd[37406]: p 4096
Mar 22 23:31:04 afia sdpd[37406]: 4097
Mar 22 23:31:04 afia sdpd[37406]: p 4097
Mar 22 23:31:04 afia sdpd[37406]: 4388
Mar 22 23:31:04 afia sdpd[37406]: p 4388
Mar 22 23:31:04 afia sdpd[37406]: 4608
Mar 22 23:31:04 afia sdpd[37406]: p 4608
Mar 22 23:31:04 afia sdpd[37406]: cs 84
Mar 22 23:31:04 afia sdpd[37406]: rsp size 84
Mar 22 23:31:04 afia sdpd[37406]: SDP_PDU_SERVICE_SEARCH_ATTRIBUTE_REQUEST
Mar 22 23:31:04 afia sdpd[37406]: SDP_PDU_SERVICE_SEARCH_ATTRIBUTE_REQUEST
Mar 22 23:31:04 afia sdpd[37406]: SDP_DATA_SEQ8
Mar 22 23:31:04 afia sdpd[37406]: SDP_DATA_UUID16 type
Mar 22 23:31:04 afia sdpd[37406]: 4096
Mar 22 23:31:04 afia sdpd[37406]: p 4096
Mar 22 23:31:04 afia sdpd[37406]: 4097
Mar 22 23:31:04 afia sdpd[37406]: p 4097
Mar 22 23:31:04 afia sdpd[37406]: 4388
 (0x1124 HID)
Mar 22 23:31:04 afia sdpd[37406]: p 4388
Mar 22 23:31:04 afia sdpd[37406]: 4608
Mar 22 23:31:04 afia sdpd[37406]: p 4608
(0x1200 PNP)
Mar 22 23:31:04 afia sdpd[37406]: rsp size 0
Mar 22 23:31:04 afia sdpd[37406]: SDP_PDU_SERVICE_SEARCH_ATTRIBUTE_REQUEST


Thank you,

-- 
Waitman Gobble
Los Altos, California USA
510-830-7975



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFuo_fwBcBQOZzFNntBSP0AwyAkGq=s-eeKJ1CCgjPp5tWdG=A>