Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Apr 2015 21:50:33 +0100 (BST)
From:      Iain Hibbert <plunky@ogmig.net>
To:        freebsd-bluetooth@freebsd.org
Subject:   Re: register HID with SDP error
Message-ID:  <alpine.NEB.2.11.1504012125030.2454@galant.ogmig.net>
In-Reply-To: <CAFuo_fwiRiNP_RXwsfO1wN1nap1soXKboLE7dtHmJuSJ78wMzA@mail.gmail.com>
References:  <CAFuo_fy9xRU2T3GUPY8116yZCUd8sL9pBQ9ixXnMwO56niJFog@mail.gmail.com> <CAFPOs6rJJW2BC3rru%2Bvb5dAE0yaHGvr=0s8K9FZ1ee0rf-ML-w@mail.gmail.com> <CAFuo_fzRGc0_yrHYyqcfLrWX7q3AuLwA3v%2B9_QRTirU-Bx4xkw@mail.gmail.com> <CAFuo_fyYyoX6rNwN6_TfB01_xp5EQHFu-CJG=_dab_Qe7x1hkA@mail.gmail.com> <alpine.NEB.2.11.1503301517330.9258@galant.ogmig.net> <CAFuo_fxuTJqdvMg7jQ4rZy8qHLpNe2nRo%2B0JftGGBG2cjQ_QZg@mail.gmail.com> <alpine.NEB.2.11.1503301614370.9398@galant.ogmig.net> <CAFuo_fyvvJkfvpGfx-0dhhAsY6i_wMwZz4wEi47kEoLfaEV4EA@mail.gmail.com> <CAFPOs6pwHSP3tDmTV4VGUr3jiP_P96W0FxAJbR6Md6Xc-yQAyg@mail.gmail.com> <CAFuo_fygrjB12LZA4Z_qU2Tfa1UpqkN-8qsqL3NG-5VUsxeW7Q@mail.gmail.com> <CAFPOs6q0Xi=R-YyTSg_0cqFuxaQYxMVnL-tAbpftHj4wXzYbkg@mail.gmail.com> <CAFuo_fx9ZzoOkZNrnyu2XmSEg4vBXZLDwsQrdxmFGp84oLmW8w@mail.gmail.com> <67671012-52EF-49FA-8820-954E99601210@ogmig.net> <CAFuo_fwiRiNP_RXwsfO1wN1nap1soXKboLE7dtHmJuSJ78wMzA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 1 Apr 2015, Waitman Gobble wrote:

> Ok, here's a dump with the 'syntax error'
>
> https://artiming.com/andbin.xz

Y'all were right, the syntax error is something related to continuation
and MTU.. but the error is probably just in the ancient version of hcidump
that FreeBSD uses.

So, with a patched for NetBSD version of a more recent hcidump from BlueZ
5.27 (Dec 2014) I see the connection as normal, then

> ACL data: handle 67 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 1 scid 0x0048
< ACL data: handle 67 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0214 scid 0x0048 result 0 status 0
      Connection successful
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 67 packets 1

> ACL data: handle 67 flags 0x02 dlen 16
    L2CAP(s): Config req: dcid 0x0214 flags 0x00 clen 4
      MTU 256
< ACL data: handle 67 flags 0x02 dlen 14
    L2CAP(s): Config rsp: scid 0x0048 flags 0x00 result 0 clen 0
      Success

they ask for MTU of 256, and we agree..

< ACL data: handle 67 flags 0x02 dlen 12
    L2CAP(s): Config req: dcid 0x0048 flags 0x00 clen 0
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 67 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 67 packets 1
> ACL data: handle 67 flags 0x02 dlen 14
    L2CAP(s): Config rsp: scid 0x0214 flags 0x00 result 0 clen 0
      Success

> ACL data: handle 67 flags 0x02 dlen 24
    L2CAP(d): cid 0x0214 len 20 [psm 1]
        SDP SSA Req: tid 0x0 len 0xf
          pat uuid-16 0x1200 (PNPInfo)
          max 240
          aid(s) 0x0000 - 0xffff
          cont 00

they ask for PNPInfo UUID, all AIDs

< ACL data: handle 67 flags 0x02 dlen 99
    L2CAP(d): cid 0x0048 len 95 [psm 1]
        SDP SSA Rsp: tid 0x0 len 0x5a
          count 87
          record #0
              aid 0x0000 (SrvRecHndl)
                 uint 0x3
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x1200 (PNPInfo) >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0x1 > <
                 uuid-16 0x0001 (SDP) > >
              aid 0x0009 (BTProfileDescList)
                 < < uuid-16 0x1200 (PNPInfo) uint 0x100 > >
              aid 0x0200 (VersionNumList)
                 uint 0x102
              aid 0x0201 (SrvDBState)
                 uint 0x5ac
              aid 0x0202 (unknown)
                 uint 0x239
              aid 0x0203 (unknown)
                 uint 0x50
              aid 0x0204 (unknown)
                 bool 0x1
              aid 0x0205 (unknown)
                 uint 0x1
          cont 00

and we provide that ok

> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 67 packets 1
> ACL data: handle 67 flags 0x02 dlen 12
    L2CAP(s): Disconn req: dcid 0x0214 scid 0x0048
< ACL data: handle 67 flags 0x02 dlen 12
    L2CAP(s): Disconn rsp: dcid 0x0214 scid 0x0048
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 67 packets 1

disconnect, and reconnect again

> ACL data: handle 67 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 1 scid 0x0042
< ACL data: handle 67 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0215 scid 0x0042 result 0 status 0
      Connection successful
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 67 packets 1
> ACL data: handle 67 flags 0x02 dlen 16
    L2CAP(s): Config req: dcid 0x0215 flags 0x00 clen 4
      MTU 256

and MTU 256 again

< ACL data: handle 67 flags 0x02 dlen 14
    L2CAP(s): Config rsp: scid 0x0042 flags 0x00 result 0 clen 0
      Success
< ACL data: handle 67 flags 0x02 dlen 12
    L2CAP(s): Config req: dcid 0x0042 flags 0x00 clen 0
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 67 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 67 packets 1
> ACL data: handle 67 flags 0x02 dlen 14
    L2CAP(s): Config rsp: scid 0x0215 flags 0x00 result 0 clen 0
      Success

all ok

> ACL data: handle 67 flags 0x02 dlen 24
    L2CAP(d): cid 0x0215 len 20 [psm 1]
        SDP SSA Req: tid 0x0 len 0xf
          pat uuid-16 0x0100 (L2CAP)
          max 240
          aid(s) 0x0000 - 0xffff
          cont 00

now, they ask for L2CAP UUID, all AIDs and max 240 bytes

< ACL data: handle 67 flags 0x02 dlen 251
    L2CAP(d): cid 0x0042 len 247 [psm 1]
        SDP SSA Rsp: tid 0x0 len 0xf2
          count 237
          cont 02 00 ED

the first packet is sent, with 237 bytes and continuation.

(hcidump doesn't show it yet, it waits until the rest of it arrives)

> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 67 packets 1
> ACL data: handle 67 flags 0x02 dlen 26
    L2CAP(d): cid 0x0215 len 22 [psm 1]
        SDP SSA Req: tid 0x1 len 0x11
          pat uuid-16 0x0100 (L2CAP)
          max 240
          aid(s) 0x0000 - 0xffff
          cont 02 00 ED

they ask for the second packet, with same continuation

< ACL data: handle 67 flags 0x02 dlen 113
    L2CAP(d): cid 0x0042 len 109 [psm 1]
        SDP SSA Rsp: tid 0x1 len 0x68
          count 101
          record #0
              aid 0x0000 (SrvRecHndl)
                 uint 0x2
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x1124 (HID) >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0x11 > <
                 uuid-16 0x0011 (HIDP) > >
              aid 0x0006 (LangBaseAttrIDList)
                 < uint 0x656e uint 0x6a uint 0x100 >
              aid 0x0009 (BTProfileDescList)
                 < < uuid-16 0x1124 (HID) uint 0x100 > >
              aid 0x000d (AdditionalProtocolDescLists)
                 < < < uuid-16 0x0100 (L2CAP) uint 0x13 > < uuid-16 0x0011 (HIDP) > > >
              aid 0x0100 (SrvName)
                 str "keyboard"
              aid 0x0201 (SrvDBState)
                 uint 0x111
              aid 0x0202 (unknown)
                 uint 0x1
              aid 0x0203 (unknown)
                 uint 0x0
              aid 0x0204 (unknown)
                 bool 0x1
              aid 0x0205 (unknown)
                 bool 0x1
              aid 0x0206 (unknown)
                 < < uint 0x22 str 05 01 09 06 a1 01 85 01 05 07 19 e0 29 e7 15 00 25 01 75 01 95 08 81 02 75 08 95 01 81 01 75 01 95 05 05 08 19 01 29 05 91 02 75 03 95 01 91 01 75 08 95 06 15 00 26 ff 00 05 07 19 00 2a ff 00 81 00 75 01 95 01 15 00 25 01 05 0c 09 b8 81 06 09 e2 81 06 09 e9 81 02 09 ea 81 02 75 01 95 04 81 01 c0 > >
              aid 0x0207 (unknown)
                 < < uint 0x409 uint 0x100 > >
              aid 0x020e (unknown)
                 bool 0x0
          record #1
              aid 0x0000 (SrvRecHndl)
                 uint 0x3
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x1200 (PNPInfo) >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0x1 > <
                 uuid-16 0x0001 (SDP) > >
              aid 0x0009 (BTProfileDescList)
                 < < uuid-16 0x1200 (PNPInfo) uint 0x100 > >
              aid 0x0200 (VersionNumList)
                 uint 0x102
              aid 0x0201 (SrvDBState)
                 uint 0x5ac
              aid 0x0202 (unknown)
                 uint 0x239
              aid 0x0203 (unknown)
                 uint 0x50
              aid 0x0204 (unknown)
                 bool 0x1
              aid 0x0205 (unknown)
                 uint 0x1
          cont 00
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 67 packets 1

and the second packet arrives with 101 bytes. hcidump manages to put it
all together and shows it all here, but extracting with hcidump -R will
show the individual packet data[**]

> ACL data: handle 67 flags 0x02 dlen 12
    L2CAP(s): Disconn req: dcid 0x0215 scid 0x0042
< ACL data: handle 67 flags 0x02 dlen 12
    L2CAP(s): Disconn rsp: dcid 0x0215 scid 0x0042

disconnected from SDP service

> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 67 packets 1
> ACL data: handle 67 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 17 scid 0x0049
< ACL data: handle 67 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0216 scid 0x0049 result 0 status 0
      Connection successful

this time connecting to control channel

> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 67 packets 1
> ACL data: handle 67 flags 0x02 dlen 16
    L2CAP(s): Config req: dcid 0x0216 flags 0x00 clen 4
      MTU 640
< ACL data: handle 67 flags 0x02 dlen 14
    L2CAP(s): Config rsp: scid 0x0049 flags 0x00 result 0 clen 0
      Success
< ACL data: handle 67 flags 0x02 dlen 12
    L2CAP(s): Config req: dcid 0x0049 flags 0x00 clen 0
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 67 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 67 packets 1
> ACL data: handle 67 flags 0x02 dlen 14
    L2CAP(s): Config rsp: scid 0x0216 flags 0x00 result 0 clen 0
      Success

is ok

> HCI Event: Encrypt Change (0x08) plen 4
    status 0x00 handle 67 encrypt 0x01

and encryption is enabled by remote side

> ACL data: handle 67 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 19 scid 0x004c
< ACL data: handle 67 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0217 scid 0x004c result 0 status 0
      Connection successful

now connecting to interrupt channel

> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 67 packets 1
> ACL data: handle 67 flags 0x02 dlen 16
    L2CAP(s): Config req: dcid 0x0217 flags 0x00 clen 4
      MTU 640
< ACL data: handle 67 flags 0x02 dlen 14
    L2CAP(s): Config rsp: scid 0x004c flags 0x00 result 0 clen 0
      Success
< ACL data: handle 67 flags 0x02 dlen 12
    L2CAP(s): Config req: dcid 0x004c flags 0x00 clen 0
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 67 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 67 packets 1
> ACL data: handle 67 flags 0x02 dlen 14
    L2CAP(s): Config rsp: scid 0x0217 flags 0x00 result 0 clen 0
      Success

all ok

> ACL data: handle 67 flags 0x02 dlen 6
    L2CAP(d): cid 0x0216 len 2 [psm 17]
      HIDP: Set idle:
      0000: 00                                                .

and then the remote device sends a HID command, I can't remember what that
does (turn idle off?)

.. so it seems you can start sending reports now

regards,
iain

[**] the actual data from the ServiceSearchAttribute request was

> 02 43 20 18 00 14 00 15 02 06 00 00 00 0F 35 03 19 01 00 00
  F0 35 05 0A 00 00 FF FF 00
< 02 43 20 FB 00 F7 00 42 00 07 00 00 00 F2 00 ED 36 01 4F 36
  00 F8 09 00 00 0A 00 00 00 02 09 00 01 35 03 19 11 24 09 00
  04 35 0D 35 06 19 01 00 09 00 11 35 03 19 00 11 09 00 06 35
  09 09 65 6E 09 00 6A 09 01 00 09 00 09 35 08 35 06 19 11 24
  09 01 00 09 00 0D 35 0F 35 0B 35 06 19 01 00 09 00 13 35 03
  19 00 11 09 01 00 25 08 6B 65 79 62 6F 61 72 64 09 02 01 09
  01 11 09 02 02 08 01 09 02 03 08 00 09 02 04 28 01 09 02 05
  28 01 09 02 06 35 69 35 67 08 22 25 63 05 01 09 06 A1 01 85
  01 05 07 19 E0 29 E7 15 00 25 01 75 01 95 08 81 02 75 08 95
  01 81 01 75 01 95 05 05 08 19 01 29 05 91 02 75 03 95 01 91
  01 75 08 95 06 15 00 26 FF 00 05 07 19 00 2A FF 00 81 00 75
  01 95 01 15 00 25 01 05 0C 09 B8 81 06 09 E2 81 06 09 E9 81
  02 09 EA 81 02 75 01 95 04 81 01 C0 09 02 00 ED

> 02 43 20 1A 00 16 00 15 02 06 00 01 00 11 35 03 19 01 00 00
  F0 35 05 0A 00 00 FF FF 02 00 ED
< 02 43 20 71 00 6D 00 42 00 07 00 01 00 68 00 65 02 07 35 08
  35 06 09 04 09 09 01 00 09 02 0E 28 00 36 00 51 09 00 00 0A
  00 00 00 03 09 00 01 35 03 19 12 00 09 00 04 35 0D 35 06 19
  01 00 09 00 01 35 03 19 00 01 09 00 09 35 08 35 06 19 12 00
  09 01 00 09 02 00 09 01 02 09 02 01 09 05 AC 09 02 02 09 02
  39 09 02 03 09 00 50 09 02 04 28 01 09 02 05 08 01 00

but bear in mind that this includes HCI and L2CAP headers..



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.NEB.2.11.1504012125030.2454>