From patchwork Thu Jun 17 23:41:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deborah Brouwer X-Patchwork-Id: 12329755 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61A37C48BE5 for ; Thu, 17 Jun 2021 23:41:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 300FE61375 for ; Thu, 17 Jun 2021 23:41:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232349AbhFQXnh (ORCPT ); Thu, 17 Jun 2021 19:43:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230447AbhFQXnh (ORCPT ); Thu, 17 Jun 2021 19:43:37 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D216EC061574 for ; Thu, 17 Jun 2021 16:41:27 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id u18so896962pfk.11 for ; Thu, 17 Jun 2021 16:41:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=77ABy1TzsOXnqLIiVvGSJIovexBaJwxDxUj3K2nBtrY=; b=SthCgKEdiSTaZQ2BplRLZe1NPMszJURVoWwEEPkF7MR/u1PROwknNpfdQOjx/a3kLb xtmKM/mrcXgAQxsLYNLFyHCCYMzfsE0YW6LRKM2BeVxTcnZodqyCTjuLKgWkOg/9/0ji g4cvsNxjuThd5RZjUSK60W8vQ5QNlTfoPmKb8K6nmn5/SMAGezypc/aVoog60ug+ZT3I eGlvtdKeHuaZQPKdQFCvBH4q4rBuJJf07kLTZtN1eAwX9TBk8JH9l7auZzaHrHm3dz9d paObHlJOe4OlshdGK/v3NFOt+YxJQxVMY6edD0inJoZsRRmAahq2qJoJEAbE2IaoPxsD WU1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=77ABy1TzsOXnqLIiVvGSJIovexBaJwxDxUj3K2nBtrY=; b=HUmgR8wC6lQRTlBw9zAORHtYJhli/QO7nTtqJgSh47hSC6/5zAHzfoiWE04719wU// 8Xxux/FATGoOCSmcz+wPuZ+osJihctSKxWOnljVM5jRThCz2ee3wcNBwAgCCUyeApWNs EGbshZ7jC/2PpI3RTKVpWJdSNWq5vFXsashtKYSn+DIfBYEpc3/VJYA6+NMUKni3ov/3 791rQRaGX5XKOU25D8aLvUMcjlYzykBuFTHllY/iGcU8QHEeiq5SY4CtJJK8JXL0lVLB novWQU1QYhh2SryXrnz9KaGjkVa/uyKN8HcBAakWdQdIrdqn1WMZGQDElqLclMm/KaPy F0zQ== X-Gm-Message-State: AOAM532+dy4voROBVN2fQaY9nP3jQYSMmxsLWQg0/VHFyejphz67gYKY rQR5Tqm6CTA0nXGD6jbGJAemuaxMMIN5tA== X-Google-Smtp-Source: ABdhPJwKkOKgsN65wHCM38OzpEIIaOSexX89WeAychz8F+zlwOBz4cdq96TNJP7H3YWBzz22rDLEZg== X-Received: by 2002:a63:e309:: with SMTP id f9mr7132629pgh.443.1623973287386; Thu, 17 Jun 2021 16:41:27 -0700 (PDT) Received: from ada-comp.hitronhub.home (S0106ac202ecb0523.gv.shawcable.net. [70.67.120.89]) by smtp.gmail.com with ESMTPSA id j19sm6452966pgm.44.2021.06.17.16.41.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 16:41:27 -0700 (PDT) From: Deborah Brouwer To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, jaffe1@gmail.com, Deborah Brouwer Subject: [PATCH v2 1/2] cec: expand One Touch Record TV Screen test Date: Thu, 17 Jun 2021 16:41:11 -0700 Message-Id: <33ad72ef20383b4a86526c511696ed0838afa10b.1623972511.git.deborahbrouwer3563@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Check that the follower ignores the Record TV Screen message if the initiator has a logical address other than Record or Backup (aka Reserved in CEC Version < 2.0). If the follower replies correctly, check that the source operand is valid. Signed-off-by: Deborah Brouwer --- utils/cec-compliance/cec-test.cpp | 53 ++++++++++++++++++++++++++----- utils/cec-follower/cec-tuner.cpp | 9 ++++-- 2 files changed, 51 insertions(+), 11 deletions(-) diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp index 40d8369d..0051d72a 100644 --- a/utils/cec-compliance/cec-test.cpp +++ b/utils/cec-compliance/cec-test.cpp @@ -1150,13 +1150,6 @@ static const vec_remote_subtests tuner_ctl_subtests{ static int one_touch_rec_tv_screen(struct node *node, unsigned me, unsigned la, bool interactive) { - /* - TODO: - - Page 36 in HDMI CEC 1.4b spec lists additional behaviors that should be - checked for. - - The TV should ignore this message when received from other LA than Recording or - Reserved. - */ struct cec_msg msg; cec_msg_init(&msg, me, la); @@ -1172,8 +1165,52 @@ static int one_touch_rec_tv_screen(struct node *node, unsigned me, unsigned la, return OK_REFUSED; if (cec_msg_status_is_abort(&msg)) return OK_PRESUMED; + /* + * Follower should ignore this message if initiator has a logical + * address other than Record or Backup (aka "Reserved" in CEC Version < 2.0). + */ + if (!cec_has_record(1 << me) && !cec_has_backup(1 << me)) { + fail_on_test(!timed_out(&msg)); + return OK; + } + fail_on_test(timed_out(&msg)); - return 0; + struct cec_op_record_src rec_src = {}; + + cec_ops_record_on(&msg, &rec_src); + + if (rec_src.type < 1 || rec_src.type > 5) + return fail("Invalid source.\n"); + + if (rec_src.type == CEC_OP_RECORD_SRC_DIGITAL && + rec_src.digital.service_id_method == CEC_OP_SERVICE_ID_METHOD_BY_DIG_ID) { + + switch (rec_src.digital.dig_bcast_system) { + case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ARIB_GEN: + case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_GEN: + case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_GEN: + case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ARIB_BS: + case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ARIB_CS: + case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ARIB_T: + case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_CABLE: + case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_SAT: + case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_T: + case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_C: + case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_S: + case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_S2: + case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_T: + break; + default: + return fail("Invalid digital service broadcast system operand.\n"); + } + } + + if (rec_src.type == CEC_OP_RECORD_SRC_ANALOG) { + fail_on_test(rec_src.analog.ana_bcast_type > 2); + fail_on_test(rec_src.analog.bcast_system > 8 && rec_src.analog.bcast_system != 0x1f); + } + + return OK; } static int one_touch_rec_on(struct node *node, unsigned me, unsigned la, bool interactive) diff --git a/utils/cec-follower/cec-tuner.cpp b/utils/cec-follower/cec-tuner.cpp index b9c21684..fd11bd10 100644 --- a/utils/cec-follower/cec-tuner.cpp +++ b/utils/cec-follower/cec-tuner.cpp @@ -583,9 +583,6 @@ void process_tuner_record_timer_msgs(struct node *node, struct cec_msg &msg, uns This is only a basic implementation. TODO: - - If we are a TV, we should only send Record On if the - remote end is a Recording device or Reserved. Otherwise ignore. - - Device state should reflect whether we are recording, etc. In recording mode we should ignore Standby messages. */ @@ -594,6 +591,12 @@ void process_tuner_record_timer_msgs(struct node *node, struct cec_msg &msg, uns if (!node->has_rec_tv) break; + __u8 la = cec_msg_initiator(&msg); + + /* Ignore if initiator is not Record or Backup (aka "Reserved" in CEC Version < 2.0) */ + if (!cec_has_record(1 << la) && !cec_has_backup(1 << la)) + return; + struct cec_op_record_src rec_src = {}; rec_src.type = CEC_OP_RECORD_SRC_OWN; From patchwork Thu Jun 17 23:41:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deborah Brouwer X-Patchwork-Id: 12329757 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD14AC2B9F4 for ; Thu, 17 Jun 2021 23:41:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8776961184 for ; Thu, 17 Jun 2021 23:41:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232384AbhFQXnl (ORCPT ); Thu, 17 Jun 2021 19:43:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230447AbhFQXnk (ORCPT ); Thu, 17 Jun 2021 19:43:40 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78B76C061574 for ; Thu, 17 Jun 2021 16:41:32 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id 69so3758311plc.5 for ; Thu, 17 Jun 2021 16:41:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wznvHF42tX6esZegWeGAjqI9nVakVD+2ebx4/jB9lpM=; b=DAVVb31nZgxTEEqfLBkmjezvazWpgLb4OMsBybUGZ5ByzBeubOi4lgBu3NUcRlueLq MsEYHoAkjrVoCnN/VmTxCAF924pIrmMQnJ2aWvVZNk5v9uTLzP838U1iKIw1YWfMcwkj USXrYrljVwPQ35qBEvMQYIn81QBv/vvKbD6rvfbb9yN02v7oTDXldBqd3XKKo2Xr+bOe cVqJCDw5wEk6QwDDNHYLwuThfNux6rGwEAXHx3s3GQwe2dBpx1nl2mlDlSFO1R3f/Xl3 3CEVfbbaloISLKT4J9FU00NdiJmxCe+q7fBW2j98hdT53ygjEPiYzrDCIy26VzJLx7UD ABQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wznvHF42tX6esZegWeGAjqI9nVakVD+2ebx4/jB9lpM=; b=SKS4f/DH717wlQ1kqyjPZoMp+D6NIbbF73pAH2gFyFgcgnsG3FpJf8phOh+yn+IizB VN2XxlOC4EFbPu0FGJ/cf2ywZbir+LEYLmjyyr9/QnKynv2utOOkN7D5O2n6geza9+1W cvMJeYuvRYk8lOSV/o8bIqdST11W1Kr5nhb6lqupSH/mFFKMYteFCxmr+1NvpZOb0Yq8 zGChm2hKAiX+rIP3u4ezUSEoae8F3Oa8ja9HVYTxe6fCJFK0GT+lMWkqcnQ5zPiPMXup XSNudFV0xgROsMBJhAW6cOMYhBHDpmwxP25BFhTDrcgo+Bx3GePAyEC4y4Dlymc2ZfLg /Q+A== X-Gm-Message-State: AOAM531CYRnkvQAwWFhXRWl2mFp/1/ccQ/fOCLAa8FdIRnsSbr36wMWn NgDewrd3s3Q66LYHYB1ThCL6gJbQlGxiMQ== X-Google-Smtp-Source: ABdhPJzvP/UCJi49+YXVnpkOZcF6CjeKpKuBkIfxhDqI7U5DqoWD1MRiEV55S1977fibO0PVdvu/gw== X-Received: by 2002:a17:90b:3449:: with SMTP id lj9mr241932pjb.123.1623973291990; Thu, 17 Jun 2021 16:41:31 -0700 (PDT) Received: from ada-comp.hitronhub.home (S0106ac202ecb0523.gv.shawcable.net. [70.67.120.89]) by smtp.gmail.com with ESMTPSA id j19sm6452966pgm.44.2021.06.17.16.41.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 16:41:31 -0700 (PDT) From: Deborah Brouwer To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, jaffe1@gmail.com, Deborah Brouwer Subject: [PATCH v2 2/2] cec: expand One Touch Record On test Date: Thu, 17 Jun 2021 16:41:12 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Send all Record On source operands and check that the follower responds with a corresponding Record Status. Send invalid Record On source operands and make sure that the follower returns Feature Abort with Invalid Operand. Signed-off-by: Deborah Brouwer --- utils/cec-compliance/cec-test.cpp | 107 +++++++++++++++++++++++++++--- utils/cec-follower/cec-tuner.cpp | 28 +++++++- 2 files changed, 125 insertions(+), 10 deletions(-) diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp index 0051d72a..2c64d1a0 100644 --- a/utils/cec-compliance/cec-test.cpp +++ b/utils/cec-compliance/cec-test.cpp @@ -48,6 +48,43 @@ static int test_play_mode(struct node *node, unsigned me, unsigned la, __u8 play return OK; } +static int one_touch_rec_on_send(struct node *node, unsigned me, unsigned la, __u8 src, __u8 &rec_status) +{ + struct cec_msg msg; + struct cec_op_record_src rec_src = {}; + + cec_msg_init(&msg, me, la); + rec_src.type = src; + cec_msg_record_on(&msg, true, &rec_src); + fail_on_test(!transmit_timeout(node, &msg)); + fail_on_test(timed_out_or_abort(&msg)); + cec_ops_record_status(&msg, &rec_status); + + return OK; +} + +static bool one_touch_rec_common(__u8 rec_status) +{ + switch (rec_status) { + case CEC_OP_RECORD_STATUS_UNSUP_CA: + case CEC_OP_RECORD_STATUS_NO_CA_ENTITLEMENTS: + case CEC_OP_RECORD_STATUS_CANT_COPY_SRC: + case CEC_OP_RECORD_STATUS_NO_MORE_COPIES: + case CEC_OP_RECORD_STATUS_NO_MEDIA: + case CEC_OP_RECORD_STATUS_PLAYING: + case CEC_OP_RECORD_STATUS_ALREADY_RECORDING: + case CEC_OP_RECORD_STATUS_MEDIA_PROT: + case CEC_OP_RECORD_STATUS_NO_SIGNAL: + case CEC_OP_RECORD_STATUS_MEDIA_PROBLEM: + case CEC_OP_RECORD_STATUS_NO_SPACE: + case CEC_OP_RECORD_STATUS_PARENTAL_LOCK: + case CEC_OP_RECORD_STATUS_OTHER: + return true; + default: + return false; + } +} + /* System Information */ int system_info_polling(struct node *node, unsigned me, unsigned la, bool interactive) @@ -1215,10 +1252,6 @@ static int one_touch_rec_tv_screen(struct node *node, unsigned me, unsigned la, static int one_touch_rec_on(struct node *node, unsigned me, unsigned la, bool interactive) { - /* - TODO: Page 36 in HDMI CEC 1.4b spec lists additional behaviors that should be - checked for. - */ struct cec_msg msg; struct cec_op_record_src rec_src = {}; @@ -1227,15 +1260,68 @@ static int one_touch_rec_on(struct node *node, unsigned me, unsigned la, bool in cec_msg_record_on(&msg, true, &rec_src); fail_on_test(!transmit_timeout(node, &msg)); fail_on_test(timed_out(&msg)); - fail_on_test(cec_has_record(1 << la) && unrecognized_op(&msg)); - if (unrecognized_op(&msg)) + if (unrecognized_op(&msg)) { + fail_on_test(cec_has_record(1 << la) || cec_has_backup(1 << la)); return OK_NOT_SUPPORTED; + } if (refused(&msg)) return OK_REFUSED; if (cec_msg_status_is_abort(&msg)) return OK_PRESUMED; - return 0; + __u8 rec_status; + + cec_ops_record_status(&msg, &rec_status); + fail_on_test(rec_status != CEC_OP_RECORD_STATUS_CUR_SRC && !one_touch_rec_common(rec_status)); + + fail_on_test(one_touch_rec_on_send(node, me, la, CEC_OP_RECORD_SRC_DIGITAL, rec_status)); + fail_on_test(rec_status != CEC_OP_RECORD_STATUS_DIG_SERVICE && + rec_status != CEC_OP_RECORD_STATUS_NO_DIG_SERVICE && + rec_status != CEC_OP_RECORD_STATUS_NO_SERVICE && + !one_touch_rec_common(rec_status)); + + fail_on_test(one_touch_rec_on_send(node, me, la, CEC_OP_RECORD_SRC_ANALOG, rec_status)); + fail_on_test(rec_status != CEC_OP_RECORD_STATUS_ANA_SERVICE && + rec_status != CEC_OP_RECORD_STATUS_NO_ANA_SERVICE && + rec_status != CEC_OP_RECORD_STATUS_NO_SERVICE && + !one_touch_rec_common(rec_status)); + + fail_on_test(one_touch_rec_on_send(node, me, la, CEC_OP_RECORD_SRC_EXT_PLUG, rec_status)); + fail_on_test(rec_status != CEC_OP_RECORD_STATUS_EXT_INPUT && + rec_status != CEC_OP_RECORD_STATUS_INVALID_EXT_PLUG && + !one_touch_rec_common(rec_status)); + + fail_on_test(one_touch_rec_on_send(node, me, la, CEC_OP_RECORD_SRC_EXT_PHYS_ADDR, rec_status)); + fail_on_test(rec_status != CEC_OP_RECORD_STATUS_EXT_INPUT && + rec_status != CEC_OP_RECORD_STATUS_INVALID_EXT_PHYS_ADDR && + !one_touch_rec_common(rec_status)); + + return OK; +} + +static int one_touch_rec_on_invalid(struct node *node, unsigned me, unsigned la, bool interactive) +{ + struct cec_msg msg; + + cec_msg_init(&msg, me, la); + cec_msg_record_on_own(&msg); + msg.msg[2] = 0; /* Invalid source operand */ + fail_on_test(!transmit_timeout(node, &msg)); + if (unrecognized_op(&msg)) + return OK_NOT_SUPPORTED; + fail_on_test(!cec_msg_status_is_abort(&msg)); + fail_on_test(abort_reason(&msg) != CEC_OP_ABORT_INVALID_OP); + + cec_msg_init(&msg, me, la); + cec_msg_record_on_own(&msg); + msg.msg[2] = 6; /* Invalid source operand */ + fail_on_test(!transmit_timeout(node, &msg)); + if (unrecognized_op(&msg)) + return OK_NOT_SUPPORTED; + fail_on_test(!cec_msg_status_is_abort(&msg)); + fail_on_test(abort_reason(&msg) != CEC_OP_ABORT_INVALID_OP); + + return OK; } static int one_touch_rec_off(struct node *node, unsigned me, unsigned la, bool interactive) @@ -1260,7 +1346,12 @@ static int one_touch_rec_off(struct node *node, unsigned me, unsigned la, bool i static const vec_remote_subtests one_touch_rec_subtests{ { "Record TV Screen", CEC_LOG_ADDR_MASK_TV, one_touch_rec_tv_screen }, - { "Record On", CEC_LOG_ADDR_MASK_RECORD, one_touch_rec_on }, + { "Record On", CEC_LOG_ADDR_MASK_RECORD | CEC_LOG_ADDR_MASK_BACKUP, one_touch_rec_on }, + { + "Record On Invalid Operand", + CEC_LOG_ADDR_MASK_RECORD | CEC_LOG_ADDR_MASK_BACKUP, + one_touch_rec_on_invalid, + }, { "Record Off", CEC_LOG_ADDR_MASK_RECORD, one_touch_rec_off }, }; diff --git a/utils/cec-follower/cec-tuner.cpp b/utils/cec-follower/cec-tuner.cpp index fd11bd10..ebceb064 100644 --- a/utils/cec-follower/cec-tuner.cpp +++ b/utils/cec-follower/cec-tuner.cpp @@ -606,10 +606,34 @@ void process_tuner_record_timer_msgs(struct node *node, struct cec_msg &msg, uns return; } case CEC_MSG_RECORD_ON: - if (!cec_has_record(1 << me)) + if (!cec_has_record(1 << me) && !cec_has_backup(1 << me)) + break; + + struct cec_op_record_src rec_src; + __u8 rec_status; + + cec_ops_record_on(&msg, &rec_src); + + switch (rec_src.type) { + case CEC_OP_RECORD_SRC_OWN: + rec_status = CEC_OP_RECORD_STATUS_CUR_SRC; + break; + case CEC_OP_RECORD_SRC_DIGITAL: + rec_status = CEC_OP_RECORD_STATUS_DIG_SERVICE; break; + case CEC_OP_RECORD_SRC_ANALOG: + rec_status = CEC_OP_RECORD_STATUS_ANA_SERVICE; + break; + case CEC_OP_RECORD_SRC_EXT_PLUG: + case CEC_OP_RECORD_SRC_EXT_PHYS_ADDR: + rec_status = CEC_OP_RECORD_STATUS_EXT_INPUT; + break; + default: + reply_feature_abort(node, &msg, CEC_OP_ABORT_INVALID_OP); + return; + } cec_msg_set_reply_to(&msg, &msg); - cec_msg_record_status(&msg, CEC_OP_RECORD_STATUS_CUR_SRC); + cec_msg_record_status(&msg, rec_status); transmit(node, &msg); return; case CEC_MSG_RECORD_OFF: