summaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2012-09-26 16:45:53 +0300
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2012-09-26 20:12:09 +0300
commit85ecc44d19899b2274654ea0f0c5a7b7d574cc65 (patch)
tree83671ecdca6a9411a32e48edecb600da3cf70909 /audio
parent7f88b15e1ce97c6d4f9a44cf3382b6b5ba5e340d (diff)
AVRCP: Store version and features of the remote in the session
Diffstat (limited to 'audio')
-rw-r--r--audio/avrcp.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/audio/avrcp.c b/audio/avrcp.c
index 53c4e135..376f4a1f 100644
--- a/audio/avrcp.c
+++ b/audio/avrcp.c
@@ -181,6 +181,8 @@ struct avrcp {
struct avctp *conn;
struct audio_device *dev;
struct avrcp_player *player;
+ uint16_t version;
+ int features;
unsigned int control_handler;
unsigned int browsing_handler;
@@ -1348,10 +1350,6 @@ static void state_changed(struct audio_device *dev, avctp_state_t old_state,
session);
server->sessions = g_slist_append(server->sessions, session);
- break;
- case AVCTP_STATE_CONNECTED:
- if (session == NULL)
- break;
rec = btd_device_get_record(dev->btd_dev, AVRCP_TARGET_UUID);
if (rec == NULL)
@@ -1361,21 +1359,22 @@ static void state_changed(struct audio_device *dev, avctp_state_t old_state,
return;
desc = list->data;
+ session->version = desc->version;
+ sdp_get_int_attr(rec, SDP_ATTR_SUPPORTED_FEATURES,
+ &session->features);
- if (desc && desc->version >= 0x0104) {
- int feat;
- int ret;
+ sdp_list_free(list, free);
- register_volume_notification(session);
+ break;
+ case AVCTP_STATE_CONNECTED:
+ if (session == NULL)
+ break;
- ret = sdp_get_int_attr(rec,
- SDP_ATTR_SUPPORTED_FEATURES,
- &feat);
- if (ret == 0 && (feat & AVRCP_FEATURE_BROWSING))
+ if (session->version >= 0x0104) {
+ register_volume_notification(session);
+ if (session->features & AVRCP_FEATURE_BROWSING)
avctp_connect_browsing(session->conn);
}
-
- sdp_list_free(list, free);
default:
return;
}