2011-05-11 08:52:28

by Eponymous -

[permalink] [raw]
Subject: HCI data payload not getting through when using BlueZ

Hi,

I've ran into an issue where data doesn't seem to be received by a slave device.

I do the following:

Using Gentoo Linux (2.6.34-gentoo-r1)
Using BlueZ 4.81

1. Use BlueZ to connect to two Bluetooth devices using HCI only. This
is over USB.

2. I set one device as a slave and then create a connection between
the two. This completes sucessfully and can be seen on both sides.

3. I then try to send an acl packet with the word "hi" in it and it is
not received on the other side.

--------

Doing the same thing above but:

Using Fedora Core 5 (2.6.20-1.2320.fc5)
And:
bluez-libs-2.25-1
bluez-pin-0.30-2
bluez-utils-2.25-4
bluez-libs-devel-2.25-1
bluez-hcidump-1.30-1

and using the same hardware - the problem doesn't happen.

I have attached two HCI dumps, one of the Master device and one of the Slave.

Thanks for any help you can give.


Attachments:
master.out (157.00 B)
slave.out (181.00 B)
Download all attachments

2011-05-13 08:26:54

by Mika Linnanoja

[permalink] [raw]
Subject: Re: HCI data payload not getting through when using BlueZ

On 05/13/2011 11:13 AM, ext Suraj Sumangala wrote:
> You have to enable it in the cofigure file and change "test_enable" from "no" to "yes".
> Edit the file "configure", search for "test_enable"
> change "test_enable=no" to "test_enable=yes"
>
> That is what I do to enable l2test. I guess there could be some other cleaner way to do it.

./configure --help :)

If you pull from the git repo ./bootstrap-configure already enables most of them.

Although lately configure is often *not* complaining if something is missing
from build dependencies, have to do a bit of trial & error to get it right.

This is very easy to notice when trying to 'make' bluez on a clean system
where it hasn't ever been built before.

Cheers,
Mika

2011-05-13 08:13:16

by Suraj Sumangala

[permalink] [raw]
Subject: RE: HCI data payload not getting through when using BlueZ

Hi,
________________________________________
From: [email protected] [[email protected]] On Behalf Of Eponymous - [[email protected]]
Sent: Friday, May 13, 2011 1:24 PM
To: Eponymous -; [email protected]
Subject: Re: HCI data payload not getting through when using BlueZ

Can someone please advise me further on this please? There is no
binary called "l2test" in the 4.91 sources. It's crucial I get this
problem remedied as I can't send data between two HCI devices. This
could be a bug in BlueZ...


On Thu, May 12, 2011 at 11:19 AM, Eponymous - <[email protected]> wrote:
> Hi,
>
> I've just downloaded the 4.91 sources and done a make and the only
> program I can see starting "l2" is "l2ping". There is no l2test.
>
>
> On Wed, May 11, 2011 at 5:47 PM, Gustavo F. Padovan
> <[email protected]> wrote:
>> * Eponymous - <[email protected]> [2011-05-11 09:52:28 +0100]:
>>
>>> Hi,
>>>
>>> I've ran into an issue where data doesn't seem to be received by a slave device.
>>>
>>> I do the following:
>>>
>>> Using Gentoo Linux (2.6.34-gentoo-r1)
>>> Using BlueZ 4.81
>>>
>>> 1. Use BlueZ to connect to two Bluetooth devices using HCI only. This
>>> is over USB.
>>>
>>> 2. I set one device as a slave and then create a connection between
>>> the two. This completes sucessfully and can be seen on both sides.
>>>
>>> 3. I then try to send an acl packet with the word "hi" in it and it is
>>> not received on the other side.
>>
>> There a utility called l2test in the bluez sources. Check if it works for you.
>> Using -r in one side to listen and -s in the other side to send data. Or
>> l2test -h and see all options.
>>
>> --
>> Gustavo F. Padovan
>> http://profusion.mobi
>>
>

You have to enable it in the cofigure file and change "test_enable" from "no" to "yes".
Edit the file "configure", search for "test_enable"
change "test_enable=no" to "test_enable=yes"

That is what I do to enable l2test. I guess there could be some other cleaner way to do it.

Regards
Suraj

2011-05-13 07:54:18

by Eponymous -

[permalink] [raw]
Subject: Re: HCI data payload not getting through when using BlueZ

Can someone please advise me further on this please? There is no
binary called "l2test" in the 4.91 sources. It's crucial I get this
problem remedied as I can't send data between two HCI devices. This
could be a bug in BlueZ...


On Thu, May 12, 2011 at 11:19 AM, Eponymous - <[email protected]> wrote:
> Hi,
>
> I've just downloaded the 4.91 sources and done a make and the only
> program I can see starting "l2" is "l2ping". There is no l2test.
>
>
> On Wed, May 11, 2011 at 5:47 PM, Gustavo F. Padovan
> <[email protected]> wrote:
>> * Eponymous - <[email protected]> [2011-05-11 09:52:28 +0100]:
>>
>>> Hi,
>>>
>>> I've ran into an issue where data doesn't seem to be received by a slave device.
>>>
>>> I do the following:
>>>
>>> Using Gentoo Linux (2.6.34-gentoo-r1)
>>> Using BlueZ 4.81
>>>
>>> 1. Use BlueZ to connect to two Bluetooth devices using HCI only. This
>>> is over USB.
>>>
>>> 2. I set one device as a slave and then create a connection between
>>> the two. This completes sucessfully and can be seen on both sides.
>>>
>>> 3. I then try to send an acl packet with the word "hi" in it and it is
>>> not received on the other side.
>>
>> There a utility called l2test in the bluez sources. Check if it works for you.
>> Using -r in one side to listen and -s in the other side to send data. Or
>> l2test -h and see all options.
>>
>> --
>> Gustavo F. Padovan
>> http://profusion.mobi
>>
>

2011-05-12 10:19:01

by Eponymous -

[permalink] [raw]
Subject: Re: HCI data payload not getting through when using BlueZ

Hi,

I've just downloaded the 4.91 sources and done a make and the only
program I can see starting "l2" is "l2ping". There is no l2test.


On Wed, May 11, 2011 at 5:47 PM, Gustavo F. Padovan
<[email protected]> wrote:
> * Eponymous - <[email protected]> [2011-05-11 09:52:28 +0100]:
>
>> Hi,
>>
>> I've ran into an issue where data doesn't seem to be received by a slave device.
>>
>> I do the following:
>>
>> Using Gentoo Linux (2.6.34-gentoo-r1)
>> Using BlueZ 4.81
>>
>> 1. Use BlueZ to connect to two Bluetooth devices using HCI only. This
>> is over USB.
>>
>> 2. I set one device as a slave and then create a connection between
>> the two. This completes sucessfully and can be seen on both sides.
>>
>> 3. I then try to send an acl packet with the word "hi" in it and it is
>> not received on the other side.
>
> There a utility called l2test in the bluez sources. Check if it works for you.
> Using -r in one side to listen and -s in the other side to send data. Or
> l2test -h and see all options.
>
> --
> Gustavo F. Padovan
> http://profusion.mobi
>

2011-05-11 16:47:36

by Gustavo Padovan

[permalink] [raw]
Subject: Re: HCI data payload not getting through when using BlueZ

* Eponymous - <[email protected]> [2011-05-11 09:52:28 +0100]:

> Hi,
>
> I've ran into an issue where data doesn't seem to be received by a slave device.
>
> I do the following:
>
> Using Gentoo Linux (2.6.34-gentoo-r1)
> Using BlueZ 4.81
>
> 1. Use BlueZ to connect to two Bluetooth devices using HCI only. This
> is over USB.
>
> 2. I set one device as a slave and then create a connection between
> the two. This completes sucessfully and can be seen on both sides.
>
> 3. I then try to send an acl packet with the word "hi" in it and it is
> not received on the other side.

There a utility called l2test in the bluez sources. Check if it works for you.
Using -r in one side to listen and -s in the other side to send data. Or
l2test -h and see all options.

--
Gustavo F. Padovan
http://profusion.mobi

2011-06-30 15:47:18

by Peter Hurley

[permalink] [raw]
Subject: Re: HCI data payload not getting through when using BlueZ

T24gV2VkLCAyMDExLTA2LTI5IGF0IDA2OjIyIC0wNDAwLCBFcG9ueW1vdXMgLSB3cm90ZToNCj4g
VGhhbmtzIGZvciB5b3VyIHJlcGx5IFBldGVyLg0KPiANCj4gU29ycnkgaWYgSSBjYW1lIGFjcm9z
cyBhIGJpdCBydWRlIHRoZXJlLCBpdCBpcyBqdXN0IHZlcnkgZnJ1c3RyYXRpbmcNCj4gc29tZXRp
bWVzIDopDQoNCkkgZ2V0IGl0LiBCVCBjYW4gYmUgPGFyZ2dnaGhoPi4uLg0KDQo+IFlvdSBtZW50
aW9uZWQgZW5hYmxpbmcgZGVidWcgbWVzc2FnZXMgZm9yIGJ0dXNiIGFuZCBibHVldG9vdGguIERv
IHlvdQ0KPiBieSBhbnkgY2hhbmNlIGtub3cgaG93IHRvIGRvIHRoaXM/DQoNCkkgYWx3YXlzIHJ1
biBhIGRlYnVnIGtlcm5lbC4gTXkgcmVsZXZhbnQgYnVpbGQgc2V0dGluZ3MgaW4gdGhlICJLZXJu
ZWwNCmhhY2tpbmciIHN1Ym1lbnUgYXJlOg0KIEtlcm5lbCBEZWJ1Z2dpbmcgPT4gREVCVUdfS0VS
TkVMPXkNCiBEZWJ1ZyBGaWxlc3lzdGVtID0+IERFQlVHX0ZTPXkNCiBDb21waWxlIHRoZSBrZXJu
ZWwgd2l0aCBkZWJ1ZyBpbmZvID0+IERFQlVHX0lORk89eQ0KYW5kIG1vc3QgaW1wb3J0YW50bHks
DQogRW5hYmxlIGR5bmFtaWMgcHJpbnRrKCkgc3VwcG9ydCB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SB0byBzZW5kICphbnkqIHBhY2tldC4NCg0KSWYgeW91IGNhbiBjb25maXJtIHlvdSdy
ZSBvbiBhIHJhdyBIQ0kgc29ja2V0LCBJIGNhbiBleHBsb3JlIGEgZml4IGJ1dA0KeW91J2xsIGJl
IHRoZSB0ZXN0IHN1YmplY3QgPGdyaW4+Lg0KDQpMZXQgbWUga25vdywNClBldGVyIEh1cmxleSAN
Cg0KDQo=

2011-06-29 10:22:04

by Eponymous -

[permalink] [raw]
Subject: Re: HCI data payload not getting through when using BlueZ

Thanks for your reply Peter.

Sorry if I came across a bit rude there, it is just very frustrating
sometimes :)

Ok, I managed to get l2test working from the 4.91 source using BlueZ 4.94:

./l2test -s -i 00:02:5B:00:31:27 -b 10 00:02:5B:00:31:25
l2test[30513]: Connected [imtu 672, omtu 672, flush_to 65535, mode 0,
handle 44, class 0x000000]
l2test[30513]: Sending ...

./l2test -r -i 00:02:5B:00:31:25
l2test[30498]: Waiting for connection on psm 4113 ...
l2test[30590]: Connect from 00:02:5B:00:31:27 [imtu 672, omtu 672,
flush_to 65535, mode 0, handle 44, class 0x480100]
l2test[30590]: Receiving ...
l2test[30590]: 680 bytes in 0.09 sec, 7.36 kB/s
l2test[30590]: 680 bytes in 0.08 sec, 7.82 kB/s
l2test[30590]: 680 bytes in 0.10 sec, 6.92 kB/s
l2test[30590]: 680 bytes in 0.08 sec, 7.82 kB/s
l2test[30590]: 680 bytes in 0.08 sec, 7.82 kB/s
l2test[30590]: 680 bytes in 0.08 sec, 7.82 kB/s
l2test[30590]: 680 bytes in 0.08 sec, 7.82 kB/s
l2test[30590]: 680 bytes in 0.08 sec, 7.82 kB/s
l2test[30590]: Disconnect: Success

Does this help us?

You mentioned enabling debug messages for btusb and bluetooth. Do you
by any chance know how to do this?

Thanks.


On Fri, Jun 3, 2011 at 6:35 PM, Peter Hurley <[email protected]> wrote:
> On Wed, 2011-05-11 at 04:52 -0400, Eponymous - wrote:
>> Hi,
>>
>> I've ran into an issue where data doesn't seem to be received by a slave device.
>>
>> I do the following:
>>
>> Using Gentoo Linux (2.6.34-gentoo-r1)
>> Using BlueZ 4.81
>>
>> 1. Use BlueZ to connect to two Bluetooth devices using HCI only. This
>> is over USB.
>>
>> 2. I set one device as a slave and then create a connection between
>> the two. This completes sucessfully and can be seen on both sides.
>>
>> 3. I then try to send an acl packet with the word "hi" in it and it is
>> not received on the other side.
>>
>> --------
>>
>> Doing the same thing above but:
>>
>> Using Fedora Core 5 (2.6.20-1.2320.fc5)
>> And:
>> bluez-libs-2.25-1
>> bluez-pin-0.30-2
>> bluez-utils-2.25-4
>> bluez-libs-devel-2.25-1
>> bluez-hcidump-1.30-1
>>
>> and using the same hardware - the problem doesn't happen.
>>
>> I have attached two HCI dumps, one of the Master device and one of the Slave.
>>
>> Thanks for any help you can give.
>
> Although it's not at all clear from your posts, I'm assuming that you're
> using a raw HCI socket in a user-space utility.
>
> My guess is that the btusb kernel driver is dropping your ACL packet
> without transmitting it. If you look at drivers/bluetooth/btusb.c. in
> the btusb_send_frame() function, you'll see:
>
> ? ? ? ?switch (bt_cb(skb)->pkt_type) {
> ? ? ? ? ? ? ? ?....
> ? ? ? ?case HCI_ACLDATA_PKT:
> ? ? ? ? ? ? ? ?if (!data->bulk_tx_ep || hdev->conn_hash.acl_num < 1)
> ? ? ? ? ? ? ? ? ? ? ? ?return -ENODEV;
>
> The only way that hdev->conn_hash.acl_num will be 1+ is if the
> establishment of an ACL connection went through hci_connect() with a
> connection type of ACL_LINK. This code was added when SCO support was
> added back in Aug 2008.
>
> The acl_num test (and the sco_test below it) probably should be skipped
> if the HCI device is in raw mode (assuming you sent the HCISETRAW ioctl
> to both devices).
>
> You can confirm this is happening by enabling debug messages for btusb
> and bluetooth. You shouldn't need bluez, as this is the user-space
> daemon responsible for the protocols built on L2CAP and SCO (SDP,
> RFCOMM, A2DP, etc.)
>
> On Mon, 2011-05-30 at 09:57 -0400, Eponymous - wrote:
>> Ok well this has been a complete waste of time. I guess we should just
>> ignore a potential bug then,...
>>
>> Is this project dead or something? I can't believe an entire mailing
>> list can't be bothered to even e-mail back or try and help with this.
>
> This isn't appropriate.
>
> I can understand your frustration that what you want to work doesn't,
> but since you're using a kernel interface directly, you should be
> prepared to debug that yourself.
>
> On Fri, 2011-05-13 at 08:42 -0400, Eponymous - wrote:
>> The following were executed in a root shell.
>>
>> Receive Side (Device B):
>>
>> $ ./l2test -r 00:02:5B:00:31:21
>> l2test[29219]: Waiting for connection on psm 4113 ...
>>
>> Transmit Side (Device A):
>>
>> $ ./l2test -s -b 10 00:02:5B:01:FE:DF
> ...
>>
>> Doesn't appear to work...
>
> BTW, you're using l2test wrong. With the each CSR dongle on *different
> machines*, this is supposed to look like:
>
> Receive side (device 00:02:5B:00:31:21)
> $ ./l2test -r
>
> Transmit side (device 00:02:5B:01:FE:DF)
> $ ./l2test -s -b 10 00:02:5B:00:31:21
>
> NB: the bdaddr parameter is used to indicate *to where*, not *from
> where*.
>
> Since you have both devices on the same machine, do this (in root
> shells):
>
> Receive side (device 00:02:5B:00:31:21)
> $ ./l2test -r -i 00:02:5B:00:31:21
>
> Transmit side (device 00:02:5B:01:FE:DF)
> $ ./l2test -s -i 00:02:5B:01:FE:DF -b 10 00:02:5B:00:31:21
>
> Lastly, you may want to reconsider the way you're using Bluetooth. ?If
> you can get L2CAP working on your setup (ie, if l2test works), then
> consider using RFCOMM instead. Most BT stacks are not going to let you
> program the host controller directly.
>
> Good luck,
> Peter Hurley
>
>

2011-06-03 17:35:14

by Peter Hurley

[permalink] [raw]
Subject: Re: HCI data payload not getting through when using BlueZ

T24gV2VkLCAyMDExLTA1LTExIGF0IDA0OjUyIC0wNDAwLCBFcG9ueW1vdXMgLSB3cm90ZToNCj4g
SGksDQo+IA0KPiBJJ3ZlIHJhbiBpbnRvIGFuIGlzc3VlIHdoZXJlIGRhdGEgZG9lc24ndCBzZWVt
IHRvIGJlIHJlY2VpdmVkIGJ5IGEgc2xhdmUgZGV2aWNlLg0KPiANCj4gSSBkbyB0aG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KmZyb20NCndoZXJlKi4NCg0KU2luY2Ug
eW91IGhhdmUgYm90aCBkZXZpY2VzIG9uIHRoZSBzYW1lIG1hY2hpbmUsIGRvIHRoaXMgKGluIHJv
b3QNCnNoZWxscyk6DQoNClJlY2VpdmUgc2lkZSAoZGV2aWNlIDAwOjAyOjVCOjAwOjMxOjIxKQ0K
JCAuL2wydGVzdCAtciAtaSAwMDowMjo1QjowMDozMToyMQ0KDQpUcmFuc21pdCBzaWRlIChkZXZp
Y2UgMDA6MDI6NUI6MDE6RkU6REYpDQokIC4vbDJ0ZXN0IC1zIC1pIDAwOjAyOjVCOjAxOkZFOkRG
IC1iIDEwIDAwOjAyOjVCOjAwOjMxOjIxDQoNCkxhc3RseSwgeW91IG1heSB3YW50IHRvIHJlY29u
c2lkZXIgdGhlIHdheSB5b3UncmUgdXNpbmcgQmx1ZXRvb3RoLiAgSWYNCnlvdSBjYW4gZ2V0IEwy
Q0FQIHdvcmtpbmcgb24geW91ciBzZXR1cCAoaWUsIGlmIGwydGVzdCB3b3JrcyksIHRoZW4NCmNv
bnNpZGVyIHVzaW5nIFJGQ09NTSBpbnN0ZWFkLiBNb3N0IEJUIHN0YWNrcyBhcmUgbm90IGdvaW5n
IHRvIGxldCB5b3UNCnByb2dyYW0gdGhlIGhvc3QgY29udHJvbGxlciBkaXJlY3RseS4NCg0KR29v
ZCBsdWNrLA0KUGV0ZXIgSHVybGV5DQoNCg==

2011-07-01 06:46:02

by Eponymous -

[permalink] [raw]
Subject: Re: HCI data payload not getting through when using BlueZ

Thanks for the information.

Hmm, I'm not sure what you mean about a "raw hci" socket. Could you
tell me how I can check this?

I'm using a custom program that can communicate directly to the chip
over hci using bluez as a go-between. Does this help?

Cheers.

On Thu, Jun 30, 2011 at 4:47 PM, Peter Hurley <[email protected]> wrote:
> On Wed, 2011-06-29 at 06:22 -0400, Eponymous - wrote:
>> Thanks for your reply Peter.
>>
>> Sorry if I came across a bit rude there, it is just very frustrating
>> sometimes :)
>
> I get it. BT can be <arggghhh>...
>
>> You mentioned enabling debug messages for btusb and bluetooth. Do you
>> by any chance know how to do this?
>
> I always run a debug kernel. My relevant build settings in the "Kernel
> hacking" submenu are:
> ?Kernel Debugging => DEBUG_KERNEL=y
> ?Debug Filesystem => DEBUG_FS=y
> ?Compile the kernel with debug info => DEBUG_INFO=y
> and most importantly,
> ?Enable dynamic printk() support DYNAMIC_DEBUG=y
>
> Then read the short dynamic debug howto in the kernel documentation:
> Documentation/dynamic-debug-howto.txt (there are some copies online as
> well if that's easier).
>
> Then when I want to see debug messages, I just enable those source
> files. Eg.,
> # echo -n 'file hci_core.c +p' > /sys/kernel/debug/dynamic_debug/control
> # echo -n 'file hci_conn.c +p' ...
> # echo -n 'file hci_event.c +p' ...
>
> Plus, it's easy to add your own if you suspect a particular code path.
>
> If you have more questions about this, come ask on IRC #bluez.
>
>> On Fri, Jun 3, 2011 at 6:35 PM, Peter Hurley <[email protected]> wrote:
>> > Although it's not at all clear from your posts, I'm assuming that you're
>> > using a raw HCI socket in a user-space utility.
>
> Are you using a raw HCI socket?
>
>> > My guess is that the btusb kernel driver is dropping your ACL packet
>> > without transmitting it. If you look at drivers/bluetooth/btusb.c. in
>> > the btusb_send_frame() function, you'll see:
>> >
>> > ? ? ? ?switch (bt_cb(skb)->pkt_type) {
>> > ? ? ? ? ? ? ? ?....
>> > ? ? ? ?case HCI_ACLDATA_PKT:
>> > ? ? ? ? ? ? ? ?if (!data->bulk_tx_ep || hdev->conn_hash.acl_num < 1)
>> > ? ? ? ? ? ? ? ? ? ? ? ?return -ENODEV;
>> >
>> > The only way that hdev->conn_hash.acl_num will be 1+ is if the
>> > establishment of an ACL connection went through hci_connect() with a
>> > connection type of ACL_LINK. This code was added when SCO support was
>> > added back in Aug 2008.
>
> My point here is this is probably a bug in btusb - raw HCI sockets
> should be able to send *any* packet.
>
> If you can confirm you're on a raw HCI socket, I can explore a fix but
> you'll be the test subject <grin>.
>
> Let me know,
> Peter Hurley
>
>
>