Skip to contentSkip to conversation

Bluetooth headset problems.

Bluez-devel James Courtier-Dutton 5 participants 11 messages Jul 2, 2003 – Jul 21, 2003 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hi,

I am using the hstest program to try to send and receive sound from the headset.
I can record sound, but it seems that only half the sound samples are getting through.
E.g. Through the headset microphone, I could seconds in time with my watch.
I then play the recorded sound stream.
If I play at 8000hz, My voice is at the correct pitch, but the counting is every 0.5 seconds, instead of 1 seconds. If I play at 4000hz, My voice is very low and sounds slow, but the seconds are counted at the correct speed. I conclude that the bluez sco driver is only sending us half the samples.

Can anyone help ?

I am using kernel 2.4.21-mh2 (kernel.org kernel patched with mh2 patches.) and the latest hstest etc. from bluez cvs, as of a few days ago.

Cheers
James

-------------------------------------------------------
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/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#1 lore raw

Hi,

I believe that there is a problem with the hci-usb driver. I performed some brief investigations which I posted earlier to this mailing list.

Are you using a USB device? I've used the same code and Bluetooth headset with a PC card Bluetooth adaptor and everything worked fine.

Both Bluetooth devices use the CSR chipset, but the UART one using the BCSP protocol works whereas the USB one misses half the data packets, as you suggest.

My earlier message was posted on 20th June, entitled "SCO problem with USB devices" - I'd be interested to see if your problem looks the same. I think it possibly is, from what you've posted.

I haven't yet got around to investigating the problem with the USB stack - but I have the same problem, if it helps! If you are in a rush, then PC card devices seem to work at the moment...

Regards,

Colin

-------------------------------------------------------
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/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#2 lore raw
Quoted 16 lines · Cozza

Hi,

I believe that there is a problem with the hci-usb driver. I performed some brief investigations which I posted earlier to this mailing list.

Are you using a USB device? I've used the same code and Bluetooth headset with a PC card Bluetooth adaptor and everything worked fine.

Both Bluetooth devices use the CSR chipset, but the UART one using the BCSP protocol works whereas the USB one misses half the data packets, as you suggest.

My earlier message was posted on 20th June, entitled "SCO problem with USB devices" - I'd be interested to see if your problem looks the same. I think it possibly is, from what you've posted.

Quoted 11 lines

I haven't yet got around to investigating the problem with the USB stack - but I have the same problem, if it helps! If you are in a rush, then PC card devices seem to work at the moment...

Regards,

Colin

I looked at your previous email, and it seems that we both have exactly the same problem. I will have to look into this further, because I think it is better to get usb dongles working, than just use different hardware. As you have already tried it in windows and it works, I will proceed with that assumption, as I don't have windows to test with. The "hstest" program in it's current state would never handle full duplex, but at least I can maybe get the recording working.

I am using a USB dongle. Mitsumi WML-C52APR, contains FCC ID: POOWML-C06 Relevent info from usb.

T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  7 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=e0(unk. ) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=03ee ProdID=6440 Rev= 3.09
C:* #Ifs= 3 Cfg#= 1 Atr=c0 MxPwr=200mA
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=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=82(I) 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=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=83(I) 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=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
E:  Ad=83(I) 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=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
E:  Ad=83(I) 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=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=hci_usb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=hci_usb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
I:  If#= 2 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=00 Driver=(none)

hciconfig -a hci0
hci0: Type: USB

        BD Address: 00:A0:96:1F:42:BF ACL MTU: 192:8  SCO MTU: 64:8
        UP RUNNING PSCAN ISCAN
        RX bytes:99 acl:0 sco:0 events:13 errors:0
        TX bytes:296 acl:0 sco:0 commands:12 errors:0
        Features: 0xff 0xff 0x0f 0x00
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
        Link policy: HOLD SNIFF PARK
        Link mode: SLAVE ACCEPT
        Name: 'BlueZ (0)'
        Class: 0x000100
        Service Classes: Unspecified
        Device Class: Computer, Uncategorized
        HCI Ver: 1.1 (0x1) HCI Rev: 0x135 LMP Ver: 1.1 (0x1) LMP 

Subver: 0x135
Manufacturer: Cambridge Silicon Radio (10)

hcitool info 00:0A:D9:48:00:6E
Requesting information ...
BD Address: 00:0A:D9:48:00:6E
Device Name: HBH-30
LMP Version: 1.1 (0x1) LMP Subversion: 0x8b40
Manufacturer: Ericsson Mobile Comunications (0)
Features: 0x1c 0x28 0x01 0x00
<encryption> <slot offset> <timing accuracy> <SCO link> <HV3 packets> <CVSD>

-------------------------------------------------------
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/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#3 lore raw
Quoted 16 lines · Cozza

Hi,

I believe that there is a problem with the hci-usb driver. I performed some brief investigations which I posted earlier to this mailing list.

Are you using a USB device? I've used the same code and Bluetooth headset with a PC card Bluetooth adaptor and everything worked fine.

Both Bluetooth devices use the CSR chipset, but the UART one using the BCSP protocol works whereas the USB one misses half the data packets, as you suggest.

My earlier message was posted on 20th June, entitled "SCO problem with USB devices" - I'd be interested to see if your problem looks the same. I think it possibly is, from what you've posted.

Quoted 11 lines

I haven't yet got around to investigating the problem with the USB stack - but I have the same problem, if it helps! If you are in a rush, then PC card devices seem to work at the moment...

Regards,

Colin

I have made some progress. I can now record audio from the headset without it loosing any samples. I.e. I can record 8 bit PCM at 8000hz and it sounds fine. Before it was loosing samples and recording at more like 4000hz. Once I get playback to work, I will post a patch to this list.
Cheers
James

-------------------------------------------------------
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/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#4 lore raw
Quoted 29 lines · James Courtier-Dutton
Quoted 16 lines · Cozza

Hi,

I believe that there is a problem with the hci-usb driver. I performed some brief investigations which I posted earlier to this mailing list.

Are you using a USB device? I've used the same code and Bluetooth headset with a PC card Bluetooth adaptor and everything worked fine.

Both Bluetooth devices use the CSR chipset, but the UART one using the BCSP protocol works whereas the USB one misses half the data packets, as you suggest.

My earlier message was posted on 20th June, entitled "SCO problem with USB devices" - I'd be interested to see if your problem looks the same. I think it possibly is, from what you've posted.

Quoted 11 lines

I haven't yet got around to investigating the problem with the USB stack - but I have the same problem, if it helps! If you are in a rush, then PC card devices seem to work at the moment...

Regards,

Colin

Quoted 6 lines

I have made some progress. I can now record audio from the headset without it loosing any samples. I.e. I can record 8 bit PCM at 8000hz and it sounds fine. Before it was loosing samples and recording at more like 4000hz. Once I get playback to work, I will post a patch to this list.
Cheers
James

If anyone is interested, the fix for recording required 2 urbs for each isoc connection. The current cvs only uses 1 urb for isoc connections, so the usbcore fills one urb in real time, and then when it is full, sends it to hci_usb.c via a callback. Once hci_usb.c has finished with the urb it sends it back to the usbcore to get refilled. The problem is that while hci_usb.c is processing the urb, usbcore has no urb to put real time audio samples in, so it just drops them. If 2 urbs are used, if hci_usb.c is processing one, usbcore always has another to place samples in. As long as hci_usb.c does not hold on to it's urb for too long, all is ok. This fix was discovered by comparing the alsa snd-usb-audio driver with the hci_usb.c driver. I hope to get playback working soon.

Cheers
James

-------------------------------------------------------
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/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#5 lore raw

Hi James,

Quoted 11 lines

If anyone is interested, the fix for recording required 2 urbs for each isoc connection. The current cvs only uses 1 urb for isoc connections, so the usbcore fills one urb in real time, and then when it is full, sends it to hci_usb.c via a callback. Once hci_usb.c has finished with the urb it sends it back to the usbcore to get refilled. The problem is that while hci_usb.c is processing the urb, usbcore has no urb to put real time audio samples in, so it just drops them. If 2 urbs are used, if hci_usb.c is processing one, usbcore always has another to place samples in. As long as hci_usb.c does not hold on to it's urb for too long, all is ok. This fix was discovered by comparing the alsa snd-usb-audio driver with the hci_usb.c driver.

this sounds reasonable to me. Currently I have replaced the ZERO_PACKET compile option with a module parameter, which allows you to change this easily at runtime. I will push this together with a new driver for a non H2 compatible USB device.

It is also a good idea to remove the SCO compile option, because it is not really needed and we can safely enable SCO for all H2 devies with ISOC endpoints. If you are working on a patch for full SCO support, please take care of this.

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/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#6 lore raw
Quoted 11 lines · Marcel Holtmann

Hi James,

Quoted 1 line

If anyone is interested, the fix for recording required 2 urbs for each isoc connection. The current cvs only uses 1 urb for isoc connections, so the usbcore fills one urb in real time, and then when it is full, sends it to hci_usb.c via a callback. Once hci_usb.c has finished with the urb it sends it back to the usbcore to get refilled. The problem is that while hci_usb.c is processing the urb, usbcore has no urb to put real time audio samples in, so it just drops them. If 2 urbs are used, if hci_usb.c is processing one, usbcore always has another to place samples in. As long as hci_usb.c does not hold on to it's urb for too long, all is ok. This fix was discovered by comparing the alsa snd-usb-audio driver with the hci_usb.c driver.

this sounds reasonable to me. Currently I have replaced the ZERO_PACKET compile option with a module parameter, which allows you to change this easily at runtime. I will push this together with a new driver for a non H2 compatible USB device.

Quoted 10 lines

It is also a good idea to remove the SCO compile option, because it is not really needed and we can safely enable SCO for all H2 devies with ISOC endpoints. If you are working on a patch for full SCO support, please take care of this.

Regards

Marcel

I would prefer it if you would take care of the things you are suggesting. I am still quite far from providing a patch, because I cannot get playback to work(only recording works). I would prefer to stay focused on getting the playback working, rather than get diverted to changing compile options and the like.

Question: Has anyone got a bluetooth headset working with the hstest bluez tool and playing sound out of the headset speakers ? I just want to double check that this is just a usb problem still.

Cheers
James

#7 lore raw

Hi James,

Quoted 5 lines

I would prefer it if you would take care of the things you are suggesting. I am still quite far from providing a patch, because I cannot get playback to work(only recording works). I would prefer to stay focused on getting the playback working, rather than get diverted to changing compile options and the like.

no problem. If you get it working, I will do the rest.

Quoted 3 lines

Question: Has anyone got a bluetooth headset working with the hstest bluez tool and playing sound out of the headset speakers ? I just want to double check that this is just a usb problem still.

A long time ago I got playback with the Xircom Credit Card and the 3Com Bluetooth Card 2.0.

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/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#8 lore raw

Hi,

Sorry for not replying earlier!

I managed to get a TDK Bluetooth PC Card working successfully for both record and playback with the headset.

This has a Bluecore chip too - I used the same hstest code and the same kernel code. For this reason I suspect that the problem is with the USB driver. Everything was the same in the working and non working versions, except the PC card worked and the USB didn't. There was a minor variation in the Bluecore firmware on the cards, but the USB device works successfully under windows, so I don't think this is the issue.

If you like, you could mail me your modified driver and I'll see if I have any luck recording with it. I have a working headset and code, so that might be one less unknown if that is any use.

The 'running out of urb' problem you found sounds feasible. I printed out the USB spec but have never quite got around to reading it yet :-(

Incidentally, the TDK Bluetooth card doesn't work with bluez by default - I ended up patching the Linux PCMCIA Serial driver (serial_cs.o) in order to make it work with Bluez. Once it has recognised the card, just treat the card as a BCSP based device on the appropriate serial port using hciattach.

I shall investigate how to send a patch for the serial_cs driver and then support for this card can be added into the latest Kernel.

Regards,

Colin

Quoted 3 lines
Quoted 3 lines

Question: Has anyone got a bluetooth headset working with the hstest bluez tool and playing sound out of the headset speakers ? I just want to double check that this is just a usb problem still.

#9 lore raw
Quoted 3 lines · Cozza

Incidentally, the TDK Bluetooth card doesn't work with bluez by default - I ended up patching the Linux PCMCIA Serial driver (serial_cs.o) in order to make it work with Bluez.

Can you elaborate? Does the 2.5 kernel work?

Signature · 1 line
dwmw2
#10 lore raw
In reply to James Courtier-Dutton
Quoted 5 lines · James Courtier-Dutton
Quoted 4 lines

I have made some progress. I can now record audio from the headset without it loosing any samples. I.e. I can record 8 bit PCM at 8000hz and it sounds fine. Before it was loosing samples and recording at more like 4000hz. Once I get playback to work, I will post a patch to this list.
Cheers
James

If anyone is interested, the fix for recording required 2 urbs for each isoc connection. The current cvs only uses 1 urb for isoc connections, so the usbcore fills one urb in real time, and then when it is full, sends it to hci_usb.c via a callback. Once hci_usb.c has finished with the urb it sends it back to the usbcore to get refilled. The problem is that while hci_usb.c is processing the urb, usbcore has no urb to put real time audio samples in, so it just drops them. If 2 urbs are used, if hci_usb.c is processing one, usbcore always has another to place samples in. As long as hci_usb.c does not hold on to it's urb for too long, all is ok. This fix was discovered by comparing the alsa snd-usb-audio driver with the hci_usb.c driver.

Make sense.
So basically you're saying that you're just calling hci_usb_isoc_rx_submit() twice during open, right ? ie just like hci_usb_bulk_rx_submit() is called multiple times.

Max

-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel