BlueZ seems to use lower case when emitting signals containing
UUIDs retrived from a remote device.
The definitions affected by this patch look to be used for example
if the remote connects an audio profile which BlueZ has not
discovered (perhaps it had not yet browsed the service records of
the remote).
In that case the format of the stored and emitted UUID should be
consistent with the UUIDs received during service discovery.
AVRCP state isn't hooked up to the generic audio interface and its state
changes so it needs to clear the authorized variable when getting
disconnected if no other profile is active.
The current check for implicit authorization is if any other audio profile
is already connected. However, a the second profile might try to connect
right after we've gotten a positive authorization reply for the first one
but before the first profile has reached "connected" state. So just by
checking the connected state of other profiles we might get a false
negative for the decision of doing implicit authorization.
This patch adds a variable to the audio_device struct for keeping track of
if we've gotten a positive authorization reply that can be used in
addition to the "any other profiles" connected check. This variable gets
cleared when the (global audio) device state goes back to disconnected.
When manager.c (HFP/HSP), avdtp.c (A2DP) or control.c wants to cancel an
authorization request it shouldnd't affect the requests of the other
modules. So btd_cancel_authorization cannot be used. This patch adds a new
cancellation function to device.c which will remove the specific callback
from the list and only if the list is empty call btd_cancel_authorization.
Some headsets (Nokia HS-12W) connects first on avrcp and only then on hfp
so in case Trusted property is not set this will cause agent_authorize to
return -EBUSY and drop hfp connection.
The proper solution would be to group all connections requests only
sending one authorization so the agent either accept them all or not, but
that would require API changes which we are avoiding right now, so the
current fix only send one connection request which the reponse is used for
the rest of the connections.
This patch adds logic for automatically connecting both A2DP and HFP profiles
if the headset only connects the other. The feature can be switched off using
the AutoConnect audio.conf parameter.
The audio profile coexistence whitepaper recommends that the initiator
of the A2DP connection also initiates the AVRCP connection. This patch
adds a two second delay before we attempt connecting AVRCP after the
remote device has connected A2DP to us.