Diff between 48381ae908df59fd17addd4d353d1e6ef268ad1a and fd6dc924abeaed4aec23a4d85743105ccf3915c6

Changed Files

File Additions Deletions Status
android/avrcp-lib.c +10 -3 modified
android/avrcp-lib.h +3 -2 modified
unit/test-avrcp.c +35 -2 modified

Full Patch

diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c
index 1dc4225..b7d0f5e 100644
--- a/android/avrcp-lib.c
+++ b/android/avrcp-lib.c
@@ -3468,8 +3468,8 @@ static bool pack_attribute_list(struct iovec *iov, uint8_t number,
 }
 
 int avrcp_get_item_attributes_rsp(struct avrcp *session, uint8_t transaction,
-					uint8_t number, uint32_t *attrs,
-					const char **text)
+					uint8_t status, uint8_t number,
+					uint32_t *attrs, const char **text)
 {
 	struct iovec iov[AVRCP_MEDIA_ATTRIBUTE_LAST * 2 + 1];
 	struct get_item_attributes_rsp rsp;
@@ -3477,7 +3477,14 @@ int avrcp_get_item_attributes_rsp(struct avrcp *session, uint8_t transaction,
 	if (number > AVRCP_MEDIA_ATTRIBUTE_LAST)
 		return -EINVAL;
 
-	rsp.status = AVRCP_STATUS_SUCCESS;
+	if (status != AVRCP_STATUS_SUCCESS) {
+		iov[0].iov_base = &status;
+		iov[0].iov_len = sizeof(status);
+		return avrcp_send_browsing(session, transaction,
+					AVRCP_GET_ITEM_ATTRIBUTES, iov, 1);
+	}
+
+	rsp.status = status;
 	rsp.number = number;
 
 	iov[0].iov_base = &rsp;
diff --git a/android/avrcp-lib.h b/android/avrcp-lib.h
index dd82deb..9985c4a 100644
--- a/android/avrcp-lib.h
+++ b/android/avrcp-lib.h
@@ -66,6 +66,7 @@
 #define AVRCP_STATUS_PARAM_NOT_FOUND		0x02
 #define AVRCP_STATUS_INTERNAL_ERROR		0x03
 #define AVRCP_STATUS_SUCCESS			0x04
+#define AVRCP_STATUS_UID_CHANGED		0x05
 #define AVRCP_STATUS_NOT_DIRECTORY		0x08
 #define AVRCP_STATUS_DOES_NOT_EXIST		0x09
 #define AVRCP_STATUS_INVALID_SCOPE		0x0a
@@ -332,8 +333,8 @@ int avrcp_get_folder_items_rsp(struct avrcp *session, uint8_t transaction,
 int avrcp_change_path_rsp(struct avrcp *session, uint8_t transaction,
 								uint32_t items);
 int avrcp_get_item_attributes_rsp(struct avrcp *session, uint8_t transaction,
-					uint8_t number, uint32_t *attrs,
-					const char **text);
+					uint8_t status, uint8_t number,
+					uint32_t *attrs, const char **text);
 int avrcp_play_item_rsp(struct avrcp *session, uint8_t transaction);
 int avrcp_search_rsp(struct avrcp *session, uint8_t transaction,
 					uint16_t counter, uint32_t items);
diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index e77cf95..154175e 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -620,7 +620,8 @@ static int uids_changed(struct avrcp *session, uint8_t transaction,
 						AVRCP_EVENT_UIDS_CHANGED,
 						&counter, sizeof(counter));
 
-	if (!g_str_equal(context->data->test_name, "/TP/MCN/CB/BV-11-C"))
+	if (!g_str_equal(context->data->test_name, "/TP/MCN/CB/BV-11-C") &&
+		!g_str_equal(context->data->test_name, "/TP/MCN/CB/BI-05-C"))
 		return -EAGAIN;
 
 	avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_CHANGED,
@@ -743,9 +744,18 @@ static int get_item_attributes(struct avrcp *session, uint8_t transaction,
 					uint16_t counter, uint8_t number,
 					uint32_t *attrs, void *user_data)
 {
+	struct context *context = user_data;
+	uint8_t status;
+
 	DBG("");
 
-	avrcp_get_item_attributes_rsp(session, transaction, 0, NULL, NULL);
+	if (g_str_equal(context->data->test_name, "/TP/MCN/CB/BI-05-C"))
+		status = AVRCP_STATUS_UID_CHANGED;
+	else
+		status = AVRCP_STATUS_SUCCESS;
+
+	avrcp_get_item_attributes_rsp(session, transaction, status, 0, NULL,
+									NULL);
 
 	return -EAGAIN;
 }
@@ -1259,6 +1269,29 @@ int main(int argc, char *argv[])
 			brs_pdu(0x02, 0x11, 0x0e, AVRCP_CHANGE_PATH,
 				0x00, 0x01, 0x08));
 
+	/* UIDcounter - TG */
+	define_test("/TP/MCN/CB/BI-05-C", test_server,
+			raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
+				0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
+				0x00, 0x00, 0x05, 0x0c,
+				0x00, 0x00, 0x00, 0x00),
+			frg_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
+				0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
+				0x00, 0x00, 0x03, 0x0c,
+				0x00, 0x01),
+			raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_CHANGED, 0x48, 0x00,
+				0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
+				0x00, 0x00, 0x03, 0x0c,
+				0x01, 0x00),
+			brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_ITEM_ATTRIBUTES,
+				0x00, 0x0c, AVRCP_MEDIA_NOW_PLAYING,
+				0x00, 0x00, 0x00, 0x00,
+				0x00, 0x00, 0x00, 0x01,
+				0xaa, 0xbb,
+				0x00),
+			brs_pdu(0x02, 0x11, 0x0e, AVRCP_GET_ITEM_ATTRIBUTES,
+				0x00, 0x01, 0x05));
+
 	/* Media Content Navigation Commands and Notifications for Search */
 
 	/* Search - CT */