Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: btpin - setting blank passwords
Hi,
After some time I have fixed the issue with my mouse.
It was a no name mouse, simply called bluetooth mouse.
What I found was that btpin was not required to connect.
There was a problem during connection which I was able to capture using
hcidump thanks to Iain's advice.
The connection was as follows:
HCI sniffer - Bluetooth packet analyzer ver 2.0-netbt
btsnoop version: 1 datalink type: 1002
< HCI Command: Create Connection (0x01|0x0005) plen 13
bdaddr 00:43:54:48:30:00 ptype 0xcc18 rswitch 0x00 clkoffset 0x0000
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 2-DH1 2-DH3 2-DH5 3-DH1 3-DH3 3-DH5
> HCI Event: Command Status (0x0f) plen 4
Create Connection (0x01|0x0005) status 0x00 ncmd 1
> HCI Event: Connect Complete (0x03) plen 11
status 0x00 handle 42 bdaddr 00:43:54:48:30:00 type ACL encrypt 0x00
< HCI Command: Write Link Policy Settings (0x02|0x000d) plen 4
handle 42 policy 0x00
Link policy:
> HCI Event: Max Slots Change (0x1b) plen 3
handle 42 slots 5
> HCI Event: Command Complete (0x0e) plen 6
Write Link Policy Settings (0x02|0x000d) ncmd 1
status 0x00 handle 42
< HCI Command: Read Clock Offset (0x01|0x001f) plen 2
handle 42
> HCI Event: Command Status (0x0f) plen 4
Read Clock Offset (0x01|0x001f) status 0x00 ncmd 1
< HCI Command: Authentication Requested (0x01|0x0011) plen 2
handle 42
> HCI Event: Read Clock Offset Complete (0x1c) plen 5
status 0x00 handle 42 clkoffset 0x05bc
> HCI Event: Command Status (0x0f) plen 4
Authentication Requested (0x01|0x0011) status 0x00 ncmd 1
> HCI Event: Link Key Request (0x17) plen 6
bdaddr 00:43:54:48:30:00
< HCI Command: Link Key Request Reply (0x01|0x000b) plen 22
bdaddr 00:43:54:48:30:00 key 0995D79EFA5A16A9586A0BCB8A1FC286
> HCI Event: Command Complete (0x0e) plen 10
Link Key Request Reply (0x01|0x000b) ncmd 1
status 0x00 bdaddr 00:43:54:48:30:00
> HCI Event: Auth Complete (0x06) plen 3
status 0x00 handle 42
< ACL data: handle 42 flags 0x02 dlen 12
L2CAP(s): Connect req: psm 17 scid 0x0040
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 42 packets 1
> ACL data: handle 42 flags 0x02 dlen 16
L2CAP(s): Connect rsp: dcid 0x0050 scid 0x0040 result 0 status 0
Connection successful
< ACL data: handle 42 flags 0x02 dlen 12
L2CAP(s): Config req: dcid 0x0050 flags 0x00 clen 0
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 42 packets 1
> ACL data: handle 42 flags 0x02 dlen 17
> ACL data: handle 42 flags 0x01 dlen 1
L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 4
MTU 48
> ACL data: handle 42 flags 0x02 dlen 16
L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 4
MTU 48
< ACL data: handle 42 flags 0x02 dlen 14
L2CAP(s): Config rsp: scid 0x0050 flags 0x00 result 0 clen 0
Success
< ACL data: handle 42 flags 0x02 dlen 12
L2CAP(s): Connect req: psm 19 scid 0x0041
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 42 packets 1
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 42 packets 1
> ACL data: handle 42 flags 0x02 dlen 16
L2CAP(s): Connect rsp: dcid 0x0051 scid 0x0041 result 0 status 0
Connection successful
< ACL data: handle 42 flags 0x02 dlen 12
L2CAP(s): Config req: dcid 0x0051 flags 0x00 clen 0
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 42 packets 1
> ACL data: handle 42 flags 0x02 dlen 17
> ACL data: handle 42 flags 0x01 dlen 1
L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
MTU 48
> ACL data: handle 42 flags 0x02 dlen 17
> ACL data: handle 42 flags 0x01 dlen 17
> ACL data: handle 42 flags 0x01 dlen 6
L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 28
MTU 48 QoS 0x01 (Best effort)
< ACL data: handle 42 flags 0x02 dlen 16
L2CAP(s): Config rsp: scid 0x0051 flags 0x00 result 3 clen 2
Failure - unknown options
QoS 00
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 42 packets 1
> ACL data: handle 42 flags 0x02 dlen 17
> ACL data: handle 42 flags 0x01 dlen 17
> ACL data: handle 42 flags 0x01 dlen 6
L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 28
MTU 48 QoS 0x01 (Best effort)
< ACL data: handle 42 flags 0x02 dlen 16
L2CAP(s): Config rsp: scid 0x0051 flags 0x00 result 3 clen 2
Failure - unknown options
QoS 00
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 42 packets 1
So the problem was that the mouse was reporting a quality of service but it
was asked by the driver to re transmit as though it was unknown, it would
keep doing this about three or so times and then disconnect.
I was able to remedy this by modifying l2cap_signal.c (I found this after many
trial and error attempts.)
Here is the patch:
--- l2cap_signal.c.orig 2007-11-11 10:12:23.000000000 +1100
+++ l2cap_signal.c 2011-09-30 18:57:36.000000000 +1000
@@ -524,6 +524,18 @@
break;
case L2CAP_OPT_QOS:
+ /* if (rp.result == L2CAP_UNKNOWN_OPTION) {
+ * break;
+ * }
+ *
+ * if (opt.length != L2CAP_OPT_QOS_SIZE) {
+ * goto reject;
+ * }
+ *
+ * m_copydata(m, 0, L2CAP_OPT_QOS_SIZE, &val);
+ * chan->lc_oqos = val.qos;
+ */
+ break;
default:
/* ignore hints */
if (opt.type & L2CAP_OPT_HINT_BIT)
A simple break fixed it and now the mouse connects and works fine. (Much
better than windows as in windows the mouse goes to sleep after 10 minutes of
inactivity and cannot be woken up.)
I wasn't sure if it should go through error checking and set the channel
parameters, looking at the code before the additions this was done for other
parameters. I was not even sure if it was the outgoing or incoming qos of
the channel that should be set, so I commented this out.
Are the commented out sections a good idea?
So just to recap because the device required no password running btpin was not
necessary so now the mouse works well and all is good.
So thanks Iain for an excellent bluetooth stack, unfortunately this mouse was
bought for my mum to use in windows and I've tried two different bluetooth
stacks and the mouse still shuts down and has to be repaired by pressing the
paring button and all.
However the good news is that this mouse is excellent in NetBSD.
Funny thing I was paying so much attention to the data packets in hcidump to
see if the mouse was working, that it took a while before I noticed that the
pointer was moving across the screen. :)
Thanks to all who had posted.
Regards,
Nat.
Home |
Main Index |
Thread Index |
Old Index