2006-06-19 19:56:06

by Christoph Lukas

[permalink] [raw]
Subject: [Bluez-users] Slow connection to Motorola H500 Headset

Hi,

I am trying to use my Motorola Headset H500 as a bluetooth audio
device.

Audio transfer is working perfectly in both directions, the only minor
annoyance is that it takes several seconds for every connection to be
established.
This makes it difficult to use the headset as an audio device for VoIP
as there is a gap of up to 5 seconds between pressing 'accept call' and
an established audio connection.

These connection delays also happen with using a simple:

aplay -D plughw:Headset soundfile.wav

I am running Ubuntu Dapper with kernel 2.6.15, bluez-utils 2.24,
snd-bt-sco 1.11 and btsco v0.42.

btsco -v <addr> shows:

btsco v0.42
Device is 1:0
Voice setting: 0x0060
RFCOMM channel 2 connected
Using interface hci0
recieved AT+BRSF=26
speaker volume: 7 mic volume: 1
i/o needed: connecting sco...
<several seconds here>
connected SCO channel
Done setting sco fd
recieved AT+VGS=07
Sending up speaker change 7
speaker volume: 7 mic volume: 1
driver is not in use
disconnected SCO channel


and hcidump -t shows:

1150745951.394107 < HCI Command: Add SCO Connection (0x01|0x0007) plen 4
1150745951.399620 > HCI Event: Command Status (0x0f) plen 4
1150745956.366798 > HCI Event: Connect Complete (0x03) plen 11
1150745956.389809 > SCO data: handle 41 dlen 48
1150745956.389813 > SCO data: handle 41 dlen 48
1150745956.389818 > SCO data: handle 41 dlen 48
1150745956.389888 < SCO data: handle 41 dlen 48
1150745956.389912 < SCO data: handle 41 dlen 48
1150745956.389930 < SCO data: handle 41 dlen 48


Can I do anything to avoid these delays?

Thanks for any hints.

Regards,
Christoph




_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users


2006-06-19 20:44:45

by Brad Midgley

[permalink] [raw]
Subject: Re: [Bluez-users] Slow connection to Motorola H500 Headset

Christoph

> Audio transfer is working perfectly in both directions, the only minor
> annoyance is that it takes several seconds for every connection to be
> established.

maybe the headset is parking itself between connections. I don't know
much about what can be done to influence its policy though.

you could start up hcidump before you bring up the headset and tell us
what the dump looks like at the start. we might be able to tell what
slows things down.

Brad



_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2006-07-07 20:19:25

by Ulisses Furquim

[permalink] [raw]
Subject: Re: [Bluez-users] Slow connection to Motorola H500 Headset

Hi Christoph,

> Does entering the sniff mode even save power on the notebooks bluetooth
> device?

Yes, it should save power but the sniff mode is more important in
small devices like mobile phones, keyboards, mice, and so on.

> Do you know any possibility to force a smaller sniff interval for this
> device? Something like 250 msec instead of 2.5 sec? That would probably
> be the best solution.

You can try the automatic sniff mode feature that probably is going to
be on Linux kernel 2.6.18 (and it's also present on Marcel Holtmann's
-mh patches). It sniffs the connection after a period of inactivity
and it uses a sniff interval of 500 milliseconds. You can specify the
period of inactivity after which the connection must be sniffed with:

# echo 6000 > /sys/class/bluetooth/hci0/idle_timeout

This would make an idle ACL connection go to sniff mode after 6
seconds. You can disable this feature (if you need to) with:

# echo 0 > /sys/class/bluetooth/hci0/idle_timeout

You can play with this idle timeout sysfs entry and see if things get
better for you. :-)

Best regards,

-- Ulisses

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2006-07-07 18:07:26

by Christoph Lukas

[permalink] [raw]
Subject: Re: [Bluez-users] Slow connection to Motorola H500 Headset

Hi Ulisses,

> > Are there any negative side effect of disabling sniff mode?
>
> Yeah, I didn't say but you could have done just that. Though it
> disables the sniff mode for all ACL connections using the hci0 adapter
> and we usually don't want this because several devices use the sniff
> mode to save battery. Thus the negative side effect you might notice
> is that your devices will probably run out of battery much earlier
> than before.

Does entering the sniff mode even save power on the notebooks bluetooth
device?

> FWIW, I think that your headset doesn't make use of sniff mode correctly.

Do you know any possibility to force a smaller sniff interval for this
device? Something like 250 msec instead of 2.5 sec? That would probably
be the best solution.

Thanks a lot for your help,
Christoph


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2006-07-07 17:14:46

by Ulisses Furquim

[permalink] [raw]
Subject: Re: [Bluez-users] Slow connection to Motorola H500 Headset

On 7/7/06, Christoph Lukas <[email protected]> wrote:

Hi Christoph,

> In a first try I have used hciconfig to disable sniff mode completely on
> hci0:
>
> hciconfig hci0 lp RSWITCH,HOLD,PARK
>
> This made my headset working perfectly!
>
> You are my hero!
>
> Are there any negative side effect of disabling sniff mode?

Yeah, I didn't say but you could have done just that. Though it
disables the sniff mode for all ACL connections using the hci0 adapter
and we usually don't want this because several devices use the sniff
mode to save battery. Thus the negative side effect you might notice
is that your devices will probably run out of battery much earlier
than before.

FWIW, I think that your headset doesn't make use of sniff mode correctly.

> Is it needed for some devices?

I really don't know if the sniff mode is mandatory for some devices,
but I do know that some keyboards/mice like to be in sniff mode all
the time.

Best regards,

-- Ulisses

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2006-07-07 15:48:24

by Christoph Lukas

[permalink] [raw]
Subject: Re: [Bluez-users] Slow connection to Motorola H500 Headset

Hi Ulisses,

thanks for your reply.

> > can anybody tell me what this 'HCI Event: Mode Change (0x14) plen 6' is
> > about and probably how to prevent this?
> > A full hcidump from pairing the headset and starting btsco is attached.
>
> First of all, hcidump produce better output when you use -X and -V switches. :-)

Ah, thanks. That would have made it easier.

> Well, this mode change event is turning the connection to sniff mode,
> probably to save some power. And according to your dump the command to
> change the connection mode was sent by your headset. Looking closer we
> can see that the interval between two sniff anchor points is 4096
> baseband slots that give us 2.56 seconds! This really seems to be
> overkill and it's probably causing the delay you're experiencing.

Ok. That sounds reasonable.

> I don't think there's something you can do to avoid this. btsco could
> change the link policy settings to remove sniff mode, but this would
> require root privileges and I really don't think btsco shoud do that.
> Marcel, am I right or is there anything that might be done and I don't
> know?

In a first try I have used hciconfig to disable sniff mode completely on
hci0:

hciconfig hci0 lp RSWITCH,HOLD,PARK

This made my headset working perfectly!

You are my hero!

Are there any negative side effect of disabling sniff mode? Is it needed
for some devices?

Thanks a lot,
Christoph



Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2006-07-07 14:44:36

by Ulisses Furquim

[permalink] [raw]
Subject: Re: [Bluez-users] Slow connection to Motorola H500 Headset

Hi Christoph,

> can anybody tell me what this 'HCI Event: Mode Change (0x14) plen 6' is
> about and probably how to prevent this?
> A full hcidump from pairing the headset and starting btsco is attached.

First of all, hcidump produce better output when you use -X and -V switches. :-)

Well, this mode change event is turning the connection to sniff mode,
probably to save some power. And according to your dump the command to
change the connection mode was sent by your headset. Looking closer we
can see that the interval between two sniff anchor points is 4096
baseband slots that give us 2.56 seconds! This really seems to be
overkill and it's probably causing the delay you're experiencing.

I don't think there's something you can do to avoid this. btsco could
change the link policy settings to remove sniff mode, but this would
require root privileges and I really don't think btsco shoud do that.
Marcel, am I right or is there anything that might be done and I don't
know?

Best regards,

-- Ulisses

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users