All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [Bluez-users] headset connection works only one time
@ 2008-04-13 14:39 Michael Domann
  2008-04-13 20:29 ` Michael Domann
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Domann @ 2008-04-13 14:39 UTC (permalink / raw
  To: bluez-users@lists.sourceforge.net

hi list,

with the 3.30 release my headset works (tanks for this). its a jabra bt135. the sound quality is low, but this is possible to get better with an different option. how can i see which is the best way to connect to my headset?

sysiphus:/home/profbunny# hcitool cc 00:1A:45:6E:D5:23
sysiphus:/home/profbunny# hcitool inq 00:1A:45:6E:D5:23
Inquiring ...
00:1A:45:6E:D5:23       clock offset: 0x7b4c    class: 0x200404
sysiphus:/home/profbunny# hcitool info 00:1A:45:6E:D5:23
Requesting information ...
BD Address:  00:1A:45:6E:D5:23
LMP Version: 2.0 (0x3) LMP Subversion: 0x978
Manufacturer: Cambridge Silicon Radio (10)
Features: 0xfc 0xfe 0x0b 0x00 0x08 0x08 0x00 0x00
<encryption> <slot offset> <timing accuracy> <role switch> 
<hold mode> <sniff mode> <RSSI> <channel quality> <SCO link> 
<HV2 packets> <HV3 packets> <u-law log> <A-law log> <CVSD> 
<paging scheme> <transparent SCO> <AFH cap. slave> 
<AFH cap. master>


The mayor problem even is, that it is one times usable, then is required to reboot.
When i sotp the call in skype for example and i wont to call another people, i can get a connection to the headset, syslog shows

Apr 10 15:21:10 sysiphus hcid[10086]: Audio API: sending BT_GETCAPABILITIES_RSP
Apr 10 15:21:10 sysiphus hcid[10086]: Audio API: received BT_SETCONFIGURATION_REQ
Apr 10 15:21:10 sysiphus hcid[10086]: config sco - device = 00:1A:45:6E:D5:23 access_mode = 2
Apr 10 15:21:50 sysiphus hcid[10086]: connect(): Connection timed out (110)
Apr 10 15:21:50 sysiphus hcid[10086]: config failed
Apr 10 15:21:50 sysiphus hcid[10086]: Audio API: sending BT_SETCONFIGURATION_RSP
Apr 10 15:21:50 sysiphus kernel: hci_cmd_task: hci0 command tx timeout


then is impossible to get it react, stop the deamon remove the modul and load it and start the deamon don't help.

Any suggestions if i get this working?

thanks
micha

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Bluez-users] headset connection works only one time
  2008-04-13 14:39 [Bluez-users] headset connection works only one time Michael Domann
@ 2008-04-13 20:29 ` Michael Domann
  2008-04-14 10:05   ` [Bluez-users] headset produces noise almost half the time Andrea Arcangeli
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Domann @ 2008-04-13 20:29 UTC (permalink / raw
  To: bluez-users

On Sun, 13 Apr 2008 16:39:49 +0200
Michael Domann <profbunny@gmx.de> wrote:

Hi,

some addition infos:
my bluetooth dongle
hciconfig -a
hci0:   Type: USB
        BD Address: 00:13:EF:F1:44:13 ACL MTU: 120:20 SCO MTU: 64:8
        UP RUNNING PSCAN ISCAN 
        RX bytes:659 acl:0 sco:0 events:18 errors:0
        TX bytes:316 acl:0 sco:0 commands:18 errors:0
        Features: 0xff 0xff 0x05 0x38 0x18 0x18 0x00 0x00
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
        Link policy: RSWITCH HOLD SNIFF PARK 
        Link mode: SLAVE ACCEPT 
        Name: 'sysiphus-0'
        Class: 0x000000
        Service Classes: Unspecified
        Device Class: Miscellaneous, 
        HCI Ver: 1.2 (0x2) HCI Rev: 0x0 LMP Ver: 1.2 (0x2) LMP Subver: 0x757
        Manufacturer: Silicon Wave (11)


this is wrote in syslog, when the connection is ended(finished skype call):
Apr 13 22:16:13 sysiphus hcid[30958]: Audio API: sending BT_GETCAPABILITIES_RSP
Apr 13 22:16:13 sysiphus hcid[30958]: Audio API: received BT_SETCONFIGURATION_REQ
Apr 13 22:16:13 sysiphus hcid[30958]: config sco - device = 00:1A:45:6E:D5:23 access_mode = 2
Apr 13 22:16:14 sysiphus hcid[30958]: connect(): Software caused connection abort (103)
Apr 13 22:16:14 sysiphus hcid[30958]: config failed
Apr 13 22:16:14 sysiphus hcid[30958]: Audio API: sending BT_SETCONFIGURATION_RSP
Apr 13 22:16:14 sysiphus kernel: hci_scodata_packet: hci0 SCO packet for unknown connection handle 256

i think the connection is not closed correct.

any suggestions?

thanks

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bluez-users] headset produces noise almost half the time
  2008-04-13 20:29 ` Michael Domann
@ 2008-04-14 10:05   ` Andrea Arcangeli
  2008-04-21  1:09     ` [Bluez-users] howto wep 500 Andrea Arcangeli
  0 siblings, 1 reply; 4+ messages in thread
From: Andrea Arcangeli @ 2008-04-14 10:05 UTC (permalink / raw
  To: BlueZ users

Hello,

I've a similar problem to the connection only working the first
time. My headset half the time generates a terrible noise. Either
during recording or during playback. It sounds like the two bytes of
the S16_LE format have been swapped. This race triggers during the
opening of the bluetooth device. If it doesn't connect wrong, it works
fine as long as I don't close the bluetooth alsa device.

This is reproducible with only arecord, only with aplay, with
arecord|aplay, skype, twinkle, amarok, mplayer. Sometime the huge noise is
generated by recording and playback is fine. Sometime it's generated
by playback and recording is fine.

I'm using bluez-utils/libs 3.30 and alsa 1.0.14a and kernel 2.6.24 but
I tried a recent 2.6.25 and it didn't help.

So far I found a severe bug that seem to be also why plug:bluetooth
only works with amarok. This is a bug reported to the mailing list as
well. This also makes the bluetooth usable with mplayer by moving back
and forth in the movie, without the fix it's pretty unusable.

Signed-off-by: Andrea Arcangeli <andrea@qumranet.com>

diff -ur bluez-utils-3.30/audio/pcm_bluetooth.c /var/tmp/portage/net-wireless/bluez-utils-3.30/work/bluez-utils-3.30/audio/pcm_bluetooth.c
--- bluez-utils-3.30/audio/pcm_bluetooth.c	2008-04-14 04:03:03.000000000 +0200
+++ /var/tmp/portage/net-wireless/bluez-utils-3.30/work/bluez-utils-3.30/audio/pcm_bluetooth.c	2008-04-14 04:29:14.000000000 +0200
@@ -462,7 +462,9 @@
 	}
 
 	data->transport = setconf_rsp->transport;
-	data->link_mtu = setconf_rsp->link_mtu;
+	if (data->link_mtu != setconf_rsp->link_mtu)
+		SNDERR("BT_SETCONFIGURATION link_mtu ignored: %d",
+					setconf_rsp->link_mtu);
 
 	return 0;
 }
@@ -1629,10 +1631,12 @@
 		data->io.callback = stream == SND_PCM_STREAM_PLAYBACK ?
 			&bluetooth_a2dp_playback :
 			&bluetooth_a2dp_capture;
-	else
+	else {
 		data->io.callback = stream == SND_PCM_STREAM_PLAYBACK ?
 			&bluetooth_hsp_playback :
 			&bluetooth_hsp_capture;
+		data->link_mtu = 48;
+	}
 
 	err = snd_pcm_ioplug_create(&data->io, name, stream, mode);
 	if (err < 0)



This is quite an improvement, but I can't find a way to debug my race
condition that screwup the stream with an apparent off by one.

I tried to trace the difference between working and not working
scenario without much success because the packet flow isn't
deterministic. I traced both userland with DBG as well as kernel with
systemtap over bluetooth/hci_usb and the only suspect thing I seem to
have found is once a sco packet arriving in the rx_q before
hci_conn_complete_evt. So supposedly it was rejected. Not sure if this
is relevant and it didn't always happen. Sounds like packets can be
reordered or I don't see why the connection completion packet can
arrive before the sco packet.

It'd be nice if you could add delays to avoid the race. Like to
eliminate any parallelism in the code and slow it down.

Not sure which data you could be most interested about, I can produce
any data you need.

After wasting an entire weekend on this trying almost anything
(including downgrading from esco to sco connetion, tweaking alsa
ioplug parameters, buffers, etc..), I have to give it up to fix it
myself as I've too many other things to do now sorry ;).  At least I
found and fixed an unrelated bug in my debugging process.

If there's any way to use different voices than 0x0060 I'd surely like
to try. Especially I'd like to try 0x0040 where byte swapping surely
can't happen ;).

Some basic info on the hci0 I'm using for 99% of the tests:

Bus 003 Device 003: ID 413c:8126 Dell Computer Corp. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          224 Wireless
  bDeviceSubClass         1 Radio Frequency
  bDeviceProtocol         1 Bluetooth
  bMaxPacketSize0        64
  idVendor           0x413c Dell Computer Corp.
  idProduct          0x8126 
  bcdDevice            3.67
  iManufacturer           1 
  iProduct                2 
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          216
    bNumInterfaces          4
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0000  1x 0 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0000  1x 0 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0009  1x 9 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0009  1x 9 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       2
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0011  1x 17 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0011  1x 17 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       3
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       4
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       5
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       254 Application Specific Interface
      bInterfaceSubClass      1 Device Firmware Update
      bInterfaceProtocol      0 
      iInterface              0 
      ** UNRECOGNIZED:  07 21 07 88 13 40 00


hci0:   Type: USB
        BD Address: xx:xx:xx:xx:xx:xx ACL MTU: 1017:8 SCO MTU: 64:8
        UP RUNNING PSCAN 
        RX bytes:478601 acl:54 sco:9312 events:157 errors:0
        TX bytes:219430 acl:70 sco:4250 commands:76 errors:0
        Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
        Link policy: RSWITCH HOLD SNIFF PARK 
        Link mode: SLAVE ACCEPT 
        Name: 'xxx (0)'
        Class: 0x180000
        Service Classes: Capturing, Object Transfer
        Device Class: Miscellaneous, 
        HCI Ver: 2.0 (0x3) HCI Rev: 0x216f LMP Ver: 2.0 (0x3) LMP
        Subver: 0x41d8
        Manufacturer: Broadcom Corporation (15)

hci0:   Type: USB
        BD Address: xx:xx:xx:xx:xx:xx ACL MTU: 1017:8 SCO MTU: 64:8
        Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80
                <3-slot packets> <5-slot packets> <encryption> <slot offset>
                <timing accuracy> <role switch> <hold mode> <sniff mode>
                <park state> <RSSI> <channel quality> <SCO link> <HV2 packets>
                <HV3 packets> <u-law log> <A-law log> <CVSD> <paging scheme>
                <power control> <transparent SCO> <broadcast encrypt>
                <EDR ACL 2 Mbps> <EDR ACL 3 Mbps> <enhanced iscan>
                <interlaced iscan> <interlaced pscan> <inquiry with RSSI>
                <extended SCO> <EV4 packets> <EV5 packets> <AFH cap. slave>
                <AFH class. slave> <3-slot EDR ACL> <5-slot EDR ACL>
                <AFH cap. master> <AFH class. master> <EDR eSCO 2 Mbps>
                <EDR eSCO 3 Mbps> <3-slot EDR eSCO> <extended features>


Here info about the headset:

        LMP Version: 2.0 (0x3) LMP Subversion: 0x119c
        Manufacturer: Cambridge Silicon Radio (10)
        Features: 0xfc 0xfe 0x0f 0x80 0x08 0xa8 0x00 0x00
                <encryption> <slot offset> <timing accuracy> <role switch> 
                <hold mode> <sniff mode> <RSSI> <channel quality> <SCO link> 
                <HV2 packets> <HV3 packets> <u-law log> <A-law log> <CVSD> 
                <paging scheme> <power control> <transparent SCO> 
                <extended SCO> <AFH cap. slave> <AFH cap. master> 
                <EDR eSCO 2 Mbps> <3-slot EDR eSCO> 


I also tried a totally different usbdongle instead of the one embedded
in the laptop and after passing forced_socfix=1 it worked, but the
problem was exactly the same (half the time the pure noise showup). So
you definitely need to add this to the scofix bigflags:

Bus 005 Device 002: ID 050d:0131 Belkin Components 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          224 Wireless
  bDeviceSubClass         1 Radio Frequency
  bDeviceProtocol         1 Bluetooth
  bMaxPacketSize0        64
  idVendor           0x050d Belkin Components
  idProduct          0x0131 
  bcdDevice            4.12
  iManufacturer           1 
  iProduct                2 
  iSerial                 3 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          216
    bNumInterfaces          4
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0000  1x 0 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0000  1x 0 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0009  1x 9 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0009  1x 9 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       2
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0011  1x 17 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0011  1x 17 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       3
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0019  1x 25 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0019  1x 25 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       4
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0021  1x 33 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0021  1x 33 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       5
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0031  1x 49 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0031  1x 49 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       254 Application Specific Interface
      bInterfaceSubClass      1 Device Firmware Update
      bInterfaceProtocol      0 
      iInterface              0 
      ** UNRECOGNIZED:  07 21 05 88 13 40 00


hci1:   Type: USB
        BD Address: xx:xx:xx:xx:xx:xx ACL MTU: 1017:5 SCO MTU: 64:0
        UP RUNNING PSCAN 
        RX bytes:444771 acl:29 sco:8682 events:63 errors:0
        TX bytes:1063 acl:29 sco:0 commands:33 errors:0
        Features: 0xff 0xff 0x8d 0xfe 0x9b 0xf9 0x00 0x80
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
        Link policy: RSWITCH HOLD SNIFF PARK 
        Link mode: SLAVE ACCEPT 
        Name: 'xxx (1)'
        Class: 0x180100
        Service Classes: Capturing, Object Transfer
        Device Class: Computer, Uncategorized
        HCI Ver: 2.0 (0x3) HCI Rev: 0x419c LMP Ver: 2.0 (0x3) LMP Subver: 0x430e
        Manufacturer: Broadcom Corporation (15)

        BD Address: xx:xx:xx:xx:xx:xx ACL MTU: 1017:5 SCO MTU: 64:0
        Features: 0xff 0xff 0x8d 0xfe 0x9b 0xf9 0x00 0x80
                <3-slot packets> <5-slot packets> <encryption> <slot offset>
                <timing accuracy> <role switch> <hold mode> <sniff mode>
                <park state> <RSSI> <channel quality> <SCO link> <HV2 packets>
                <HV3 packets> <u-law log> <A-law log> <CVSD> <power control>
                <transparent SCO> <broadcast encrypt> <EDR ACL 2 Mbps>
                <EDR ACL 3 Mbps> <enhanced iscan> <interlaced iscan>
                <interlaced pscan> <inquiry with RSSI> <extended SCO>
                <EV4 packets> <EV5 packets> <AFH cap. slave>
                <AFH class. slave> <3-slot EDR ACL> <5-slot EDR ACL>
                <AFH cap. master> <AFH class. master> <EDR eSCO 2 Mbps>
                <EDR eSCO 3 Mbps> <3-slot EDR eSCO> <extended features>


Anything you can suggest me is welcome. Hope I'm not the only one able
to reproduce this race. The simplest way to reproduce is to run this
in a loop:

while :; do arecord -D bluetooth -f S16_LE | aplay -D bluetooth -f S16_LE; done

and then press C^c once every few seconds, eventually there will be
pure noise if you can reproduce. You can replace -D default in either
raecord or aplay and it'll still do the noise in the regular soundcard
or in your headset.

I also tried something like this and it crashed the kernel but it
should be unrelated kernel bug:

while :; do su -c "hciconfig hci0 reset"; arecord -D bluetooth -f S16_LE | aplay -D bluetooth -f S16_LE; done

Any help appreciated.
Thanks!
Andrea

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bluez-users] howto wep 500
  2008-04-14 10:05   ` [Bluez-users] headset produces noise almost half the time Andrea Arcangeli
@ 2008-04-21  1:09     ` Andrea Arcangeli
  0 siblings, 0 replies; 4+ messages in thread
From: Andrea Arcangeli @ 2008-04-21  1:09 UTC (permalink / raw
  To: BlueZ users

I didn't receive any feedback so far, so I give it a second try this
weekend.

So the S16_LE stream sometime was byte swapped (big endian format
instead of little endian, randomly). Verified with hcidump with
arecord (only fragment reassembly and usb code was involved, so it
couldn't be anything in userland, and quickly it become clear it's a
bug in the headset firmware). This always happens in all isocs
supporting 16 bit transfers (and some isocs just returns partial
garbage or a zero stream). voice 0x40 in isoc=2 also returns streams
of zeros or garbage. So I tried voice 0x40 in isoc=1 and it returns
nothing sane too.

So I figured out the phone had to be using alaw or mulaw. I thought
alaw and mulaw should work with isochronous alternative 2 too (default
of hci_usb) but it doesn't with my headset (alt 2 supports 1 16bit
channel or 2 8bit channels for two bluetooth handles in the same
isochronous endpoint).

Luckily I kept trying in all possible ways and finally I got it
working perfectly by adding to modules.d a file like this:

options hci_usb isoc=1

And adding this line at the end of /etc/init.d/bluetooth start:

        hciconfig hci0 voice 0x240

After this I had to patch bluez-utils-3.30 and to recompile it 16bit
for skype, and now skype works perfectly with my headset. I've still a
minor issue with twinkle, the capture doesn't produce crystal clear
sound. I use a-law for all my asterisk voip so in theory twinkle
should learn to forward the packets generated by the headset directly
to the network without converting them to S16_LE, but arecord |aplay
in S16_LE mode returns a fine good sound quality too through the plug
device, so even if it converts back and forth it's ok.

diff -ur bluez-utils-3.30/audio/pcm_bluetooth.c /var/tmp/portage/net-wireless/bluez-utils-3.30/work/bluez-utils-3.30/audio/pcm_bluetooth.c
--- bluez-utils-3.30/audio/pcm_bluetooth.c	2008-04-14 04:03:03.000000000 +0200
+++ /var/tmp/portage/net-wireless/bluez-utils-3.30/work/bluez-utils-3.30/audio/pcm_bluetooth.c	2008-04-20 07:35:01.000000000 +0200
@@ -462,7 +462,9 @@
 	}
 
 	data->transport = setconf_rsp->transport;
-	data->link_mtu = setconf_rsp->link_mtu;
+	if (data->link_mtu != setconf_rsp->link_mtu)
+		SNDERR("BT_SETCONFIGURATION link_mtu ignored: %d",
+					setconf_rsp->link_mtu);
 
 	return 0;
 }
@@ -1157,7 +1159,8 @@
 		SND_PCM_ACCESS_MMAP_INTERLEAVED
 	};
 	unsigned int format_list[] = {
-		SND_PCM_FORMAT_S16_LE
+		//SND_PCM_FORMAT_S16_LE
+		SND_PCM_FORMAT_A_LAW
 	};
 	int err;
 
@@ -1629,10 +1632,13 @@
 		data->io.callback = stream == SND_PCM_STREAM_PLAYBACK ?
 			&bluetooth_a2dp_playback :
 			&bluetooth_a2dp_capture;
-	else
+	else {
 		data->io.callback = stream == SND_PCM_STREAM_PLAYBACK ?
 			&bluetooth_hsp_playback :
 			&bluetooth_hsp_capture;
+		data->link_mtu = 48;
+		data->link_mtu = 24;
+	}
 
 	err = snd_pcm_ioplug_create(&data->io, name, stream, mode);
 	if (err < 0)
diff -ur bluez-utils-3.30/audio/unix.c /var/tmp/portage/net-wireless/bluez-utils-3.30/work/bluez-utils-3.30/audio/unix.c
--- bluez-utils-3.30/audio/unix.c	2008-04-03 01:01:44.000000000 +0200
+++ /var/tmp/portage/net-wireless/bluez-utils-3.30/work/bluez-utils-3.30/audio/unix.c	2008-04-20 06:12:25.000000000 +0200
@@ -285,6 +285,7 @@
 	rsp->transport  = BT_CAPABILITIES_TRANSPORT_SCO;
 	rsp->access_mode = client->access_mode;
 	rsp->link_mtu = 48;
+	rsp->link_mtu = 24;
 
 	client->data_fd = headset_get_sco_fd(dev);
 


this is my .asoundrc:

pcm.bluetooth_raw {
	type bluetooth
	device 00:02:78:29:3F:D4
	profile "voice"
}

pcm.bluetooth {
	type plug
	slave {
		pcm "bluetooth_raw"
	}
}

The patch is not ok if applied like this. My previous patch instead
should be applied as I sent it as it includes a fix for everyone. The
ideal I guess is to read the voice in the same way hciconfig does it,
and if the a-law bit or mu-law bit are set, the link_mtu should be
assumed 24 bytes instead of 48, and the alsa initialization should use
A_LAW/MU_LAW instead of S16_LE. I can't work on this until next
weekend at the earliest, so I hope somebody else will clean this up
sooner now that the problem is understood ;). I suspect asterisk
bluetooth supports also hardcodes 48 bytes and doesn't support
anything but voice 0x60, it'd be nice not to hardcode those things and
to be dynamic in function of the hciconfig setting, even better would
be to match the headset features and to autodetect it per-connection
instead of per-hci device.

My headset should work with most if not all recent cellphones, so this
also means cellphones prefers a-law/mu-law to S16_LE if supported by
the headset.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-21  1:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-13 14:39 [Bluez-users] headset connection works only one time Michael Domann
2008-04-13 20:29 ` Michael Domann
2008-04-14 10:05   ` [Bluez-users] headset produces noise almost half the time Andrea Arcangeli
2008-04-21  1:09     ` [Bluez-users] howto wep 500 Andrea Arcangeli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.