Date: Sun, 19 Dec 2004 23:56:53 +0300 From: Vladimir Grebenschikov <vova@fbsd.ru> To: Maksim Yevmenkin <maksim.yevmenkin@savvis.net> Cc: bluetooth@freebsd.org Subject: Re: Bluetooth mouse Message-ID: <1103489813.1721.14.camel@localhost> In-Reply-To: <41C35B92.7080908@savvis.net> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
=F7 =D0=D4, 17/12/2004 =D7 14:20 -0800, Maksim Yevmenkin =D0=C9=DB=C5=D4:=20
> Arne Schwabe wrote:
> > Maksim Yevmenkin <maksim.yevmenkin@savvis.net> writes:
> >=20
> >>bthidcontrol(8) is a utility that can query bluetooth hid devices and=20
> >>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).=
=20
> >>it will read configuration created by bthidcontrol(8) and talk to=20
> >>bluetooth hid devices.
> >=20
> > I just tried it with my Logitech MX900 mouse, it works! :)
>=20
> good.
I was not such lucky with mx900.
My experience:
bthidcontrol works ok:
# bthidcontrol -a mouse known
00:07:61:17:9b:27 mouse
# bthidcontrol -a mouse query
device {
bdaddr 00:07:61:17:9b:27;
control_psm 0x11;
interrupt_psm 0x19;
reconnect_initiate true;
battery_power true;
normally_connectable false;
hid_descriptor {
0x05 0x01 0x09 0x02 0xa1 0x01 0x85 0x02=20
0x09 0x01 0xa1 0x00 0x05 0x09 0x19 0x01=20
0x29 0x08 0x15 0x00 0x25 0x01 0x95 0x08=20
0x75 0x01 0x81 0x02 0x05 0x01 0x09 0x30=20
0x09 0x31 0x16 0x01 0xf8 0x26 0xff 0x07=20
0x75 0x0c 0x95 0x02 0x81 0x06 0x09 0x38=20
0x15 0x81 0x25 0x7f 0x75 0x08 0x95 0x01=20
0x81 0x06 0xc0 0xc0 0x06 0x00 0xff 0x09=20
0x01 0xa1 0x01 0x85 0x10 0x75 0x08 0x95=20
0x06 0x15 0x00 0x26 0xff 0x00 0x09 0x01=20
0x81 0x00 0x09 0x01 0x91 0x00 0xc0=20
};
}
# bthidcontrol -a mouse dump
Collection page=3DGeneric_Desktop usage=3DMouse
Collection page=3DGeneric_Desktop usage=3DPointer
Input id=3D2 size=3D1 count=3D1 page=3DButton usage=3DButton_1 Variable, =
logical range 0..1
Input id=3D2 size=3D1 count=3D1 page=3DButton usage=3DButton_2 Variable, =
logical range 0..1
Input id=3D2 size=3D1 count=3D1 page=3DButton usage=3DButton_3 Variable, =
logical range 0..1
Input id=3D2 size=3D1 count=3D1 page=3DButton usage=3DButton_4 Variable, =
logical range 0..1
Input id=3D2 size=3D1 count=3D1 page=3DButton usage=3DButton_5 Variable, =
logical range 0..1
Input id=3D2 size=3D1 count=3D1 page=3DButton usage=3DButton_6 Variable, =
logical range 0..1
Input id=3D2 size=3D1 count=3D1 page=3DButton usage=3DButton_7 Variable, =
logical range 0..1
Input id=3D2 size=3D1 count=3D1 page=3DButton usage=3DButton_8 Variable, =
logical range 0..1
Input id=3D2 size=3D12 count=3D1 page=3DGeneric_Desktop usage=3DX Variabl=
e Relative, logical range -2047..2047
Input id=3D2 size=3D12 count=3D1 page=3DGeneric_Desktop usage=3DY Variabl=
e Relative, logical range -2047..2047
Input id=3D2 size=3D8 count=3D1 page=3DGeneric_Desktop usage=3DWheel Vari=
able Relative, logical range -127..127
End collection
End collection
Input id=3D16 size=3D8 count=3D6 page=3DMicrosoft usage=3D0x0001, logical=
range 0..255
Output id=3D16 size=3D8 count=3D6 page=3DMicrosoft usage=3D0x0001, logical=
range 0..255
Collection page=3DMicrosoft usage=3D0x0001
#
my configurations files are:
# cat /etc/bluetooth/bthidd.conf
device {
bdaddr 00:07:61:17:9b:27;
control_psm 0x11;
interrupt_psm 0x19;
reconnect_initiate true;
battery_power true;
normally_connectable false;
hid_descriptor {
0x05 0x01 0x09 0x02 0xa1 0x01 0x85 0x02=20
0x09 0x01 0xa1 0x00 0x05 0x09 0x19 0x01=20
0x29 0x08 0x15 0x00 0x25 0x01 0x95 0x08=20
0x75 0x01 0x81 0x02 0x05 0x01 0x09 0x30=20
0x09 0x31 0x16 0x01 0xf8 0x26 0xff 0x07=20
0x75 0x0c 0x95 0x02 0x81 0x06 0x09 0x38=20
0x15 0x81 0x25 0x7f 0x75 0x08 0x95 0x01=20
0x81 0x06 0xc0 0xc0 0x06 0x00 0xff 0x09=20
0x01 0xa1 0x01 0x85 0x10 0x75 0x08 0x95=20
0x06 0x15 0x00 0x26 0xff 0x00 0x09 0x01=20
0x81 0x00 0x09 0x01 0x91 0x00 0xc0=20
};
}
# cat /var/db/bthidd.hids
00:07:61:17:9b:27
#
When I start bthidd it waits for mouse connection forever, clicking on mous=
e connect button does not seems to have any effect,
moreover hcidump does not show any traffic.
But bthidd listens on /17 and /19 (why not /11 ?)
# btsockstat=20
Active raw HCI sockets
Socket PCB Flags Recv-Q Send-Q Local address =20
c2e44654 c273b500 000003 0 0 * =20
c1dba288 c2060880 000002 0 0 * =20
Active L2CAP sockets
PCB Recv-Q Send-Q Local address/PSM Foreign address CID Stat=
e
c2fa8700 0 0 * /19 * 0 LIST=
EN
c2fa9700 0 0 * /17 * 0 LIST=
EN
c1957200 0 0 * /1 * 0 LIST=
EN
#
If I try to change reconnect_initiative to false bthidd try to connect to m=
ouse but gets error:
# bthidd -d
bthidd[1785]: Opening outbound session for 00:07:61:17:9b:27 (new_device=3D=
0, reconnect_initiate=3D0)
bthidd[1785]: Could not connect to 00:07:61:17:9b:27. Socket is not connect=
ed (57)
while hcidump shows:
# hcidump
HCIDump - HCI packet analyzer ver 1.5
device: any snap_len: 65535 filter: 0xffffffff
< HCI Command: Create Connection(0x01|0x0005) plen 13
> HCI Event: Command Status(0x0f) plen 4
> HCI Event: Connect Complete(0x03) plen 11
< HCI Command: Write Link Policy Settings(0x02|0x000d) plen 4
< ACL data: handle 0x0029 flags 0x02 dlen 12
L2CAP(s): Connect req: psm 17 scid 0x004c
> HCI Event: Number of Completed Packets(0x13) plen 5
> HCI Event: Command Complete(0x0e) plen 6
> HCI Event: Page Scan Repetition Mode Change(0x20) plen 7
> ACL data: handle 0x0029 flags 0x02 dlen 16
L2CAP(s): Connect rsp: dcid 0x004d scid 0x004c result 1 status 2
> ACL data: handle 0x0029 flags 0x02 dlen 16
L2CAP(s): Connect rsp: dcid 0x0000 scid 0x004c result 2 status 0
> HCI Event: QoS Setup Complete(0x0d) plen 21
> HCI Event: Disconn Complete(0x05) plen 4
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.
Mouse works Ok under winXP with onboard bt.
(Is there way with hcidump "listen" traffic between XP and mouse to get clu=
e ?)
If mouse already connected with USB receiver it do not answer even on l2pin=
g.
My bluetooth controller:
ubt0: ALPS UGX, rev 1.10/7.81, addr 2
ubt0: ALPS UGX, rev 1.10/7.81, addr 2
ubt0: Interface 0 endpoints: interrupt=3D0x81, bulk-in=3D0x82, bulk-out=3D0=
x2
ubt0: Interface 1 (alt.config 5) endpoints: isoc-in=3D0x83, isoc-out=3D0x3;=
wMaxPacketSize=3D49; nframes=3D6, buffer size=3D294
# ngctl ls
There are 7 total nodes:
Name: ngctl1850 Type: socket ID: 00000020 Num hooks: 0
Name: ubt0l2cap Type: l2cap ID: 0000001a Num hooks: 3
Name: ubt0hci Type: hci ID: 00000016 Num hooks: 3
Name: btsock_l2c Type: btsock_l2c ID: 00000005 Num hooks: 1
Name: btsock_l2c_raw Type: btsock_l2c_raw ID: 00000004 Num hooks: 1
Name: btsock_hci_raw Type: btsock_hci_raw ID: 00000003 Num hooks: 1
Name: ubt0 Type: ubt ID: 00000002 Num hooks: 1
Any ideas is very appreciated.
> > But for _some_ reason, my third and second buttons are swapped. Well I
>=20
> the code just parses input hid reports according to the device's hid=20
> descriptor. it hid descriptor says its second button it will be second=20
> button :)
>=20
> > hacked it in the hid.c source code %)
>=20
> well, you are more then welcome to hack it further. i hope that enough=20
> bluetooth hid users will send me their hacks so i finally will be able=20
> to finish this :)
>=20
> thanks,
> max
--=20
Vladimir B. Grebenchikov
vova@fbsd.ru
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1103489813.1721.14.camel>
