Bluetooth Proximity Monitor on FreeBSD ?

Maksim Yevmenkin maksim.yevmenkin at gmail.com
Wed May 16 17:11:01 UTC 2007


On 5/16/07, Vladimir Grebenschikov <vova at sw.ru> wrote:
> В вт, 15/05/2007 в 23:56 -0500, Eric Anderson пишет:
> > On 05/15/07 08:54, Vladimir Grebenschikov wrote:
> > > Hi
> > >
> > > Does anybody plays with scrips like that:
> > > http://gentoo-wiki.com/TIP_Bluetooth_Proximity_Monitor
> > >
> > > I guess it should be easy to patch it for FreeBSD, but probably somebody
> > > already did it ?
> > >
> >
> >
> > Like this:
> >
> > http://www.googlebit.com/doku.php?id=bt_proximity
> >
> > Didn't take too long to do it up for FreeBSD, and works great!!
>
> Requires a bit modification to work for me and finally works very
> unstable:
>
> # /usr/sbin/hccontrol -n ubt0hci create_connection e60
> BD_ADDR: e60
> Connection handle: 11
> Encryption mode: Disabled [0]
> # /usr/sbin/hccontrol -n ubt0hci read_connection_list
> Remote BD_ADDR    Handle Type Mode Role Encrypt Pending Queue State
> e60                   11  ACL    0 MAST    NONE       0     0 OPEN
> # /usr/sbin/hccontrol -n ubt0hci read_connection_list
> Remote BD_ADDR    Handle Type Mode Role Encrypt Pending Queue State
> e60                   11  ACL    0 MAST    NONE       0     0 OPEN
> # /usr/sbin/hccontrol -n ubt0hci read_connection_list
> Remote BD_ADDR    Handle Type Mode Role Encrypt Pending Queue State
> e60                   11  ACL    0 MAST    NONE       0     0 OPEN
> # /usr/sbin/hccontrol -n ubt0hci read_connection_list
> Remote BD_ADDR    Handle Type Mode Role Encrypt Pending Queue State
> e60                   11  ACL    0 MAST    NONE       0     0 OPEN
> # /usr/sbin/hccontrol -n ubt0hci read_connection_list
> Remote BD_ADDR    Handle Type Mode Role Encrypt Pending Queue State
> # dmesg | tail -n 1
> ng_l2cap_lp_discon_ind: ubt0l2cap - unexpected LP_DisconnectInd event. Connection does not exist, con_handle=11
> #
>
> 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.

> PPP over telephone Bluetooth works more or less stable.
>
> Of course, I can just use l2ping or 'hccontrol Inquiry' to check device
> presence, but how to read signal quality in that case ?

bluetooth 2.0 defines 'inquiry with rssi' command. of course your
nokia phone should be 'visible/discoverable'. someone was working on
making bluetooth 2.0 commands available in hccontrol.

of course you could always do something like

1) hccontrol read_connection_list --- and see if baseband connection is present

1.1) if present, remember handle

1.2) if not, hccontrol create_connection -- and remember handle

2) hccontrol read_rssi <handle>

3) sleep and repeat

thanks,
max


More information about the freebsd-bluetooth mailing list