From 04394771451b4fd89501dd665f1f0d2cefb4f05a Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sun, 6 Sep 2009 02:55:27 +0300 Subject: Fix audio device authorized setting for AVRCP-only connections 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. --- audio/control.c | 4 ++++ audio/device.c | 7 +++++++ audio/device.h | 2 ++ 3 files changed, 13 insertions(+) diff --git a/audio/control.c b/audio/control.c index c8a93f914..e94ef562d 100644 --- a/audio/control.c +++ b/audio/control.c @@ -427,6 +427,10 @@ static void avctp_set_state(struct control *control, avctp_state_t new_state) emit_property_changed(dev->conn, dev->path, AUDIO_CONTROL_INTERFACE, "Connected", DBUS_TYPE_BOOLEAN, &value); + + if (!audio_device_is_active(dev, NULL)) + audio_device_set_authorized(dev, FALSE); + break; case AVCTP_STATE_CONNECTING: debug("AVCTP Connecting"); diff --git a/audio/device.c b/audio/device.c index 104c256cf..550a35f17 100644 --- a/audio/device.c +++ b/audio/device.c @@ -804,3 +804,10 @@ int audio_device_cancel_authorization(struct audio_device *dev, return 0; } + +void audio_device_set_authorized(struct audio_device *dev, gboolean auth) +{ + struct dev_priv *priv = dev->priv; + + priv->authorized = auth; +} diff --git a/audio/device.h b/audio/device.h index 45c54e80a..c899d20b2 100644 --- a/audio/device.h +++ b/audio/device.h @@ -90,3 +90,5 @@ int audio_device_cancel_authorization(struct audio_device *dev, int audio_device_request_authorization(struct audio_device *dev, const char *uuid, authorization_cb cb, void *user_data); + +void audio_device_set_authorized(struct audio_device *dev, gboolean auth); -- cgit v1.2.1