Bluetooth Proximity Monitor on FreeBSD ?

Vladimir Grebenschikov vova at sw.ru
Wed May 16 19:37:03 UTC 2007


В ср, 16/05/2007 в 12:26 -0700, Maksim Yevmenkin пишет:
> On 5/16/07, Vladimir Grebenschikov <vova at sw.ru> wrote:
> > В ср, 16/05/2007 в 09:45 -0700, Maksim Yevmenkin пишет:
> >
> > > > Connection expires somehow in ~5 secs after creation.
> > > > Probably there is some way to do keep-alive connection ?
> > > >
> > > > My device is Nokia E60.
> > >
> > > run hcidump and see who initiated disconnect. my guess, its your nokia
> > > phone kills baseband after some period of inactivity. if that is the
> > > case then you have to use l2ping or something else. the idea is to
> > > keep sending stuff over baseband connection to keep it alive.
> >
> > Hm, l2ping does not helps (output just after connecting):
> > # l2ping -a e60
> > 0 bytes from e60 seq_no=0 time=65.077 ms result=0
> > 0 bytes from e60 seq_no=1 time=52.096 ms result=0
> > 0 bytes from e60 seq_no=2 time=54.053 ms result=0
> > 0 bytes from e60 seq_no=3 time=42.082 ms result=0
> > 0 bytes from e60 seq_no=4 time=42.151 ms result=0
> > 0 bytes from e60 seq_no=5 time=5129.224 ms result=0x4  <<< connection
> > lost here
> > ...
> 
> well, that is just weird. while zero bytes response is normal (for
> nokia's), killing baseband connection while l2ping (in other words
> l2cap control channel) is active, is just does not make any sense. can
> you provide hcidump with l2ping active? i'd like to see who is killing
> baseband.

# hcidump -xt
HCIDump - HCI packet analyzer ver 1.5
device: any snap_len: 65535 filter: 0xffffffff
1179344009.007333 < HCI Command: Create Connection(0x01|0x0005) plen 13
  36 E3 48 D1 12 00 18 CC 00 00 00 00 01 
1179344009.010333 > HCI Event: Command Status(0x0f) plen 4
  00 01 05 04 
1179344009.744420 > HCI Event: Connect Complete(0x03) plen 11
  00 0B 00 36 E3 48 D1 12 00 01 00 
1179344009.744434 < HCI Command: Write Link Policy Settings(0x02|0x000d)
plen 4
  0B 00 0F 00 
1179344009.744443 < ACL data: handle 0x000b flags 0x02 dlen 52
    L2CAP(s): Echo req: dlen 44
    00 00 00 00 35 36 37 38 39 30 2D 31 32 33 34 35 36 37 38 39 
    30 2D 31 32 33 34 35 36 37 38 39 30 2D 31 32 33 34 35 36 37 
    38 39 30 2D 
1179344009.745326 > HCI Event: Command Complete(0x0e) plen 6
  01 0D 08 00 0B 00 
1179344009.766310 > HCI Event: Max Slots Change(0x1b) plen 3
  0B 00 05 
1179344009.890323 > ACL data: handle 0x000b flags 0x02 dlen 8
    L2CAP(s): Echo rsp: dlen 0
1179344009.896345 > HCI Event: Number of Completed Packets(0x13) plen 5
  01 0B 00 01 00 
1179344010.891077 < ACL data: handle 0x000b flags 0x02 dlen 52
    L2CAP(s): Echo req: dlen 44
    00 00 00 01 35 36 37 38 39 30 2D 31 32 33 34 35 36 37 38 39 
    30 2D 31 32 33 34 35 36 37 38 39 30 2D 31 32 33 34 35 36 37 
    38 39 30 2D 
1179344010.951285 > ACL data: handle 0x000b flags 0x02 dlen 8
    L2CAP(s): Echo rsp: dlen 0
1179344011.133469 < HCI Command: Create Connection(0x01|0x0005) plen 13
  36 E3 48 D1 12 00 18 4C 00 00 00 00 01 
1179344011.134318 > HCI Event: Command Status(0x0f) plen 4
  0B 01 05 04 
1179344011.145286 > HCI Event: Number of Completed Packets(0x13) plen 5
  01 0B 00 01 00 
1179344011.952045 < ACL data: handle 0x000b flags 0x02 dlen 52
    L2CAP(s): Echo req: dlen 44
    00 00 00 02 35 36 37 38 39 30 2D 31 32 33 34 35 36 37 38 39 
    30 2D 31 32 33 34 35 36 37 38 39 30 2D 31 32 33 34 35 36 37 
    38 39 30 2D 
1179344012.008275 > ACL data: handle 0x000b flags 0x02 dlen 8
    L2CAP(s): Echo rsp: dlen 0
1179344012.145298 > HCI Event: Number of Completed Packets(0x13) plen 5
  01 0B 00 01 00 
1179344013.009054 < ACL data: handle 0x000b flags 0x02 dlen 52
    L2CAP(s): Echo req: dlen 44
    00 00 00 03 35 36 37 38 39 30 2D 31 32 33 34 35 36 37 38 39 
    30 2D 31 32 33 34 35 36 37 38 39 30 2D 31 32 33 34 35 36 37 
    38 39 30 2D 
1179344013.071313 > ACL data: handle 0x000b flags 0x02 dlen 8
    L2CAP(s): Echo rsp: dlen 0
1179344013.270323 > HCI Event: Number of Completed Packets(0x13) plen 5
  01 0B 00 01 00 
1179344014.072079 < ACL data: handle 0x000b flags 0x02 dlen 52
    L2CAP(s): Echo req: dlen 44
    00 00 00 04 35 36 37 38 39 30 2D 31 32 33 34 35 36 37 38 39 
    30 2D 31 32 33 34 35 36 37 38 39 30 2D 31 32 33 34 35 36 37 
    38 39 30 2D 
1179344014.135304 > ACL data: handle 0x000b flags 0x02 dlen 8
    L2CAP(s): Echo rsp: dlen 0
1179344014.270322 > HCI Event: Number of Completed Packets(0x13) plen 5
  01 0B 00 01 00 
1179344015.058336 > HCI Event: Disconn Complete(0x05) plen 4
  00 0B 00 13 
1179344015.136021 < HCI Command: Create Connection(0x01|0x0005) plen 13
  36 E3 48 D1 12 00 18 CC 00 00 00 00 01 
1179344015.137302 > HCI Event: Command Status(0x0f) plen 4
  00 01 05 04 
1179344020.265307 > HCI Event: Connect Complete(0x03) plen 11
  04 0B 00 36 E3 48 D1 12 00 01 00 
1179344021.266433 < HCI Command: Create Connection(0x01|0x0005) plen 13
  36 E3 48 D1 12 00 18 CC 00 00 00 00 01 
1179344021.268281 > HCI Event: Command Status(0x0f) plen 4
  00 01 05 04 
1179344022.535338 > HCI Event: Connect Complete(0x03) plen 11
  00 0B 00 36 E3 48 D1 12 00 01 00 
1179344022.535348 < HCI Command: Write Link Policy Settings(0x02|0x000d)
plen 4
  0B 00 0F 00 
1179344022.535363 < ACL data: handle 0x000b flags 0x02 dlen 52
    L2CAP(s): Echo req: dlen 44
    00 00 00 06 35 36 37 38 39 30 2D 31 32 33 34 35 36 37 38 39 
    30 2D 31 32 33 34 35 36 37 38 39 30 2D 31 32 33 34 35 36 37 
    38 39 30 2D 
1179344022.538258 > HCI Event: Command Complete(0x0e) plen 6
  01 0D 08 00 0B 00 
1179344022.558262 > HCI Event: Max Slots Change(0x1b) plen 3
  0B 00 05 
1179344022.705290 > ACL data: handle 0x000b flags 0x02 dlen 8
    L2CAP(s): Echo rsp: dlen 0
1179344022.770280 > HCI Event: Number of Completed Packets(0x13) plen 5
  01 0B 00 01 00 
1179344023.706407 < ACL data: handle 0x000b flags 0x02 dlen 52
    L2CAP(s): Echo req: dlen 44
    00 00 00 07 35 36 37 38 39 30 2D 31 32 33 34 35 36 37 38 39 
    30 2D 31 32 33 34 35 36 37 38 39 30 2D 31 32 33 34 35 36 37 
    38 39 30 2D 
1179344023.763282 > ACL data: handle 0x000b flags 0x02 dlen 8
    L2CAP(s): Echo rsp: dlen 0
1179344023.895291 > HCI Event: Number of Completed Packets(0x13) plen 5
  01 0B 00 01 00 
^C


> btw, but if you let l2ping to continue to run it should re-establish
> baseband connection again.

Yes, every ~5s it timeouts and then it re-establish connection and then
gets several replays with usual delay

# /usr/sbin/hccontrol -n ubt0hci read_connection_list
Remote BD_ADDR    Handle Type Mode Role Encrypt Pending Queue State
e60                 3869  ACL    0 MAST    NONE       0     0
W4_CONN_COMPLETE

...
0 bytes from e60 seq_no=47 time=1162.826 ms result=0 
0 bytes from e60 seq_no=48 time=68.149 ms result=0 
0 bytes from e60 seq_no=49 time=45.690 ms result=0 
0 bytes from e60 seq_no=50 time=50.061 ms result=0 
0 bytes from e60 seq_no=51 time=65.745 ms result=0 
0 bytes from e60 seq_no=52 time=1142.827 ms result=0 
0 bytes from e60 seq_no=53 time=62.854 ms result=0 
0 bytes from e60 seq_no=54 time=42.855 ms result=0 
0 bytes from e60 seq_no=55 time=58.678 ms result=0 
0 bytes from e60 seq_no=56 time=51.960 ms result=0 
0 bytes from e60 seq_no=57 time=1183.973 ms result=0 
0 bytes from e60 seq_no=58 time=57.024 ms result=0 
0 bytes from e60 seq_no=59 time=55.461 ms result=0 
0 bytes from e60 seq_no=60 time=58.316 ms result=0 
0 bytes from e60 seq_no=61 time=42.456 ms result=0 
0 bytes from e60 seq_no=62 time=5129.594 ms result=0x4 
0 bytes from e60 seq_no=63 time=1497.149 ms result=0 
...

> yep, it seems like nokia kills baseband :(

Any hint how encourage it to keep connection ?

> thanks,
> max
> 
-- 
Vladimir B. Grebenschikov
SWsoft Inc. vova at swsoft.com


More information about the freebsd-bluetooth mailing list