2006-03-18 17:00:27

by Fabien Chevalier

[permalink] [raw]
Subject: [Bluez-devel] Kernel panic with SCO socket - Debian kernel 2.6.15-8


Hi all,

I'm currently playing with a bluetooth dongle and a Motorola HS810 headset.

I wrote a sample program that mimics the establishment of a Headset
Profile like connection.
For now it just waits for user input, then sends the content of a PCM
file over the SCO socket.

The thing basically works... exect after 1or 2 minutes playback, the
program suddenly exits.
Then i just have a few seconds left and *bang* . Kernel Panic :-(

The issue is 100% reproductible on my configuration :-(.

I attached the source of the program that makes my Linux crash... would
eventually anybody have any idea of what goes wrong ??

Tip : here is the command line i use to start this program:
./hsplay 00:07:A4:4D:02:14 1 fallen-8kHz.wav 0

I also noticed that it crashes a lot faster when last parameter is 0...

Cheers,

Fabien



Attachments:
hsplay.c (3.09 kB)

2006-03-19 11:16:33

by Fabien Chevalier

[permalink] [raw]
Subject: Re: [Bluez-devel] Kernel panic with SCO socket - Debian kernel 2.6.15-8


>Hehe, I recently did something similar (in Python, though) ...
>
>
>
Good to now i'm not alone playing with SCOs !!

>>The thing basically works... exect after 1or 2 minutes playback, the
>>program suddenly exits.
>>Then i just have a few seconds left and *bang* . Kernel Panic :-(
>>
>>
>
>... and had similar results. Just look at the memory consumption when
>this happens. Apparently all incoming SCO data is buffered in kernel
>memory for you to read, so you *must* read it, even if you only ever
>intend to send data.
>
>I'd also suggest you simply use select() to wait for incoming data and
>then only send something when you received (and read!) something. This
>nicely gives the right timing without guessing the delay parameter.
>
>
>
Quite interesting is the way you solved the issue :-)
I'm gonna give a try to this select way of things :-)
By the way i just ran another test using hsplay. I basically send a SCO
packet every second,
which is obviously not enough to sustain the SCO packet flow.
Using hcidump i am able to see the SCO flow coming from the Headset.
... and no crash at all :-)

Which for me basically means that the bug is somewhere on the
PC-->Heaset flow, where something must be handled the wrong way...

Cheers,

Fabien

2006-03-18 19:12:20

by Henryk Plötz

[permalink] [raw]
Subject: Re: [Bluez-devel] Kernel panic with SCO socket - Debian kernel 2.6.15-8

Moin,

Am Sat, 18 Mar 2006 18:00:27 +0100 schrieb Fabien Chevalier -:

> I wrote a sample program that mimics the establishment of a Headset
> Profile like connection.

Hehe, I recently did something similar (in Python, though) ...

> The thing basically works... exect after 1or 2 minutes playback, the
> program suddenly exits.
> Then i just have a few seconds left and *bang* . Kernel Panic :-(

... and had similar results. Just look at the memory consumption when
this happens. Apparently all incoming SCO data is buffered in kernel
memory for you to read, so you *must* read it, even if you only ever
intend to send data.

I'd also suggest you simply use select() to wait for incoming data and
then only send something when you received (and read!) something. This
nicely gives the right timing without guessing the delay parameter.


For reference I've attached my headset emulator (to be used with
pybluez): It discards incoming audio and sends a pure sine wave.
--
Henryk Pl?tz
Gr??e aus Berlin
~~~~~~~ Un-CDs, nein danke! http://www.heise.de/ct/cd-register/ ~~~~~~~
~ Help Microsoft fight software piracy: Give Linux to a friend today! ~


Attachments:
(No filename) (1.12 kB)
headset.py (6.52 kB)
(No filename) (191.00 B)
Download all attachments