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-compliance: don't check UID, instead test with a <Poll>
Author:  Hans Verkuil <hverk...@xs4all.nl>
Date:    Tue Mar 11 10:22:43 2025 +0100

The use of CEC_MSG_FL_RAW is only allowed if CAP_SYS_RAWIO is
set. So don't check if you are root, instead just try to transmit
a <Poll> message with CEC_MSG_FL_RAW set. If CEC_TRANSMIT returns EPERM,
then that means CAP_SYS_RAWIO was not available, and in that case return
NOTAPPLICABLE.

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

 utils/cec-compliance/cec-test-power.cpp | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=c363e9aa6d7047e4bdfb68a96fddde884c63487d
diff --git a/utils/cec-compliance/cec-test-power.cpp 
b/utils/cec-compliance/cec-test-power.cpp
index e685fe4824eb..253e81636a2b 100644
--- a/utils/cec-compliance/cec-test-power.cpp
+++ b/utils/cec-compliance/cec-test-power.cpp
@@ -527,8 +527,19 @@ static int standby_resume_wakeup_view_on(struct node 
*node, unsigned me, unsigne
                return NOTAPPLICABLE;
        if (me == CEC_LOG_ADDR_UNREGISTERED && from_unregistered)
                return NOTAPPLICABLE;
-       if (from_unregistered && getuid())
-               return NOTAPPLICABLE;
+
+       if (from_unregistered) {
+               cec_msg msg;
+               int res;
+
+               // Check if we have permission to use CEC_MSG_FL_RAW.
+               // It relies on CAP_SYS_RAWIO being set.
+               cec_msg_init(&msg, me, la);
+               msg.flags |= CEC_MSG_FL_RAW;
+               res = doioctl(node, CEC_TRANSMIT, &msg);
+               if (res == EPERM)
+                       return NOTAPPLICABLE;
+       }
 
        unsigned unresponsive_cnt = 0;
 

Reply via email to