bluetooth: fix for headsets coming up with 'off' profile
authorJanos Kovacs <jankovac503@gmail.com>
Wed, 23 May 2012 18:17:37 +0000 (21:17 +0300)
committerJanos Kovacs <jankovac503@gmail.com>
Wed, 23 May 2012 18:17:37 +0000 (21:17 +0300)
commitd2f77dbe15dd01a48f7615f07ef31f8570b9e2bc
tree39fb2ac1ffe98dbdc6e21e39bec6063c9fa5af2e
parent8a27f5d3e789876a4fb76f9b53ed056a4cf47bb9
bluetooth: fix for headsets coming up with 'off' profile

Some BT headsets, eg. Sony Ericsson, the default profile is not
active and therefore PA eventually switches to the off profile.
So we end up with aBT card with no sinks/sources. The switchoff
happens between card hook firing and the module load ending.

Since our routing requests are tightened to the appearance/disappearance
of sinks/sources, such BT devices will not trigger any routing request
when it gets connected. Unfortunatelly there is no hook in PA for
module load.

The workaround is that we schedule a deferred check what will be executed
next time PA goes back to the mainloop after the BT module load is complete
(ie. not too significant delays).

In the check routine we find out how many sinks/sources the recently loaded
bluetooth card has, and if none we make a routing than.

Beautiful, isn't it?
src/discover.c