This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:

Subject: cec-ctl/compliance: transmit Active Source before Standby
Author:  Hans Verkuil <hverkuil-ci...@xs4all.nl>
Date:    Fri Jul 26 16:50:50 2019 +0200

Some displays only accept Standby from the active source,
so transmit the Active Source message before the Standby
message in the compliance test and the powercycle stress
tests.

Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl>

 utils/cec-compliance/cec-test-power.cpp | 11 +++++++++
 utils/cec-ctl/cec-ctl.cpp               | 40 ++++++++++++++++++++++++++++++++-
 2 files changed, 50 insertions(+), 1 deletion(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=abff39e088dea48f6f32ba1c0954dfd9bd8b40a1
diff --git a/utils/cec-compliance/cec-test-power.cpp 
b/utils/cec-compliance/cec-test-power.cpp
index 8c83aebb536a..26b0c65ca682 100644
--- a/utils/cec-compliance/cec-test-power.cpp
+++ b/utils/cec-compliance/cec-test-power.cpp
@@ -330,7 +330,18 @@ static int standby_resume_standby(struct node *node, 
unsigned me, unsigned la, b
 
        fail_on_test(!util_interactive_ensure_power_state(node, me, la, 
interactive, CEC_OP_POWER_STATUS_ON));
 
+       /*
+        * Some displays only accept Standby from the Active Source.
+        * So make us the Active Source before sending Standby.
+        */
+       if (is_tv(la, node->remote[la].prim_type)) {
+               announce("Sending Active Source message.");
+               cec_msg_init(&msg, me, la);
+               cec_msg_active_source(&msg, node->phys_addr);
+               fail_on_test(doioctl(node, CEC_TRANSMIT, &msg));
+       }
        announce("Sending Standby message.");
+
        cec_msg_init(&msg, me, la);
        cec_msg_standby(&msg);
        fail_on_test(!transmit_timeout(node, &msg));
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index 80b3d4224e3c..f37ac9a8f3a7 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -1656,6 +1656,7 @@ static void test_power_cycle(struct node &node, unsigned 
from)
        struct cec_msg msg;
        unsigned tries;
        unsigned no_reply;
+       __u16 pa;
        __u8 wakeup_la;
        int ret;
 
@@ -1671,6 +1672,19 @@ static void test_power_cycle(struct node &node, unsigned 
from)
        if (!laddrs.log_addr_mask) {
                printf("No Logical Addresses claimed, assume TV is in 
Standby\n");
        } else {
+               doioctl(&node, CEC_ADAP_G_PHYS_ADDR, &pa);
+               /*
+                * Some displays only accept Standby from the Active Source.
+                * So make us the Active Source before sending Standby.
+                */
+               printf("Transmit Active Source to TV\n");
+               cec_msg_init(&msg, from, CEC_LOG_ADDR_TV);
+               cec_msg_active_source(&msg, pa);
+               ret = doioctl(&node, CEC_TRANSMIT, &msg);
+               if (ret) {
+                       fprintf(stderr, "Active Source Transmit failed: %s\n", 
strerror(ret));
+                       exit(1);
+               }
                printf("Transmit Standby to TV\n");
                cec_msg_init(&msg, from, CEC_LOG_ADDR_TV);
                cec_msg_standby(&msg);
@@ -1737,7 +1751,19 @@ static void test_power_cycle(struct node &node, unsigned 
from)
 
                doioctl(&node, CEC_ADAP_G_LOG_ADDRS, &laddrs);
                from = laddrs.log_addr[0] & 0xf;
+               doioctl(&node, CEC_ADAP_G_PHYS_ADDR, &pa);
 
+               /*
+                * Some displays only accept Standby from the Active Source.
+                * So make us the Active Source before sending Standby.
+                */
+               cec_msg_init(&msg, from, CEC_LOG_ADDR_TV);
+               cec_msg_active_source(&msg, pa);
+               ret = doioctl(&node, CEC_TRANSMIT, &msg);
+               if (ret) {
+                       fprintf(stderr, "Active Source Transmit failed: %s\n", 
strerror(ret));
+                       exit(1);
+               }
                cec_msg_init(&msg, from, CEC_LOG_ADDR_TV);
                cec_msg_standby(&msg);
                ret = doioctl(&node, CEC_TRANSMIT, &msg);
@@ -1774,6 +1800,7 @@ static void stress_test_power_cycle(struct node &node, 
unsigned from,
        unsigned iter = 0;
        unsigned no_reply = 0;
        unsigned mod_usleep = 0;
+       __u16 pa;
        bool found_la = false;
        int ret;
 
@@ -1812,6 +1839,7 @@ static void stress_test_power_cycle(struct node &node, 
unsigned from,
 
        doioctl(&node, CEC_ADAP_G_LOG_ADDRS, &laddrs);
        from = laddrs.log_addr[0] & 0xf;
+       doioctl(&node, CEC_ADAP_G_PHYS_ADDR, &pa);
 
        for (;;) {
                unsigned usecs1 = mod_usleep ? random() % mod_usleep : 0;
@@ -1827,7 +1855,17 @@ static void stress_test_power_cycle(struct node &node, 
unsigned from,
 
                usleep(usecs1);
 
-               cec_msg_init(&msg, from, CEC_LOG_ADDR_BROADCAST);
+               cec_msg_init(&msg, from, CEC_LOG_ADDR_TV);
+               /*
+                * Some displays only accept Standby from the Active Source.
+                * So make us the Active Source before sending Standby.
+                */
+               cec_msg_active_source(&msg, pa);
+               ret = doioctl(&node, CEC_TRANSMIT, &msg);
+               if (ret) {
+                       fprintf(stderr, "Active Source Transmit failed: %s\n", 
strerror(ret));
+                       exit(1);
+               }
                cec_msg_standby(&msg);
                ret = doioctl(&node, CEC_TRANSMIT, &msg);
                if (ret) {

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to