2003-08-04 11:40:51

by Riikka Jylhä

[permalink] [raw]
Subject: [Bluez-users] USB-drivers

Hi,

I've read through bluez users and developers mailing-lists and it seems
that there are problems with usb-sco driver. Are problems completely
solved or if I'm planning on using sco with my Bluetooth usb dongle
should I consider twice? My experiments have not succeeded at all but
I'm still planning on trying with mh2 patch for 2.4.21. Are other
drivers and devices more recommendable and working better with voice?

--
Riikka Jylh=E4




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users


2003-08-06 11:18:59

by Marcel Holtmann

[permalink] [raw]
Subject: RE: [Bluez-users] USB-drivers

Hi Riikka,

> Replying myself as more testing was done. I converted a .wav-file into
> .sb and hsplaying that sounds like the original sound but slowed. Voice
> is lower than the original and the quality is not very good. Commands I
> used: "sox sound1.wav sound1.sb" and "./hstest play sound1.sb
> xx:xx:xx:xx:xx 7"
>
> If I try to convert sound to 8 bit with command "sox sound1.wav -b
> sound1.sb" result is noise. I don't know if it's a bluez problem anymore
> but I thought someone might know what the problem is.
>
> I'm using voice setting 0x0040. Should I use the default setting with
> sox:ed file? The problem is I can't listen to the .sb-file before it is
> sent cause no audio player recognizes the format. Ideas?

man play

BTW the hard coded voice setting of 0x0040 in hstest can be ignored, if
you now what you are doing. If it is set to 0x0060 (default) the audio
file must be converted to .sw and hci_usb driver must use ISOC alternate
setting 2. I am working on a new version of hstest which calls sox by
itself with the correct params according to the current voice setting.

Regards

Marcel




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2003-08-06 07:13:43

by Riikka Jylhä

[permalink] [raw]
Subject: RE: [Bluez-users] USB-drivers

Replying myself as more testing was done. I converted a .wav-file into
.sb and hsplaying that sounds like the original sound but slowed. Voice
is lower than the original and the quality is not very good. Commands I
used: "sox sound1.wav sound1.sb" and "./hstest play sound1.sb
xx:xx:xx:xx:xx 7"

If I try to convert sound to 8 bit with command "sox sound1.wav -b
sound1.sb" result is noise. I don't know if it's a bluez problem anymore
but I thought someone might know what the problem is.=20

I'm using voice setting 0x0040. Should I use the default setting with
sox:ed file? The problem is I can't listen to the .sb-file before it is
sent cause no audio player recognizes the format. Ideas?

--
Riikka Jylh=E4

-----Original Message-----
> Hi,
>
> > it is also not in 2.4.21-mh3, because it is not the complete
solution.
> You > can see it as a quick hack to make it working, but you have to
> apply it by > yourself. The patch sent by Jonathan Paisley makes it
> working for voice > > setting 0x0040 (8 bit). If you want to use the
> default setting 0x0060 (16 > bit) you have to use ISOC alternate
setting
> 2 which is indicated by packet > size 17.
>
> I applied the patch, or actually wrote to the few files myself because
> there were problems with patching. Now using the new better kernel and
> trying to send audio files to my headset (actually Windows PC acting
as
> a headset) with hstest. Voice setting is set to 0x0040 as it's
supposed
> to be. Now soxing audio file:
>
> sox sound.wav -t raw -r 8000 -c 1 -s -b 8bit_sound.wav
> (last option not being -w as in Marcels example below because of the
> 0x0040)
>=20
> and playing it:
>=20
> ./hstest play 8bit_sound.wav xx:xx:xx:xx:xx 7=20
>=20
> I call it progress that I hear something but it's just noise. Trying
> with some .au-file output is not noise but it certainly isn't the
> original sound.
>=20
> Am I using wrong kind of inputs or is the voice setting supposed to be
> 0x0060 instead of 0x0040 as the hstest wants it to be?=20
>=20
> > If you want to use the default setting 0x0060 (16 bit) you have to
use
> > ISOC alternate setting 2 which is indicated by packet size 17.
>=20
> If I want to use this default voice setting do I have to change the
> kernel code again? Is the right correction changing MaxPacketSize to
17
> instead of 9 as shown in the part of patch below?
>=20
> ...
> @@ -830,7 +831,7 @@
> =20
> #ifdef CONFIG_BLUEZ_USB_SCO
> case USB_ENDPOINT_XFER_ISOC:
> -if (ep->wMaxPacketSize < size)
> +if (ep->wMaxPacketSize !=3D 9) <--- in 0x0060 9 is changed to 17?
> break;
> size =3D ep->wMaxPacketSize;
> ...
>=20
>=20
> > I use the following command to convert the raw data from a player
> > program like mpg123 into the needed format for SCO input (0x0060)
> >
> > sox -t raw -r 44100 -c 2 -s -w - -t raw -r 8000 -c 1 -s -w -
> >
> > And I can hear MP3's over a Bluetooth headset and the quality is
good
> ;)
> >
> > Regards
> >
> > Marcel
>=20
> --
> Riikka Jylh=E4
>=20
>=20





-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2003-08-05 12:38:46

by Riikka Jylhä

[permalink] [raw]
Subject: RE: [Bluez-users] USB-drivers

Hi,

> it is also not in 2.4.21-mh3, because it is not the complete solution.
You > can see it as a quick hack to make it working, but you have to
apply it by > yourself. The patch sent by Jonathan Paisley makes it
working for voice > > setting 0x0040 (8 bit). If you want to use the
default setting 0x0060 (16 > bit) you have to use ISOC alternate setting
2 which is indicated by packet > size 17.

I applied the patch, or actually wrote to the few files myself because
there were problems with patching. Now using the new better kernel and
trying to send audio files to my headset (actually Windows PC acting as
a headset) with hstest. Voice setting is set to 0x0040 as it's supposed
to be. Now soxing audio file:

sox sound.wav -t raw -r 8000 -c 1 -s -b 8bit_sound.wav
(last option not being -w as in Marcels example below because of the
0x0040)

and playing it:

./hstest play 8bit_sound.wav xx:xx:xx:xx:xx 7=20

I call it progress that I hear something but it's just noise. Trying
with some .au-file output is not noise but it certainly isn't the
original sound.

Am I using wrong kind of inputs or is the voice setting supposed to be
0x0060 instead of 0x0040 as the hstest wants it to be?=20

> If you want to use the default setting 0x0060 (16 bit) you have to use
> ISOC alternate setting 2 which is indicated by packet size 17.

If I want to use this default voice setting do I have to change the
kernel code again? Is the right correction changing MaxPacketSize to 17
instead of 9 as shown in the part of patch below?

...
@@ -830,7 +831,7 @@
=20
#ifdef CONFIG_BLUEZ_USB_SCO
case USB_ENDPOINT_XFER_ISOC:
-if (ep->wMaxPacketSize < size)
+if (ep->wMaxPacketSize !=3D 9) <--- in 0x0060 9 is changed to 17?
break;
size =3D ep->wMaxPacketSize;
...


> I use the following command to convert the raw data from a player
> program like mpg123 into the needed format for SCO input (0x0060)
>
> sox -t raw -r 44100 -c 2 -s -w - -t raw -r 8000 -c 1 -s -w -
>
> And I can hear MP3's over a Bluetooth headset and the quality is good
;)
>
> Regards
>
> Marcel

--
Riikka Jylh=E4

2003-08-04 14:28:50

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] USB-drivers

Hi Steven,

> > My CSR dongles only support linear PCM (2's complement) with 8 or 16 bit
> > for input. See output of "hciconfig hci0 voice".
>
> That shouldn't be the whole truth. The full list should be:
>
> Linear:
> 16 bit with up to 7 MSBs ignored, or 8 bit
> 1's complement, 2's complement or sign-magnitude
> Logarithmic:
> 8 bit u-law or A-law

you are right. I made a mistake in encoding the voice setting value and
assumed that u-law and A-law are not allowed for input.

> The sample rate is fixed at 8 kHz (as defined by the Bluetooth spec).
>
> I wouldn't recommend sending mp3s over a SCO link. Wavs should be
> fine provided they're resampled at 8 kHz, you set the voice setting
> to the appropriate data format, you skip the header and you get the
> rate matching right.

I use the following command to convert the raw data from a player
program like mpg123 into the needed format for SCO input (0x0060)

sox -t raw -r 44100 -c 2 -s -w - -t raw -r 8000 -c 1 -s -w -

And I can hear MP3's over a Bluetooth headset and the quality is good ;)

Do anyone have easy C code for resampling to 8 KHz or converting to PCM,
u-law or A-law? Or do anyone know a good C library for this job?

Regards

Marcel




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2003-08-04 13:28:29

by Steven Singer

[permalink] [raw]
Subject: Re: [Bluez-users] USB-drivers

Marcel Holtmann wrote:
> My CSR dongles only support linear PCM (2's complement) with 8 or 16 bit
> for input. See output of "hciconfig hci0 voice".

That shouldn't be the whole truth. The full list should be:

Linear:
16 bit with up to 7 MSBs ignored, or 8 bit
1's complement, 2's complement or sign-magnitude
Logarithmic:
8 bit u-law or A-law

That's the full set of host formats allowed by the BT 1.1 HCI spec.

The sample rate is fixed at 8 kHz (as defined by the Bluetooth spec).

I wouldn't recommend sending mp3s over a SCO link. Wavs should be
fine provided they're resampled at 8 kHz, you set the voice setting
to the appropriate data format, you skip the header and you get the
rate matching right.

(Anyone else reading this thread, particularly in the archive, should
look at the thread Rikka started called "About Scotest" for several
important caveats from me about SCO data).

- Steven
--



**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material.
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is
prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.
**********************************************************************

2003-08-04 12:56:04

by Marcel Holtmann

[permalink] [raw]
Subject: RE: [Bluez-users] USB-drivers

Hi Riikka,

> > You need to apply a patch for using two ISOC URB's
> > per TX and RX path.
>
> Is this included in patch-2.4.21-mh2.gz. There is "Quirk for devices
> with no ISOC endpoints" at the Changelog. There is ISOC mentioned but is
> this the right patch or do I have to use the one I remember sawing
> somewhere in the bluez-developers mail-archive?

it is also not in 2.4.21-mh3, because it is not the complete solution.
You can see it as a quick hack to make it working, but you have to apply
it by yourself. The patch sent by Jonathan Paisley makes it working for
voice setting 0x0040 (8 bit). If you want to use the default setting
0x0060 (16 bit) you have to use ISOC alternate setting 2 which is
indicated by packet size 17.

The quirk you mention and which can be found in 2.4.21-mh2 is only for
the buggy USB Bluetooth devices that have no ISOC interface. This is not
allowed by the H:2 specification, but some manufacturers are unable to
read such documents.

> What audio formats are supported? Am I able to send .wav and .mp3
> sounds?

My CSR dongles only support linear PCM (2's complement) with 8 or 16 bit
for input. See output of "hciconfig hci0 voice".

Regards

Marcel




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2003-08-04 12:41:15

by Riikka Jylhä

[permalink] [raw]
Subject: RE: [Bluez-users] USB-drivers

Thanks for your reply,

-----Original Message-----
> You need to apply a patch for using two ISOC URB's
> per TX and RX path.=20

Is this included in patch-2.4.21-mh2.gz. There is "Quirk for devices
with no ISOC endpoints" at the Changelog. There is ISOC mentioned but is
this the right patch or do I have to use the one I remember sawing
somewhere in the bluez-developers mail-archive?

> And the alternate configuration for the ISOC
> interface must be set correctly according to the voice setting.

How do I do that?

> At the moment this is only tested with CSR dongles, but I can play and
> record audio data with my headset in 8 and 16 bit quality. And it
seems
> that the BlueCore02 produces better audio than the BlueCore01b.

What audio formats are supported? Am I able to send .wav and .mp3
sounds?


> Using an UART based device is mostly no option, because the bandwith
is
> not enough for sending SCO packets over the HCI link. But it is
working
> with the 3Com and Xircom PCMCIA cards.

.. poor me only having TDK and Socket PCMCIA cards

> Regards
>
> Marcel

--
Riikka Jylh=E4

2003-08-04 12:15:15

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] USB-drivers

Hi Riikka,

> I've read through bluez users and developers mailing-lists and it seems
> that there are problems with usb-sco driver. Are problems completely
> solved or if I'm planning on using sco with my Bluetooth usb dongle
> should I consider twice? My experiments have not succeeded at all but
> I'm still planning on trying with mh2 patch for 2.4.21. Are other
> drivers and devices more recommendable and working better with voice?

you can use hci_usb driver for SCO voice transmission, but you can't use
it out-of-the-box. You need to apply a patch for using two ISOC URB's
per TX and RX path. And the alternate configuration for the ISOC
interface must be set correctly according to the voice setting.

At the moment this is only tested with CSR dongles, but I can play and
record audio data with my headset in 8 and 16 bit quality. And it seems
that the BlueCore02 produces better audio than the BlueCore01b.

Using an UART based device is mostly no option, because the bandwith is
not enough for sending SCO packets over the HCI link. But it is working
with the 3Com and Xircom PCMCIA cards.

Regards

Marcel




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users