Skip to contentSkip to conversation

cec-compliance: system audio control tests

PATCH New c0d1n61at3 at gmail.com (Jiunn Chang) 3 participants 5 messages Sep 2, 2019 – Sep 6, 2019 Media (V4L/DVB)

lore
Share & tools
lore

c0d1n61at3 at gmail.com (Jiunn Chang)

#0 lore raw

PATCH 1/1 cec-compliance: system audio control tests

Add user control press operands:
- Mute Function
- Restore Volume Function

Signed-off-by Jiunn Chang <c0d1n61at3 at gmail.com>
---
 utils/cec-compliance/cec-test-audio.cpp | 32 +++++++++++++++++++++++++
 utils/cec-follower/cec-processing.cpp   |  6 +++++
 2 files changed, 38 insertions(+)
utils/cec-compliance/cec-test-audio.cpp +32 -0
index 8611350e..872bb9ad 100644
@@ -673,6 +673,32 @@ static int sac_user_control_press_mute(struct node *node, unsigned me, unsigned
 	return 0;
 }
 
+static int sac_user_control_press_mute_function(struct node *node, unsigned me, unsigned la, bool interactive)
+{
+	__u8 ret;
+
+	if ((ret = sac_util_send_user_control_press(node, me, la, 0x65)))
+		return ret;
+	fail_on_test_v2(node->remote[la].cec_version,
+			la == CEC_LOG_ADDR_AUDIOSYSTEM &&
+			node->remote[la].mute == CEC_OP_AUD_MUTE_STATUS_ON);
+
+	return 0;
+}
+
+static int sac_user_control_press_restore_volume_function(struct node *node, unsigned me, unsigned la, bool interactive)
+{
+	__u8 ret;
+
+	if ((ret = sac_util_send_user_control_press(node, me, la, 0x66)))
+		return ret;
+	fail_on_test_v2(node->remote[la].cec_version,
+			la == CEC_LOG_ADDR_AUDIOSYSTEM &&
+			node->remote[la].mute == CEC_OP_AUD_MUTE_STATUS_OFF);
+
+	return 0;
+}
+
 static int sac_user_control_release(struct node *node, unsigned me, unsigned la, bool interactive)
 {
 	struct cec_msg msg = {};
@@ -763,6 +789,12 @@ struct remote_subtest sac_subtests[] = {
 	{ "User Control Pressed (Mute)",
 	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
 	  sac_user_control_press_mute },
+	{ "User Control Pressed (Restore Volume Function)",
+	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
+	  sac_user_control_press_restore_volume_function },
+	{ "User Control Pressed (Mute Function)",
+	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
+	  sac_user_control_press_mute_function },
 	{ "User Control Released",
 	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
 	  sac_user_control_release },
utils/cec-follower/cec-processing.cpp +6 -0
index 27172560..c6d88647 100644
@@ -516,6 +516,12 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me)
 		case 0x43:
 			node->state.mute = !node->state.mute;
 			break;
+		case 0x65:
+			node->state.mute = CEC_OP_AUD_MUTE_STATUS_ON;
+			break;
+		case 0x66:
+			node->state.mute = CEC_OP_AUD_MUTE_STATUS_OFF;
+			break;
 		case 0x6B:
 			if (!enter_standby(node))
 				exit_standby(node);
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/1 cec-compliance: system audio control tests

Just one small correction:

Quoted 65 lines · Jiunn Chang

Add user control press operands:
- Mute Function
- Restore Volume Function

Signed-off-by Jiunn Chang <c0d1n61at3 at gmail.com>
---
 utils/cec-compliance/cec-test-audio.cpp | 32 +++++++++++++++++++++++++
 utils/cec-follower/cec-processing.cpp   |  6 +++++
 2 files changed, 38 insertions(+)
utils/cec-compliance/cec-test-audio.cpp +32 -0
index 8611350e..872bb9ad 100644
@@ -673,6 +673,32 @@ static int sac_user_control_press_mute(struct node *node, unsigned me, unsigned
 	return 0;
 }
 
+static int sac_user_control_press_mute_function(struct node *node, unsigned me, unsigned la, bool interactive)
+{
+	__u8 ret;
+
+	if ((ret = sac_util_send_user_control_press(node, me, la, 0x65)))
+		return ret;
+	fail_on_test_v2(node->remote[la].cec_version,
+			la == CEC_LOG_ADDR_AUDIOSYSTEM &&
+			node->remote[la].mute == CEC_OP_AUD_MUTE_STATUS_ON);
+
+	return 0;
+}
+
+static int sac_user_control_press_restore_volume_function(struct node *node, unsigned me, unsigned la, bool interactive)
+{
+	__u8 ret;
+
+	if ((ret = sac_util_send_user_control_press(node, me, la, 0x66)))
+		return ret;
+	fail_on_test_v2(node->remote[la].cec_version,
+			la == CEC_LOG_ADDR_AUDIOSYSTEM &&
+			node->remote[la].mute == CEC_OP_AUD_MUTE_STATUS_OFF);
+
+	return 0;
+}
+
 static int sac_user_control_release(struct node *node, unsigned me, unsigned la, bool interactive)
 {
 	struct cec_msg msg = {};
@@ -763,6 +789,12 @@ struct remote_subtest sac_subtests[] = {
 	{ "User Control Pressed (Mute)",
 	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
 	  sac_user_control_press_mute },
+	{ "User Control Pressed (Restore Volume Function)",
+	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
+	  sac_user_control_press_restore_volume_function },
+	{ "User Control Pressed (Mute Function)",
+	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
+	  sac_user_control_press_mute_function },
 	{ "User Control Released",
 	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
 	  sac_user_control_release },
utils/cec-follower/cec-processing.cpp +0 -0
index 27172560..c6d88647 100644

utils/cec-follower/cec-processing.cpp static void processMsg(struct node *node, struct cec_msg &msg, unsigned me) · line 523

Quoted 8 lines
utils/cec-follower/cec-processing.cpp +5 -0
@@ -516,6 +516,12 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me)
 		case 0x43:
 			node->state.mute = !node->state.mute;
 			break;
+		case 0x65:
+			node->state.mute = CEC_OP_AUD_MUTE_STATUS_ON;
+			break;
+		case 0x66:
+			node->state.mute = CEC_OP_AUD_MUTE_STATUS_OFF;

state.mute is a bool, so just use true and false instead of CEC_OP_AUD_MUTE_STATUS_ON/OFF.

utils/cec-follower/cec-processing.cpp static void processMsg(struct node *node, struct cec_msg &msg, unsigned me) · line 527

Quoted 5 lines
utils/cec-follower/cec-processing.cpp +1 -0
+			break;
 		case 0x6B:
 			if (!enter_standby(node))
 				exit_standby(node);

Regards,

Hans

#2 lore raw

PATCH v2 1/1 cec-compliance: system audio control tests

In reply to c0d1n61at3 at gmail.com (Jiunn Chang)

Add user control press operands:
- Mute Function
- Restore Volume Function

Signed-off-by Jiunn Chang <c0d1n61at3 at gmail.com>

---

Changes made since v2:
- change node->state.mute to boolean

Quoted 1 line

8---------------------------------------------------------------------------8<

 utils/cec-compliance/cec-test-audio.cpp | 32 +++++++++++++++++++++++++
 utils/cec-follower/cec-processing.cpp   |  6 +++++
 2 files changed, 38 insertions(+)
utils/cec-compliance/cec-test-audio.cpp +32 -0
index 8611350e..872bb9ad 100644
@@ -673,6 +673,32 @@ static int sac_user_control_press_mute(struct node *node, unsigned me, unsigned
 	return 0;
 }
 
+static int sac_user_control_press_mute_function(struct node *node, unsigned me, unsigned la, bool interactive)
+{
+	__u8 ret;
+
+	if ((ret = sac_util_send_user_control_press(node, me, la, 0x65)))
+		return ret;
+	fail_on_test_v2(node->remote[la].cec_version,
+			la == CEC_LOG_ADDR_AUDIOSYSTEM &&
+			node->remote[la].mute == CEC_OP_AUD_MUTE_STATUS_ON);
+
+	return 0;
+}
+
+static int sac_user_control_press_restore_volume_function(struct node *node, unsigned me, unsigned la, bool interactive)
+{
+	__u8 ret;
+
+	if ((ret = sac_util_send_user_control_press(node, me, la, 0x66)))
+		return ret;
+	fail_on_test_v2(node->remote[la].cec_version,
+			la == CEC_LOG_ADDR_AUDIOSYSTEM &&
+			node->remote[la].mute == CEC_OP_AUD_MUTE_STATUS_OFF);
+
+	return 0;
+}
+
 static int sac_user_control_release(struct node *node, unsigned me, unsigned la, bool interactive)
 {
 	struct cec_msg msg = {};
@@ -763,6 +789,12 @@ struct remote_subtest sac_subtests[] = {
 	{ "User Control Pressed (Mute)",
 	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
 	  sac_user_control_press_mute },
+	{ "User Control Pressed (Restore Volume Function)",
+	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
+	  sac_user_control_press_restore_volume_function },
+	{ "User Control Pressed (Mute Function)",
+	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
+	  sac_user_control_press_mute_function },
 	{ "User Control Released",
 	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
 	  sac_user_control_release },
utils/cec-follower/cec-processing.cpp +6 -0
index 27172560..a38f664b 100644
@@ -516,6 +516,12 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me)
 		case 0x43:
 			node->state.mute = !node->state.mute;
 			break;
+		case 0x65:
+			node->state.mute = true;
+			break;
+		case 0x66:
+			node->state.mute = false;
+			break;
 		case 0x6B:
 			if (!enter_standby(node))
 				exit_standby(node);
Signature · 1 line
2.23.0
#3 lore raw

PATCH v2 1/1 cec-compliance: system audio control tests

Quoted 4 lines · Jiunn Chang

Add user control press operands:
- Mute Function
- Restore Volume Function

Please add more details to the commit message. It would be helpful to know more about the features that are getting added.

Quoted 4 lines
Signed-off-by Jiunn Chang <c0d1n61at3 at gmail.com>

---

Changes made since v2:

I assume you meant since v1?

Quoted 13 lines

- change node->state.mute to boolean

Quoted 1 line

8---------------------------------------------------------------------------8<

  utils/cec-compliance/cec-test-audio.cpp | 32 +++++++++++++++++++++++++
  utils/cec-follower/cec-processing.cpp   |  6 +++++
  2 files changed, 38 insertions(+)
utils/cec-compliance/cec-test-audio.cpp +0 -0
index 8611350e..872bb9ad 100644

utils/cec-compliance/cec-test-audio.cpp static int sac_user_control_press_mute(struct node *node, unsigned me, unsigned · line 680

Quoted 8 lines
utils/cec-compliance/cec-test-audio.cpp +5 -0
@@ -673,6 +673,32 @@ static int sac_user_control_press_mute(struct node *node, unsigned me, unsigned
  	return 0;
  }
 
+static int sac_user_control_press_mute_function(struct node *node, unsigned me, unsigned la, bool interactive)
+{
+	__u8 ret;
+
+	if ((ret = sac_util_send_user_control_press(node, me, la, 0x65)))

Would it help to add a define for 0x65 - same comment on other uses such as 0x66

utils/cec-compliance/cec-test-audio.cpp static int sac_user_control_press_mute(struct node *node, unsigned me, unsigned · line 693

Quoted 13 lines
utils/cec-compliance/cec-test-audio.cpp +13 -0
+		return ret;
+	fail_on_test_v2(node->remote[la].cec_version,
+			la == CEC_LOG_ADDR_AUDIOSYSTEM &&
+			node->remote[la].mute == CEC_OP_AUD_MUTE_STATUS_ON);
+
+	return 0;
+}
+
+static int sac_user_control_press_restore_volume_function(struct node *node, unsigned me, unsigned la, bool interactive)
+{
+	__u8 ret;
+
+	if ((ret = sac_util_send_user_control_press(node, me, la, 0x66)))

Same here?

Quoted 29 lines
utils/cec-compliance/cec-test-audio.cpp +14 -0
+		return ret;
+	fail_on_test_v2(node->remote[la].cec_version,
+			la == CEC_LOG_ADDR_AUDIOSYSTEM &&
+			node->remote[la].mute == CEC_OP_AUD_MUTE_STATUS_OFF);
+
+	return 0;
+}
+
  static int sac_user_control_release(struct node *node, unsigned me, unsigned la, bool interactive)
  {
  	struct cec_msg msg = {};
@@ -763,6 +789,12 @@ struct remote_subtest sac_subtests[] = {
  	{ "User Control Pressed (Mute)",
  	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
  	  sac_user_control_press_mute },
+	{ "User Control Pressed (Restore Volume Function)",
+	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
+	  sac_user_control_press_restore_volume_function },
+	{ "User Control Pressed (Mute Function)",
+	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
+	  sac_user_control_press_mute_function },
  	{ "User Control Released",
  	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
  	  sac_user_control_release },
utils/cec-follower/cec-processing.cpp +0 -0
index 27172560..a38f664b 100644

utils/cec-follower/cec-processing.cpp static void processMsg(struct node *node, struct cec_msg &msg, unsigned me) · line 518

Quoted 3 lines
utils/cec-follower/cec-processing.cpp +0 -0
@@ -516,6 +516,12 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me)
  		case 0x43:
  			node->state.mute = !node->state.mute;
  			break;

Looks like this is existing usage. Still it would make sense to add a define for these as self documenting.

utils/cec-follower/cec-processing.cpp static void processMsg(struct node *node, struct cec_msg &msg, unsigned me) · line 527

Quoted 10 lines
utils/cec-follower/cec-processing.cpp +6 -0
+		case 0x65:
+			node->state.mute = true;
+			break;
+		case 0x66:
+			node->state.mute = false;
+			break;
  		case 0x6B:
  			if (!enter_standby(node))
  				exit_standby(node);

thanks,
-- Shuah

#4 lore raw

PATCH v3 1/1 cec-compliance: system audio control tests

In reply to Jiunn Chang

The HDMI CEC specification defines deterministic operands for User Control Pressed that mute or unmute system audio.

Those being:
- Mute Function for mute on
- Restore Volume Function for mute off

This is different from the operand Mute which is a toggle.

This patch adds tests for these User Control Pressed operands.

Signed-off-by Jiunn Chang <c0d1n61at3 at gmail.com>

---

Changes made since v2:
- add more details to commit message

Notes:

A patch series has been submitted by Hans Verkuil to add CEC UI command operands to the cec header in the media tree from which v4l-utils copies it. Once those patches are applied, another patch will be submitted to leverage the new header operand macros.

Quoted 1 line

8---------------------------------------------------------------------------8<

 utils/cec-compliance/cec-test-audio.cpp | 32 +++++++++++++++++++++++++
 utils/cec-follower/cec-processing.cpp   |  6 +++++
 2 files changed, 38 insertions(+)
utils/cec-compliance/cec-test-audio.cpp +32 -0
index 8611350e..872bb9ad 100644
@@ -673,6 +673,32 @@ static int sac_user_control_press_mute(struct node *node, unsigned me, unsigned
 	return 0;
 }
 
+static int sac_user_control_press_mute_function(struct node *node, unsigned me, unsigned la, bool interactive)
+{
+	__u8 ret;
+
+	if ((ret = sac_util_send_user_control_press(node, me, la, 0x65)))
+		return ret;
+	fail_on_test_v2(node->remote[la].cec_version,
+			la == CEC_LOG_ADDR_AUDIOSYSTEM &&
+			node->remote[la].mute == CEC_OP_AUD_MUTE_STATUS_ON);
+
+	return 0;
+}
+
+static int sac_user_control_press_restore_volume_function(struct node *node, unsigned me, unsigned la, bool interactive)
+{
+	__u8 ret;
+
+	if ((ret = sac_util_send_user_control_press(node, me, la, 0x66)))
+		return ret;
+	fail_on_test_v2(node->remote[la].cec_version,
+			la == CEC_LOG_ADDR_AUDIOSYSTEM &&
+			node->remote[la].mute == CEC_OP_AUD_MUTE_STATUS_OFF);
+
+	return 0;
+}
+
 static int sac_user_control_release(struct node *node, unsigned me, unsigned la, bool interactive)
 {
 	struct cec_msg msg = {};
@@ -763,6 +789,12 @@ struct remote_subtest sac_subtests[] = {
 	{ "User Control Pressed (Mute)",
 	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
 	  sac_user_control_press_mute },
+	{ "User Control Pressed (Restore Volume Function)",
+	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
+	  sac_user_control_press_restore_volume_function },
+	{ "User Control Pressed (Mute Function)",
+	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
+	  sac_user_control_press_mute_function },
 	{ "User Control Released",
 	  CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
 	  sac_user_control_release },
utils/cec-follower/cec-processing.cpp +6 -0
index 27172560..a38f664b 100644
@@ -516,6 +516,12 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me)
 		case 0x43:
 			node->state.mute = !node->state.mute;
 			break;
+		case 0x65:
+			node->state.mute = true;
+			break;
+		case 0x66:
+			node->state.mute = false;
+			break;
 		case 0x6B:
 			if (!enter_standby(node))
 				exit_standby(node);
Signature · 1 line
2.23.0