Skip to contentSkip to conversation

cec: add Deck Control wake-up handling tests

PATCH Superseded Deborah Brouwer 2 participants 3 messages Jun 14, 2021 – Jun 15, 2021 Media (V4L/DVB)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cec: add Deck Control wake-up handling tests

Test that a deck in standby will wake up upon receiving the Deck Control messages Eject or Play Forward.

---
This is part of an Outreachy project to expand the testing of Deck Control messages as handled by CEC adapters.

Changes since v2:
- move tests to cec-test-power.cpp
- check if deck control is supported by sending REQ_ONCE
- use a single function that accepts different ops

 utils/cec-compliance/cec-compliance.h   |  1 +
 utils/cec-compliance/cec-test-power.cpp | 58 +++++++++++++++++++++++++
 utils/cec-compliance/cec-test.cpp       |  1 +
 utils/cec-follower/cec-processing.cpp   |  2 +
 4 files changed, 62 insertions(+)
utils/cec-compliance/cec-compliance.h +1 -0
index 818181ab..057f42c4 100644
@@ -468,5 +468,6 @@ extern const vec_remote_subtests standby_subtests;
 extern const vec_remote_subtests one_touch_play_subtests;
 extern const vec_remote_subtests power_status_subtests;
 extern const vec_remote_subtests standby_resume_subtests;
+extern const vec_remote_subtests deck_ctl_standby_resume_subtests;
 
 #endif
utils/cec-compliance/cec-test-power.cpp +58 -0

61 lines not on this page · raw message

utils/cec-compliance/cec-test.cpp +1 -0
index 283abe43..cd50c52d 100644
@@ -1658,6 +1658,7 @@ static const remote_test tests[] = {
 	{ "Remote Control Passthrough feature", TAG_REMOTE_CONTROL_PASSTHROUGH, rc_passthrough_subtests },
 	{ "Device Menu Control feature", TAG_DEVICE_MENU_CONTROL, dev_menu_ctl_subtests },
 	{ "Deck Control feature", TAG_DECK_CONTROL, deck_ctl_subtests },
+	{ "Deck Control Standby/Resume", TAG_STANDBY_RESUME, deck_ctl_standby_resume_subtests },
 	{ "Tuner Control feature", TAG_TUNER_CONTROL, tuner_ctl_subtests },
 	{ "One Touch Record feature", TAG_ONE_TOUCH_RECORD, one_touch_rec_subtests },
 	{ "Timer Programming feature", TAG_TIMER_PROGRAMMING, timer_prog_subtests },
utils/cec-follower/cec-processing.cpp +2 -0
index 876e0bc0..5385b335 100644
@@ -561,6 +561,7 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me)
 
 		switch (play_mode) {
 		case CEC_OP_PLAY_MODE_PLAY_FWD:
+			exit_standby(node);
 			deck_state = CEC_OP_DECK_INFO_PLAY;
 			break;
 		case CEC_OP_PLAY_MODE_PLAY_REV:
@@ -618,6 +619,7 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me)
 			node->state.deck_skip_start = 0;
 			break;
 		case CEC_OP_DECK_CTL_MODE_EJECT:
+			exit_standby(node);
 			deck_state = CEC_OP_DECK_INFO_NO_MEDIA;
 			node->state.deck_skip_start = 0;
 			break;
Signature · 1 line
2.25.1
#1 lore raw

Hi Deb,

Quoted 75 lines · Deborah Brouwer

Test that a deck in standby will wake up upon receiving the Deck Control messages Eject or Play Forward.

---
This is part of an Outreachy project to expand the testing of Deck Control messages as handled by CEC adapters.

Changes since v2:
- move tests to cec-test-power.cpp
- check if deck control is supported by sending REQ_ONCE
- use a single function that accepts different ops

 utils/cec-compliance/cec-compliance.h   |  1 +
 utils/cec-compliance/cec-test-power.cpp | 58 +++++++++++++++++++++++++
 utils/cec-compliance/cec-test.cpp       |  1 +
 utils/cec-follower/cec-processing.cpp   |  2 +
 4 files changed, 62 insertions(+)
utils/cec-compliance/cec-compliance.h +1 -0
index 818181ab..057f42c4 100644
@@ -468,5 +468,6 @@ extern const vec_remote_subtests standby_subtests;
 extern const vec_remote_subtests one_touch_play_subtests;
 extern const vec_remote_subtests power_status_subtests;
 extern const vec_remote_subtests standby_resume_subtests;
+extern const vec_remote_subtests deck_ctl_standby_resume_subtests;
 
 #endif
utils/cec-compliance/cec-test-power.cpp +37 -0
index bc88eca7..49241093 100644
@@ -652,3 +652,61 @@ const vec_remote_subtests standby_resume_subtests{
 	{ "Wake up TV on Text View On", CEC_LOG_ADDR_MASK_TV, standby_resume_wakeup_text_view_on },
 	{ "Power State Transitions", CEC_LOG_ADDR_MASK_TV, power_state_transitions, false, true },
 };
+
+static int standby_resume_wakeup_deck(struct node *node, unsigned me, unsigned la, bool interactive, __u8 opcode)
+{
+	struct cec_msg msg = {};
+
+	cec_msg_init(&msg, me, la);
+	cec_msg_give_deck_status(&msg, true, CEC_OP_STATUS_REQ_ONCE);
+	fail_on_test(!transmit_timeout(node, &msg));
+	if (timed_out_or_abort(&msg))
+		return OK_NOT_SUPPORTED;
+
+	unsigned unresponsive_time = 0;
+
+	fail_on_test(!poll_stable_power_status(node, me, la, CEC_OP_POWER_STATUS_ON, unresponsive_time));
+
+	int ret = standby_resume_standby(node, me, la, interactive);
+
+	if (ret)
+		return ret;
+
+	cec_msg_init(&msg, me, la);
+	if (opcode == CEC_OP_PLAY_MODE_PLAY_FWD)
+		cec_msg_play(&msg, CEC_OP_PLAY_MODE_PLAY_FWD);
+	else
+		cec_msg_deck_control(&msg, CEC_OP_DECK_CTL_MODE_EJECT);
+	fail_on_test(!transmit_timeout(node, &msg));
+	fail_on_test(cec_msg_status_is_abort(&msg));
+
+	unresponsive_time = 0;
+	fail_on_test(!poll_stable_power_status(node, me, la, CEC_OP_POWER_STATUS_ON, unresponsive_time));
+	fail_on_test(interactive && !question("Is the device in On state?"));
+
+	return OK;
+}
+
+
+static int standby_resume_wakeup_deck_eject(struct node *node, unsigned me, unsigned la, bool interactive)

utils/cec-compliance/cec-test-power.cpp const vec_remote_subtests standby_resume_subtests{ · line 701

Quoted 10 lines
utils/cec-compliance/cec-test-power.cpp +10 -0
+{
+	return standby_resume_wakeup_deck(node, me, la, interactive, CEC_OP_DECK_CTL_MODE_EJECT);
+}
+
+static int standby_resume_wakeup_deck_play(struct node *node, unsigned me, unsigned la, bool interactive)
+{
+	return standby_resume_wakeup_deck(node, me, la, interactive, CEC_OP_PLAY_MODE_PLAY_FWD);
+}
+
+const vec_remote_subtests deck_ctl_standby_resume_subtests{

Space before {

Also, make this static and make it part of the 'Standby/Resume and Power Status' tests, do not add this to the deck control tests.

The reason is that these power status tests should all be done at the end, not in the middle of other tests.

Regards,

Hans

Quoted 44 lines
utils/cec-compliance/cec-test-power.cpp +11 -0
+	{
+		"Deck Eject Standby Resume",
+		CEC_LOG_ADDR_MASK_PLAYBACK | CEC_LOG_ADDR_MASK_RECORD,
+		standby_resume_wakeup_deck_eject,
+	},
+	{
+		"Deck Play Standby Resume",
+		CEC_LOG_ADDR_MASK_PLAYBACK | CEC_LOG_ADDR_MASK_RECORD,
+		standby_resume_wakeup_deck_play,
+	}
+};
utils/cec-compliance/cec-test.cpp +1 -0
index 283abe43..cd50c52d 100644
@@ -1658,6 +1658,7 @@ static const remote_test tests[] = {
 	{ "Remote Control Passthrough feature", TAG_REMOTE_CONTROL_PASSTHROUGH, rc_passthrough_subtests },
 	{ "Device Menu Control feature", TAG_DEVICE_MENU_CONTROL, dev_menu_ctl_subtests },
 	{ "Deck Control feature", TAG_DECK_CONTROL, deck_ctl_subtests },
+	{ "Deck Control Standby/Resume", TAG_STANDBY_RESUME, deck_ctl_standby_resume_subtests },
 	{ "Tuner Control feature", TAG_TUNER_CONTROL, tuner_ctl_subtests },
 	{ "One Touch Record feature", TAG_ONE_TOUCH_RECORD, one_touch_rec_subtests },
 	{ "Timer Programming feature", TAG_TIMER_PROGRAMMING, timer_prog_subtests },
utils/cec-follower/cec-processing.cpp +2 -0
index 876e0bc0..5385b335 100644
@@ -561,6 +561,7 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me)
 
 		switch (play_mode) {
 		case CEC_OP_PLAY_MODE_PLAY_FWD:
+			exit_standby(node);
 			deck_state = CEC_OP_DECK_INFO_PLAY;
 			break;
 		case CEC_OP_PLAY_MODE_PLAY_REV:
@@ -618,6 +619,7 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me)
 			node->state.deck_skip_start = 0;
 			break;
 		case CEC_OP_DECK_CTL_MODE_EJECT:
+			exit_standby(node);
 			deck_state = CEC_OP_DECK_INFO_NO_MEDIA;
 			node->state.deck_skip_start = 0;
 			break;
#2 lore raw
Quoted 91 lines · Hans Verkuil

Hi Deb,

Quoted 75 lines · Deborah Brouwer

Test that a deck in standby will wake up upon receiving the Deck Control messages Eject or Play Forward.

---
This is part of an Outreachy project to expand the testing of Deck Control messages as handled by CEC adapters.

Changes since v2:
- move tests to cec-test-power.cpp
- check if deck control is supported by sending REQ_ONCE
- use a single function that accepts different ops

 utils/cec-compliance/cec-compliance.h   |  1 +
 utils/cec-compliance/cec-test-power.cpp | 58 +++++++++++++++++++++++++
 utils/cec-compliance/cec-test.cpp       |  1 +
 utils/cec-follower/cec-processing.cpp   |  2 +
 4 files changed, 62 insertions(+)
utils/cec-compliance/cec-compliance.h +1 -0
index 818181ab..057f42c4 100644
@@ -468,5 +468,6 @@ extern const vec_remote_subtests standby_subtests;
 extern const vec_remote_subtests one_touch_play_subtests;
 extern const vec_remote_subtests power_status_subtests;
 extern const vec_remote_subtests standby_resume_subtests;
+extern const vec_remote_subtests deck_ctl_standby_resume_subtests;
 
 #endif
utils/cec-compliance/cec-test-power.cpp +37 -0
index bc88eca7..49241093 100644
@@ -652,3 +652,61 @@ const vec_remote_subtests standby_resume_subtests{
 	{ "Wake up TV on Text View On", CEC_LOG_ADDR_MASK_TV, standby_resume_wakeup_text_view_on },
 	{ "Power State Transitions", CEC_LOG_ADDR_MASK_TV, power_state_transitions, false, true },
 };
+
+static int standby_resume_wakeup_deck(struct node *node, unsigned me, unsigned la, bool interactive, __u8 opcode)
+{
+	struct cec_msg msg = {};
+
+	cec_msg_init(&msg, me, la);
+	cec_msg_give_deck_status(&msg, true, CEC_OP_STATUS_REQ_ONCE);
+	fail_on_test(!transmit_timeout(node, &msg));
+	if (timed_out_or_abort(&msg))
+		return OK_NOT_SUPPORTED;
+
+	unsigned unresponsive_time = 0;
+
+	fail_on_test(!poll_stable_power_status(node, me, la, CEC_OP_POWER_STATUS_ON, unresponsive_time));
+
+	int ret = standby_resume_standby(node, me, la, interactive);
+
+	if (ret)
+		return ret;
+
+	cec_msg_init(&msg, me, la);
+	if (opcode == CEC_OP_PLAY_MODE_PLAY_FWD)
+		cec_msg_play(&msg, CEC_OP_PLAY_MODE_PLAY_FWD);
+	else
+		cec_msg_deck_control(&msg, CEC_OP_DECK_CTL_MODE_EJECT);
+	fail_on_test(!transmit_timeout(node, &msg));
+	fail_on_test(cec_msg_status_is_abort(&msg));
+
+	unresponsive_time = 0;
+	fail_on_test(!poll_stable_power_status(node, me, la, CEC_OP_POWER_STATUS_ON, unresponsive_time));
+	fail_on_test(interactive && !question("Is the device in On state?"));
+
+	return OK;
+}
+
+
+static int standby_resume_wakeup_deck_eject(struct node *node, unsigned me, unsigned la, bool interactive)

utils/cec-compliance/cec-test-power.cpp const vec_remote_subtests standby_resume_subtests{ · line 701

Quoted 10 lines
utils/cec-compliance/cec-test-power.cpp +10 -0
+{
+	return standby_resume_wakeup_deck(node, me, la, interactive, CEC_OP_DECK_CTL_MODE_EJECT);
+}
+
+static int standby_resume_wakeup_deck_play(struct node *node, unsigned me, unsigned la, bool interactive)
+{
+	return standby_resume_wakeup_deck(node, me, la, interactive, CEC_OP_PLAY_MODE_PLAY_FWD);
+}
+
+const vec_remote_subtests deck_ctl_standby_resume_subtests{

Space before {

Quoted 5 lines

Also, make this static and make it part of the 'Standby/Resume and Power Status' tests, do not add this to the deck control tests.

The reason is that these power status tests should all be done at the end, not in the middle of other tests.

Sorry, it's been a while since I last looked at this. This shouldn't be a separate vector of tests, instead...

Quoted 5 lines

Regards,

Hans

Quoted 10 lines

utils/cec-compliance/cec-test-power.cpp const vec_remote_subtests standby_resume_subtests{ · line 711

Quoted 10 lines
utils/cec-compliance/cec-test-power.cpp +10 -0
+	{
+		"Deck Eject Standby Resume",
+		CEC_LOG_ADDR_MASK_PLAYBACK | CEC_LOG_ADDR_MASK_RECORD,
+		standby_resume_wakeup_deck_eject,
+	},
+	{
+		"Deck Play Standby Resume",
+		CEC_LOG_ADDR_MASK_PLAYBACK | CEC_LOG_ADDR_MASK_RECORD,
+		standby_resume_wakeup_deck_play,
+	}

... add these to the existing standby_resume_subtests.

Regards,

Hans

Quoted 35 lines
Quoted 34 lines
utils/cec-compliance/cec-test-power.cpp +1 -0
+};
utils/cec-compliance/cec-test.cpp +1 -0
index 283abe43..cd50c52d 100644
@@ -1658,6 +1658,7 @@ static const remote_test tests[] = {
 	{ "Remote Control Passthrough feature", TAG_REMOTE_CONTROL_PASSTHROUGH, rc_passthrough_subtests },
 	{ "Device Menu Control feature", TAG_DEVICE_MENU_CONTROL, dev_menu_ctl_subtests },
 	{ "Deck Control feature", TAG_DECK_CONTROL, deck_ctl_subtests },
+	{ "Deck Control Standby/Resume", TAG_STANDBY_RESUME, deck_ctl_standby_resume_subtests },
 	{ "Tuner Control feature", TAG_TUNER_CONTROL, tuner_ctl_subtests },
 	{ "One Touch Record feature", TAG_ONE_TOUCH_RECORD, one_touch_rec_subtests },
 	{ "Timer Programming feature", TAG_TIMER_PROGRAMMING, timer_prog_subtests },
utils/cec-follower/cec-processing.cpp +2 -0
index 876e0bc0..5385b335 100644
@@ -561,6 +561,7 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me)
 
 		switch (play_mode) {
 		case CEC_OP_PLAY_MODE_PLAY_FWD:
+			exit_standby(node);
 			deck_state = CEC_OP_DECK_INFO_PLAY;
 			break;
 		case CEC_OP_PLAY_MODE_PLAY_REV:
@@ -618,6 +619,7 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me)
 			node->state.deck_skip_start = 0;
 			break;
 		case CEC_OP_DECK_CTL_MODE_EJECT:
+			exit_standby(node);
 			deck_state = CEC_OP_DECK_INFO_NO_MEDIA;
 			node->state.deck_skip_start = 0;
 			break;