Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Dec 2004 18:35:14 -0800
From:      Maksim Yevmenkin <maksim.yevmenkin@savvis.net>
To:        vova@fbsd.ru
Cc:        bluetooth@freebsd.org
Subject:   Re: Bluetooth mouse
Message-ID:  <41C63A62.20304@savvis.net>
In-Reply-To: <1103489813.1721.14.camel@localhost>
References:  <1100552998.1098.5.camel@localhost>	 <419B8353.7040908@savvis.net> <opshmg45c1lo1qsj@mail.xs4all.nl>	 <419B9EF8.2090401@savvis.net> <1103269957.974.7.camel@localhost>	 <41C32471.2050805@savvis.net> <866530fusa.fsf@kamino.rfc1149.org>	 <41C35B92.7080908@savvis.net> <1103489813.1721.14.camel@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help
Vladimir,

>>>>bthidcontrol(8) is a utility that can query bluetooth hid devices and 
>>>>create configuration for bthidd(8).
>>>>
>>>>% nroff -man bthidcontrol.8 | less -- for more information
>>>>
>>>>bthidd(8) is a bluetooth hid daemon (incomplete but mouse should work). 
>>>>it will read configuration created by bthidcontrol(8) and talk to 
>>>>bluetooth hid devices.
>>>
>>>I just tried it with my Logitech MX900 mouse, it works! :)
>>
>>good.
> 
> I was not such lucky with mx900.
> 
> My experience:
> 
> bthidcontrol works ok:

[...]

good.

> my configurations files are:
> 
> # cat /etc/bluetooth/bthidd.conf

[...]

> # cat /var/db/bthidd.hids
> 00:07:61:17:9b:27

hmmm... you did not hand-edit /var/db/bthidd.hids, did you? this file is 
  not supposed to be edited by user. this file contains "hints" for 
bthidd(8), that is bluetooth hid devices "known" to bthidd(8).

> When I start bthidd it waits for mouse connection forever, clicking on mouse connect button does not seems to have any effect,
> moreover hcidump does not show any traffic.

again if you hand-edited /var/db/bthidd.hids, then this is the correct 
behavior. the typical behavior of bluetooth hid devices is: the very 
first time bluetooth hid device needs to be contacted by the host. this 
is because in its default state bluetooth hid device does not know 
anything about host, i.e. its bd_addr etc. in its default state the hid 
device will answer inquiry, etc. the host finds new hid device and 
initiates bluetooth hid session (opens interrupt and control channels). 
after the hid device was contacted by the host for the very first time, 
the hid device will "remember" host bd_addr. after that bluetooth hid 
device will reject all connection attempts from the different hosts and 
may even stop responding to inquires.

so, the /var/db/bthidd.hids file contains bd_addrs of the bluetooth hid 
devices that were contacted by the host (bthidd(8)) at least once.

in order to get bluetooth hid device in its default state you will need 
to press reset button (if any) or just disconnect batteries for a few 
seconds.

> But bthidd listens on /17 and /19 (why not /11 ?)

0x11 = 17 and 0x13 = 19 :)

[...]

> If I try to change reconnect_initiative to false bthidd try to connect to mouse but gets error:
> 
> # bthidd -d
> bthidd[1785]: Opening outbound session for 00:07:61:17:9b:27 (new_device=0, reconnect_initiate=0)
> bthidd[1785]: Could not connect to 00:07:61:17:9b:27. Socket is not connected (57)

that will not work. what you put into /etc/bluetooth/bthidd.conf (output 
of bthidcontrol(8)) is what devices tells us to do. that is a locally 
cached copy of bluetooth hid descriptor. "reconnect_initiate = true" and 
"normally_connectable = false" tells the host that device will initiate 
reconnect and host should not try to attempt to contact it.

[...]

> On mouse I have picture where attaching procedure shown as
> 1. Click connect on mouse
> 2. Click connect on USB receiver.
> 
> Looks like mouse gets passive state and waits for receiver connection after connect button.

0) run hcidump -w mouse.dump as root

1) make sure bthidd(8) is NOT running

2) reset the mouse (press reset button or disconnect batteries for a few 
seconds)

3) use bthidcontrol(8) to query the mouse

4) put output of the bthidcontrol(8) in the /etc/bluetooth/bthidd.conf

5) make sure mouse bd_addr IS *NOT* in the /var/db/bthidd.hids

6) (OPTIONAL) *if* your mouse requests authentication then edit 
/etc/bluetooth/hcsecd.conf file and add pin code or link key. the pin 
code can be obtained from the mouse documentation. after that run hcsecd(8)

7) start bthidd(8)

if you did everything right the mouse should work.

NOTE: the mouse will shutdown itself after some period of inactivity. to 
bring it back just move it and/or press the buttons. you do *NOT* need 
to fiddle with bthidd(8) and or bthidcontrol(8) anymore. if you done 
everything above and it still does not work then send me hcidump output.

NOTE: if your have reset your mouse or replaced batteries you all you 
need to do is: use 'bthidcontrol forget' command and restart bthidd(8).

> Mouse works Ok under winXP with onboard bt.
> (Is there way with hcidump "listen" traffic between XP and mouse to get clue ?)

bluetooth is a point-to-point link. i do not know a way to put bluetooth 
device in promiscuous mode, and, thus sniff traffic between another pair 
of devices.

> If mouse already connected with USB receiver it do not answer even on l2ping.

see above

thanks,
max



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41C63A62.20304>