2006-12-14 06:13:16

by Jon Barnett

[permalink] [raw]
Subject: [Bluez-devel] Immediate disconnect after doing "hcitool cc"

I have problems with the Broadcom BCM2045 connecting to a Sony-Ericcson
headset (HBH-610a). It connects but it then immediately disconnects.
This does not occur when using a Kensington USB bluetooth dongle so I
know that connecting to the headset is possible.

USB device info:
T: Bus=05 Lev=02 Prnt=02 Port=03 Cnt=01 Dev#= 6 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=e0(unk. ) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=413c ProdID=8126 Rev= 1.00
S: Manufacturer=Broadcom Corp
S: Product=BCM2045
C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr= 0mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=e0(unk. ) Sub=01 Prot=01 Driver=hci_usb
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=hci_usb
E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=hci_usb
E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=hci_usb
E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=hci_usb
E: Ad=83(I) Atr=01(Isoc) MxPS= 32 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 32 Ivl=1ms
I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=hci_usb
E: Ad=83(I) Atr=01(Isoc) MxPS= 64 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 64 Ivl=1ms
I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=hci_usb
E: Ad=83(I) Atr=01(Isoc) MxPS= 64 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 64 Ivl=1ms
I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E: Ad=84(I) Atr=02(Bulk) MxPS= 32 Ivl=0ms
E: Ad=04(O) Atr=02(Bulk) MxPS= 32 Ivl=0ms
I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=00 Driver=(none)

hcidump -X -V results for a hcitool cc command:
< HCI Command: Create Connection (0x01|0x0005) plen 13
bdaddr 00:12:EE:E0:AB:CA ptype 0xcc18 rswitch 0x01 clkoffset 0x0000
Packet type: DM1 DM3 DM5 DH1 DH3 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 12 bdaddr 00:12:EE:E0:AB:CA type ACL encrypt 0x00
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
handle 12
> HCI Event: Command Status (0x0f) plen 4
Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1
< HCI Command: Write Link Policy Settings (0x02|0x000d) plen 4
handle 12 policy 0x0f
Link policy: RSWITCH HOLD SNIFF PARK
> HCI Event: Read Remote Supported Features (0x0b) plen 11
status 0x00 handle 12
Features: 0xff 0xfd 0x29 0x78 0x18 0x18 0x00 0x80
> HCI Event: Command Complete (0x0e) plen 6
Write Link Policy Settings (0x02|0x000d) ncmd 1
status 0x00 handle 12
< HCI Command: Remote Name Request (0x01|0x0019) plen 10
bdaddr 00:12:EE:E0:AB:CA mode 2 clkoffset 0x0000
> HCI Event: Command Status (0x0f) plen 4
Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> HCI Event: Max Slots Change (0x1b) plen 3
handle 12 slots 5
> HCI Event: Remote Name Req Complete (0x07) plen 255
status 0x00 bdaddr 00:12:EE:E0:AB:CA name 'HBH-610a'
< HCI Command: Disconnect (0x01|0x0006) plen 3
handle 12 reason 0x13
Reason: Remote User Terminated Connection
> HCI Event: Command Status (0x0f) plen 4
Disconnect (0x01|0x0006) status 0x00 ncmd 1
> HCI Event: Disconn Complete (0x05) plen 4
status 0x00 handle 12 reason 0x16
Reason: Connection Terminated by Local Host

Is there something else I need to do to get this to work? Any help would
be appreciated.

Thanks,

JonB


Attachments:
signature.asc (189.00 B)
This is a digitally signed message part
(No filename) (347.00 B)
(No filename) (164.00 B)
Download all attachments

2006-12-18 11:55:09

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] Immediate disconnect after doing "hcitool cc"

Hi Lauri,

> Well, I'm a man in a bad need of performance and have to create ACL
> connections in the most optimized way. The current tests (hcidump) have
> unfortunately showed that the Linux kernel (2.5.16) does make use of
> pscan_repetition_mode, not sure about the clock_offset. Inquiry scan has
> been done just seconds before connection attempts.
>
> With this background I guess there are 2 ways out: messing with HCI directly
> and taking the risk of kernel overriding me; or re-writing some
> Bluetooth/sockets code in the kernel. Do you agree?

that is all crap. The kernel is the fastest way to create the ACL. There
is no other way, because the kernel has all needed information and keeps
them up-to-date. So don't even try to accomplish something that is
impossible to achieve.

Regards

Marcel



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-12-18 09:52:23

by Lauri Lubi

[permalink] [raw]
Subject: Re: [Bluez-devel] Immediate disconnect after doing "hcitool cc"

Well, I'm a man in a bad need of performance and have to create ACL
connections in the most optimized way. The current tests (hcidump) have
unfortunately showed that the Linux kernel (2.5.16) does make use of
pscan_repetition_mode, not sure about the clock_offset. Inquiry scan has
been done just seconds before connection attempts.

With this background I guess there are 2 ways out: messing with HCI directly
and taking the risk of kernel overriding me; or re-writing some
Bluetooth/sockets code in the kernel. Do you agree?

Does anybody have some good hints for where to start in the kernel source
tree? I would like to try modifying how the kernel creates an ACL
connection, and if some options (clock_offset and pscan_rep_mode) can be
passed to it. I guess that bluez-libs has nothing to do with how the kernel
implements HCI_CREATE_CONNECTION?


Mvh
Lauri Lubi
Mob +46 730 39 31 00
=


-----Ursprungligt meddelande-----
Fr=E5n: [email protected]
[mailto:[email protected]] F=F6r Marcel Holtmann
Skickat: den 18 december 2006 10:37
Till: BlueZ development
=C4mne: Re: [Bluez-devel] Immediate disconnect after doing "hcitool cc"

Hi,

> Is there more information available how the kernel creates an ACL
> connection? I have been reading source code for 2.6.13-15 but not seen
> anything about creating an ACL connection yet. Well, I am quite unfamiliar
> with the kernel source code.
> =

> I have re-written some parts of hcitool so that it uses clock_offset and
> pscan_repetition_mode when ACL-connecting. Is kernel code more optimised
> that this?
> =

> Q2: Any ideas for a good way to time kernel creating the ACL connection?
So
> that to compare with a "hacked" hcitool.

this is all the wrong approach. Create a L2CAP or RFCOMM connection and
the kernel will create any needed ACL link for you. Don't try to think
to complicate. If you try to mess around with connection reference
counting of the ACL the kernel will always win and simply disconnect the
link if it thinks it is no longer needed. Messing around directly with
HCI is never a good idea.

Regards

Marcel



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDE=
VDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-- =

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.23/591 - Release Date: 2006-12-17
15:17
=


-- =

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.23/591 - Release Date: 2006-12-17
15:17
=



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDE=
VDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-12-18 09:36:59

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] Immediate disconnect after doing "hcitool cc"

Hi,

> Is there more information available how the kernel creates an ACL
> connection? I have been reading source code for 2.6.13-15 but not seen
> anything about creating an ACL connection yet. Well, I am quite unfamiliar
> with the kernel source code.
>
> I have re-written some parts of hcitool so that it uses clock_offset and
> pscan_repetition_mode when ACL-connecting. Is kernel code more optimised
> that this?
>
> Q2: Any ideas for a good way to time kernel creating the ACL connection? So
> that to compare with a "hacked" hcitool.

this is all the wrong approach. Create a L2CAP or RFCOMM connection and
the kernel will create any needed ACL link for you. Don't try to think
to complicate. If you try to mess around with connection reference
counting of the ACL the kernel will always win and simply disconnect the
link if it thinks it is no longer needed. Messing around directly with
HCI is never a good idea.

Regards

Marcel



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-12-18 08:00:28

by Lauri Lubi

[permalink] [raw]
Subject: Re: [Bluez-devel] Immediate disconnect after doing "hcitool cc"

Hello,

Is there more information available how the kernel creates an ACL
connection? I have been reading source code for 2.6.13-15 but not seen
anything about creating an ACL connection yet. Well, I am quite unfamiliar
with the kernel source code.

I have re-written some parts of hcitool so that it uses clock_offset and
pscan_repetition_mode when ACL-connecting. Is kernel code more optimised
that this?

Q2: Any ideas for a good way to time kernel creating the ACL connection? So
that to compare with a "hacked" hcitool.

Mvh
Lauri Lubi
Mob +46 730 39 31 00
=


-----Ursprungligt meddelande-----
Fr=E5n: [email protected]
[mailto:[email protected]] F=F6r Marcel Holtmann
Skickat: den 17 december 2006 13:44
Till: [email protected]; BlueZ development
=C4mne: Re: [Bluez-devel] Immediate disconnect after doing "hcitool cc"

Hi Jon,

> No. The disconnect happens at most maybe a couple of seconds after the
> cc command has completed. I've tried:
> hcitool cc 00:12:EE:E0:AB:CA; hcitool auth 00:12:EE:E0:AB:CA

don't use "hcitool cc" for connecting devices. This command is not for
general purpose use. Let the kernel create you low-level ACL, because it
knows what to do.

Regards

Marcel



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDE=
VDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-- =

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.23/591 - Release Date: 2006-12-17
15:17
=


-- =

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.23/591 - Release Date: 2006-12-17
15:17
=



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDE=
VDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-12-17 17:37:31

by Jon Barnett

[permalink] [raw]
Subject: Re: [Bluez-devel] Immediate disconnect after doing "hcitool cc"

Thanks for the response. I'm unsure about how the ACL is created and how
I then do the auth to pair the devices. Is there any documentation as
I've just been going through the list of quoted documentation at the
bluez site and every thing I've read so far always talks about doing the
cc?

I remember that with running btsco it would do all the pairing and
prompt for the pin through the gnome-bluetooth applet. Is that what is
meant by the kernel doing the low-level ACL? The only thing is I haven't
looked back at compiling the code with kernel 2.6.19 - I think I had
some problems compiling the device module against the kernel so I will
need to review that again. It throws up an error - btsco.c:127: error:
syntax error before "snd_card_t" as the first before a whole lot more
warnings and errors.

Cheers,

JonB.

On Sun, 2006-12-17 at 13:43 +0100, Marcel Holtmann wrote:
> Hi Jon,
>
> > No. The disconnect happens at most maybe a couple of seconds after the
> > cc command has completed. I've tried:
> > hcitool cc 00:12:EE:E0:AB:CA; hcitool auth 00:12:EE:E0:AB:CA
>
> don't use "hcitool cc" for connecting devices. This command is not for
> general purpose use. Let the kernel create you low-level ACL, because it
> knows what to do.
>
> Regards
>
> Marcel


Attachments:
signature.asc (189.00 B)
This is a digitally signed message part
(No filename) (347.00 B)
(No filename) (164.00 B)
Download all attachments

2006-12-17 12:43:43

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] Immediate disconnect after doing "hcitool cc"

Hi Jon,

> No. The disconnect happens at most maybe a couple of seconds after the
> cc command has completed. I've tried:
> hcitool cc 00:12:EE:E0:AB:CA; hcitool auth 00:12:EE:E0:AB:CA

don't use "hcitool cc" for connecting devices. This command is not for
general purpose use. Let the kernel create you low-level ACL, because it
knows what to do.

Regards

Marcel



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-12-15 02:05:09

by Jon Barnett

[permalink] [raw]
Subject: Re: [Bluez-devel] Immediate disconnect after doing "hcitool cc"

On Thu, 2006-12-14 at 17:25 +0800, amateur wrote:
> On Thu, Dec 14, 2006 at 01:13:16AM -0500, Jon Barnett wrote:
> > hcidump -X -V results for a hcitool cc command:
> > > HCI Event: Max Slots Change (0x1b) plen 3
> > handle 12 slots 5
> > > HCI Event: Remote Name Req Complete (0x07) plen 255
> > status 0x00 bdaddr 00:12:EE:E0:AB:CA name 'HBH-610a'
> > < HCI Command: Disconnect (0x01|0x0006) plen 3
> > handle 12 reason 0x13
> > Reason: Remote User Terminated Connection
> > > HCI Event: Command Status (0x0f) plen 4
> > Disconnect (0x01|0x0006) status 0x00 ncmd 1
> > > HCI Event: Disconn Complete (0x05) plen 4
> > status 0x00 handle 12 reason 0x16
> > Reason: Connection Terminated by Local Host
> >
> How long does it takes for your computer to send the disconnect
> request? Maybe it is that bluez will automatically disconnect a
> connection after some idle time.
>

No. The disconnect happens at most maybe a couple of seconds after the
cc command has completed. I've tried:
hcitool cc 00:12:EE:E0:AB:CA; hcitool auth 00:12:EE:E0:AB:CA

And it disconnects before I can even enter the pin at the
gnome-bluetooth prompt.

As I said, it doesn't happen if I use the Kensington USB dongle. So
there is something different about the BCM2045 USB device.


Attachments:
signature.asc (189.00 B)
This is a digitally signed message part
(No filename) (347.00 B)
(No filename) (164.00 B)
Download all attachments

2006-12-14 09:25:46

by Tianlei Zhao

[permalink] [raw]
Subject: Re: [Bluez-devel] Immediate disconnect after doing "hcitool cc"

On Thu, Dec 14, 2006 at 01:13:16AM -0500, Jon Barnett wrote:
> hcidump -X -V results for a hcitool cc command:
> < HCI Command: Create Connection (0x01|0x0005) plen 13
> bdaddr 00:12:EE:E0:AB:CA ptype 0xcc18 rswitch 0x01 clkoffset 0x0000
> Packet type: DM1 DM3 DM5 DH1 DH3 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 12 bdaddr 00:12:EE:E0:AB:CA type ACL encrypt 0x00
> < HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
> handle 12
> > HCI Event: Command Status (0x0f) plen 4
> Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1
> < HCI Command: Write Link Policy Settings (0x02|0x000d) plen 4
> handle 12 policy 0x0f
> Link policy: RSWITCH HOLD SNIFF PARK
> > HCI Event: Read Remote Supported Features (0x0b) plen 11
> status 0x00 handle 12
> Features: 0xff 0xfd 0x29 0x78 0x18 0x18 0x00 0x80
> > HCI Event: Command Complete (0x0e) plen 6
> Write Link Policy Settings (0x02|0x000d) ncmd 1
> status 0x00 handle 12
> < HCI Command: Remote Name Request (0x01|0x0019) plen 10
> bdaddr 00:12:EE:E0:AB:CA mode 2 clkoffset 0x0000
> > HCI Event: Command Status (0x0f) plen 4
> Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> > HCI Event: Max Slots Change (0x1b) plen 3
> handle 12 slots 5
> > HCI Event: Remote Name Req Complete (0x07) plen 255
> status 0x00 bdaddr 00:12:EE:E0:AB:CA name 'HBH-610a'
> < HCI Command: Disconnect (0x01|0x0006) plen 3
> handle 12 reason 0x13
> Reason: Remote User Terminated Connection
> > HCI Event: Command Status (0x0f) plen 4
> Disconnect (0x01|0x0006) status 0x00 ncmd 1
> > HCI Event: Disconn Complete (0x05) plen 4
> status 0x00 handle 12 reason 0x16
> Reason: Connection Terminated by Local Host
>
How long does it takes for your computer to send the disconnect
request? Maybe it is that bluez will automatically disconnect a
connection after some idle time.

--
An honest tale speeds best being plainly told.
-- William Shakespeare, "Henry VI"

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel