aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2016-10-01 18:22:51 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2017-08-22 17:06:14 +0200
commitba70fbedc19b4a8a70eee89ea7280e47dbcb865e (patch)
tree4e678c4957ae752de844bd52612518abd2e9be98
parent6ce40e200f3ff089d67445098f42816a17922a40 (diff)
cec: add support for the Hospitality Profile
This patch adds support for the CEC standard of the Hospitality Technology Next Generation association: https://htng.site-ym.com/resource/collection/0F424615-23F0-4CBB-AFA9-F381C0DB6ACF/2014-06-17_EDC-Hospitality_Profile_for_HDMI_CEC_v1_3-FINAL.docx.doc I finally managed to get hold of a display that implemented this so I could test it. Currently the cec-htng headers are maintained here, but this might change in the future. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--utils/cec-compliance/Makefile.am7
-rw-r--r--utils/cec-compliance/cec-compliance.h1
-rw-r--r--utils/cec-ctl/Makefile.am14
-rw-r--r--utils/cec-ctl/cec-ctl.cpp37
-rw-r--r--utils/cec-ctl/cec-pin.cpp1
-rwxr-xr-xutils/cec-ctl/msg2ctl.pl29
-rw-r--r--utils/cec-follower/Makefile.am16
-rw-r--r--utils/cec-follower/cec-follower.h1
-rw-r--r--utils/common/cec-htng-funcs.h897
-rw-r--r--utils/common/cec-htng.h172
-rw-r--r--utils/common/cec-log.cpp51
11 files changed, 1198 insertions, 28 deletions
diff --git a/utils/cec-compliance/Makefile.am b/utils/cec-compliance/Makefile.am
index 3caaebb5..0a1c17bd 100644
--- a/utils/cec-compliance/Makefile.am
+++ b/utils/cec-compliance/Makefile.am
@@ -8,8 +8,11 @@ cec_compliance_LDFLAGS = -lrt
cec-compliance.cpp: cec-table.h
cec-table.h: $(top_srcdir)/utils/cec-ctl/msg2ctl.pl $(top_srcdir)/include/linux/cec.h \
- $(top_srcdir)/include/linux/cec-funcs.h
- $(top_srcdir)/utils/cec-ctl/msg2ctl.pl 2 $(top_srcdir)/include/linux/cec.h $(top_srcdir)/include/linux/cec-funcs.h >$@
+ $(top_srcdir)/utils/common/cec-htng.h $(top_srcdir)/include/linux/cec-funcs.h \
+ $(top_srcdir)/utils/common/cec-htng-funcs.h
+ $(top_srcdir)/utils/cec-ctl/msg2ctl.pl 2 $(top_srcdir)/include/linux/cec.h \
+ $(top_srcdir)/utils/common/cec-htng.h $(top_srcdir)/include/linux/cec-funcs.h \
+ $(top_srcdir)/utils/common/cec-htng-funcs.h >$@
cec-compliance.cpp: version.h
diff --git a/utils/cec-compliance/cec-compliance.h b/utils/cec-compliance/cec-compliance.h
index 7ce44620..4775908d 100644
--- a/utils/cec-compliance/cec-compliance.h
+++ b/utils/cec-compliance/cec-compliance.h
@@ -24,6 +24,7 @@
#include <cerrno>
#include <string>
#include <linux/cec-funcs.h>
+#include "cec-htng-funcs.h"
#ifdef ANDROID
#include <android-config.h>
diff --git a/utils/cec-ctl/Makefile.am b/utils/cec-ctl/Makefile.am
index 82e03302..96dd0263 100644
--- a/utils/cec-ctl/Makefile.am
+++ b/utils/cec-ctl/Makefile.am
@@ -9,11 +9,17 @@ cec-ctl.cpp: cec-ctl-gen.h
cec-pin.cpp: cec-pin-gen.h
-cec-ctl-gen.h: msg2ctl.pl ../../include/linux/cec.h ../../include/linux/cec-funcs.h
- $(top_srcdir)/utils/cec-ctl/msg2ctl.pl 0 $(top_srcdir)/include/linux/cec.h $(top_srcdir)/include/linux/cec-funcs.h >$@
+cec-ctl-gen.h: msg2ctl.pl $(top_srcdir)/include/linux/cec.h $(top_srcdir)/include/linux/cec-funcs.h \
+ $(top_srcdir)/utils/common/cec-htng.h $(top_srcdir)/utils/common/cec-htng-funcs.h
+ $(top_srcdir)/utils/cec-ctl/msg2ctl.pl 0 $(top_srcdir)/include/linux/cec.h \
+ $(top_srcdir)/utils/common/cec-htng.h $(top_srcdir)/include/linux/cec-funcs.h \
+ $(top_srcdir)/utils/common/cec-htng-funcs.h >$@
-cec-pin-gen.h: msg2ctl.pl ../../include/linux/cec.h ../../include/linux/cec-funcs.h
- $(top_srcdir)/utils/cec-ctl/msg2ctl.pl 2 $(top_srcdir)/include/linux/cec.h $(top_srcdir)/include/linux/cec-funcs.h >$@
+cec-pin-gen.h: msg2ctl.pl $(top_srcdir)/include/linux/cec.h $(top_srcdir)/include/linux/cec-funcs.h \
+ $(top_srcdir)/utils/common/cec-htng.h $(top_srcdir)/utils/common/cec-htng-funcs.h
+ $(top_srcdir)/utils/cec-ctl/msg2ctl.pl 2 $(top_srcdir)/include/linux/cec.h \
+ $(top_srcdir)/utils/common/cec-htng.h $(top_srcdir)/include/linux/cec-funcs.h \
+ $(top_srcdir)/utils/common/cec-htng-funcs.h >$@
clean-local:
-rm -vf cec-ctl-gen.h cec-pin-gen.h
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index 2a43ea6e..fda5e1cb 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -36,6 +36,7 @@
#include <map>
#include <algorithm>
#include <linux/cec-funcs.h>
+#include "cec-htng-funcs.h"
#ifdef __ANDROID__
#include <android-config.h>
@@ -499,6 +500,7 @@ static void log_features(const struct arg *arg, const char *arg_name, const __u8
static void log_ui_command(const char *arg_name, const struct cec_op_ui_command *ui_cmd);
static void log_descriptors(const char *arg_name, unsigned num, const __u32 *descriptors);
static void log_u8_array(const char *arg_name, unsigned num, const __u8 *vals);
+static void log_htng_unknown_msg(const struct cec_msg *msg);
static void log_unknown_msg(const struct cec_msg *msg);
#define VENDOR_EXTRA \
@@ -990,6 +992,22 @@ static void log_raw_msg(const struct cec_msg *msg)
printf("\n");
}
+static void log_htng_unknown_msg(const struct cec_msg *msg)
+{
+ __u32 vendor_id;
+ const __u8 *bytes;
+ __u8 size;
+ unsigned i;
+
+ cec_ops_vendor_command_with_id(msg, &vendor_id, &size, &bytes);
+ printf("CEC_MSG_VENDOR_COMMAND_WITH_ID:\n");
+ log_arg(&arg_vendor_id, "vendor-id", vendor_id);
+ printf("\tvendor-specific-data:");
+ for (i = 0; i < size; i++)
+ printf(" 0x%02x", bytes[i]);
+ printf("\n");
+}
+
static void log_unknown_msg(const struct cec_msg *msg)
{
__u32 vendor_id;
@@ -1008,13 +1026,20 @@ static void log_unknown_msg(const struct cec_msg *msg)
printf("\n");
break;
case CEC_MSG_VENDOR_COMMAND_WITH_ID:
- printf("CEC_MSG_VENDOR_COMMAND_WITH_ID:\n");
cec_ops_vendor_command_with_id(msg, &vendor_id, &size, &bytes);
- log_arg(&arg_vendor_id, "vendor-id", vendor_id);
- printf("\tvendor-specific-data:");
- for (i = 0; i < size; i++)
- printf(" 0x%02x", bytes[i]);
- printf("\n");
+ switch (vendor_id) {
+ case VENDOR_ID_HTNG:
+ log_htng_msg(msg);
+ break;
+ default:
+ printf("CEC_MSG_VENDOR_COMMAND_WITH_ID:\n");
+ log_arg(&arg_vendor_id, "vendor-id", vendor_id);
+ printf("\tvendor-specific-data:");
+ for (i = 0; i < size; i++)
+ printf(" 0x%02x", bytes[i]);
+ printf("\n");
+ break;
+ }
break;
case CEC_MSG_VENDOR_REMOTE_BUTTON_DOWN:
printf("CEC_MSG_VENDOR_REMOTE_BUTTON_DOWN:\n");
diff --git a/utils/cec-ctl/cec-pin.cpp b/utils/cec-ctl/cec-pin.cpp
index b6df3810..3b7f1d95 100644
--- a/utils/cec-ctl/cec-pin.cpp
+++ b/utils/cec-ctl/cec-pin.cpp
@@ -34,6 +34,7 @@
#include <vector>
#include <algorithm>
#include <linux/cec.h>
+#include "cec-htng.h"
#ifdef __ANDROID__
#include <android-config.h>
diff --git a/utils/cec-ctl/msg2ctl.pl b/utils/cec-ctl/msg2ctl.pl
index 446b4fee..716a11ba 100755
--- a/utils/cec-ctl/msg2ctl.pl
+++ b/utils/cec-ctl/msg2ctl.pl
@@ -70,6 +70,12 @@ sub process_func
$logswitch .= "\tcase CEC_MSG_CDC_MESSAGE:\n";
$logswitch .= "\tswitch (msg->msg[4]) {\n";
}
+ if ($cec_msg =~ /_HTNG_/ && !$htng_case) {
+ $htng_case = 1;
+ $cdc_case = 0;
+ $std_logswitch = $logswitch;
+ $logswitch = "";
+ }
if ($cdc_case) {
$cdcmsgtable .= "\t{ $cec_msg, \"$msg_name\" },\n";
} else {
@@ -372,6 +378,7 @@ while (<>) {
}
next if /^\s*$/;
next if /cec_msg_reply_feature_abort/;
+ next if /cec_msg_htng_init/;
if (/^static inline void cec_msg.*\(.*\)/) {
s/static\sinline\svoid\s//;
s/struct cec_msg \*msg, //;
@@ -475,7 +482,7 @@ void log_msg(const struct cec_msg *msg)
switch (msg->msg[1]) {
EOF
-printf "%s", $logswitch;
+printf "%s", $std_logswitch;
print <<'EOF';
default:
log_unknown_msg(msg);
@@ -494,3 +501,23 @@ status:
printf("\t%s\n", status2s(*msg).c_str());
}
EOF
+print <<'EOF';
+void log_htng_msg(const struct cec_msg *msg)
+{
+ if ((msg->tx_status && !(msg->tx_status & CEC_TX_STATUS_OK)) ||
+ (msg->rx_status && !(msg->rx_status & (CEC_RX_STATUS_OK | CEC_RX_STATUS_FEATURE_ABORT))))
+ printf("\t%s\n", status2s(*msg).c_str());
+
+ if (msg->len < 6)
+ return;
+
+ switch (msg->msg[5]) {
+EOF
+printf "%s", $logswitch;
+print <<'EOF';
+ default:
+ log_htng_unknown_msg(msg);
+ break;
+ }
+}
+EOF
diff --git a/utils/cec-follower/Makefile.am b/utils/cec-follower/Makefile.am
index e1585681..44a57376 100644
--- a/utils/cec-follower/Makefile.am
+++ b/utils/cec-follower/Makefile.am
@@ -7,13 +7,21 @@ cec_follower_LDFLAGS = -lrt
cec-log.cpp: cec-log.h
-cec-log.h: ../cec-ctl/msg2ctl.pl ../../include/linux/cec.h ../../include/linux/cec-funcs.h
- $(top_srcdir)/utils/cec-ctl/msg2ctl.pl 1 $(top_srcdir)/include/linux/cec.h $(top_srcdir)/include/linux/cec-funcs.h >$@
+cec-log.h: $(top_srcdir)/utils/cec-ctl/msg2ctl.pl $(top_srcdir)/include/linux/cec.h \
+ $(top_srcdir)/utils/common/cec-htng.h $(top_srcdir)/include/linux/cec-funcs.h \
+ $(top_srcdir)/utils/common/cec-htng-funcs.h
+ $(top_srcdir)/utils/cec-ctl/msg2ctl.pl 1 $(top_srcdir)/include/linux/cec.h \
+ $(top_srcdir)/utils/common/cec-htng.h $(top_srcdir)/include/linux/cec-funcs.h \
+ $(top_srcdir)/utils/common/cec-htng-funcs.h >$@
cec-follower.cpp: cec-table.h version.h
-cec-table.h: ../cec-ctl/msg2ctl.pl ../../include/linux/cec.h ../../include/linux/cec-funcs.h
- $(top_srcdir)/utils/cec-ctl/msg2ctl.pl 2 $(top_srcdir)/include/linux/cec.h $(top_srcdir)/include/linux/cec-funcs.h >$@
+cec-table.h: $(top_srcdir)/utils/cec-ctl/msg2ctl.pl $(top_srcdir)/include/linux/cec.h \
+ $(top_srcdir)/utils/common/cec-htng.h $(top_srcdir)/include/linux/cec-funcs.h \
+ $(top_srcdir)/utils/common/cec-htng-funcs.h
+ $(top_srcdir)/utils/cec-ctl/msg2ctl.pl 2 $(top_srcdir)/include/linux/cec.h \
+ $(top_srcdir)/utils/common/cec-htng.h $(top_srcdir)/include/linux/cec-funcs.h \
+ $(top_srcdir)/utils/common/cec-htng-funcs.h >$@
version.h:
@if git -C $(srcdir) rev-parse HEAD >/dev/null 2>&1; then \
diff --git a/utils/cec-follower/cec-follower.h b/utils/cec-follower/cec-follower.h
index 0f624779..e6342660 100644
--- a/utils/cec-follower/cec-follower.h
+++ b/utils/cec-follower/cec-follower.h
@@ -40,6 +40,7 @@
#include <cerrno>
#include <string>
#include <linux/cec-funcs.h>
+#include "cec-htng-funcs.h"
#ifdef ANDROID
#include <android-config.h>
diff --git a/utils/common/cec-htng-funcs.h b/utils/common/cec-htng-funcs.h
new file mode 100644
index 00000000..a707ba5f
--- /dev/null
+++ b/utils/common/cec-htng-funcs.h
@@ -0,0 +1,897 @@
+/*
+ * cec-htng-funcs - HDMI CEC wrapper functions for Hospitality Profile
+ *
+ * Copyright 2016-2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
+ *
+ * This program is free software; you may redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * Alternatively you can redistribute this file under the terms of the
+ * BSD license as stated below:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. The names of its contributors may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef _CEC_HTNG_FUNCS_H
+#define _CEC_HTNG_FUNCS_H
+
+#include "cec-htng.h"
+
+static inline void cec_msg_htng_init(struct cec_msg *msg, __u8 op)
+{
+ msg->len = 6;
+ msg->msg[1] = CEC_MSG_VENDOR_COMMAND_WITH_ID;
+ msg->msg[2] = VENDOR_ID_HTNG >> 16;
+ msg->msg[3] = (VENDOR_ID_HTNG >> 8) & 0xff;
+ msg->msg[4] = VENDOR_ID_HTNG & 0xff;
+ msg->msg[5] = op;
+}
+
+/* HTNG Feature */
+static inline void cec_msg_htng_tuner_1part_chan(struct cec_msg *msg,
+ __u8 htng_tuner_type,
+ __u16 chan)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_TUNER_1PART_CHAN);
+ msg->msg[msg->len++] = htng_tuner_type;
+ msg->msg[msg->len++] = chan >> 8;
+ msg->msg[msg->len++] = chan & 0xff;
+}
+
+static inline void cec_ops_htng_tuner_1part_chan(const struct cec_msg *msg,
+ __u8 *htng_tuner_type,
+ __u16 *chan)
+{
+ *htng_tuner_type = msg->msg[6];
+ *chan = (msg->msg[7] << 8) | msg->msg[8];
+}
+
+static inline void cec_msg_htng_tuner_2part_chan(struct cec_msg *msg,
+ __u8 htng_tuner_type,
+ __u8 major_chan,
+ __u16 minor_chan)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_TUNER_2PART_CHAN);
+ msg->msg[msg->len++] = htng_tuner_type;
+ msg->msg[msg->len++] = major_chan;
+ msg->msg[msg->len++] = minor_chan >> 8;
+ msg->msg[msg->len++] = minor_chan & 0xff;
+}
+
+static inline void cec_ops_htng_tuner_2part_chan(const struct cec_msg *msg,
+ __u8 *htng_tuner_type,
+ __u8 *major_chan,
+ __u16 *minor_chan)
+{
+ *htng_tuner_type = msg->msg[6];
+ *major_chan = msg->msg[7];
+ *minor_chan = (msg->msg[8] << 8) | msg->msg[9];
+}
+
+static inline void cec_msg_htng_input_sel_av(struct cec_msg *msg,
+ __u16 input)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_INPUT_SEL_AV);
+ msg->msg[msg->len++] = input >> 8;
+ msg->msg[msg->len++] = input & 0xff;
+}
+
+static inline void cec_ops_htng_input_sel_av(const struct cec_msg *msg,
+ __u16 *input)
+{
+ *input = (msg->msg[6] << 8) | msg->msg[7];
+}
+
+static inline void cec_msg_htng_input_sel_pc(struct cec_msg *msg,
+ __u16 input)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_INPUT_SEL_PC);
+ msg->msg[msg->len++] = input >> 8;
+ msg->msg[msg->len++] = input & 0xff;
+}
+
+static inline void cec_ops_htng_input_sel_pc(const struct cec_msg *msg,
+ __u16 *input)
+{
+ *input = (msg->msg[6] << 8) | msg->msg[7];
+}
+
+static inline void cec_msg_htng_input_sel_hdmi(struct cec_msg *msg,
+ __u16 input)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_INPUT_SEL_HDMI);
+ msg->msg[msg->len++] = input >> 8;
+ msg->msg[msg->len++] = input & 0xff;
+}
+
+static inline void cec_ops_htng_input_sel_hdmi(const struct cec_msg *msg,
+ __u16 *input)
+{
+ *input = (msg->msg[6] << 8) | msg->msg[7];
+}
+
+static inline void cec_msg_htng_input_sel_component(struct cec_msg *msg,
+ __u16 input)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_INPUT_SEL_COMPONENT);
+ msg->msg[msg->len++] = input >> 8;
+ msg->msg[msg->len++] = input & 0xff;
+}
+
+static inline void cec_ops_htng_input_sel_component(const struct cec_msg *msg,
+ __u16 *input)
+{
+ *input = (msg->msg[6] << 8) | msg->msg[7];
+}
+
+static inline void cec_msg_htng_input_sel_dvi(struct cec_msg *msg,
+ __u16 input)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_INPUT_SEL_DVI);
+ msg->msg[msg->len++] = input >> 8;
+ msg->msg[msg->len++] = input & 0xff;
+}
+
+static inline void cec_ops_htng_input_sel_dvi(const struct cec_msg *msg,
+ __u16 *input)
+{
+ *input = (msg->msg[6] << 8) | msg->msg[7];
+}
+
+static inline void cec_msg_htng_input_sel_dp(struct cec_msg *msg,
+ __u16 input)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_INPUT_SEL_DP);
+ msg->msg[msg->len++] = input >> 8;
+ msg->msg[msg->len++] = input & 0xff;
+}
+
+static inline void cec_ops_htng_input_sel_dp(const struct cec_msg *msg,
+ __u16 *input)
+{
+ *input = (msg->msg[6] << 8) | msg->msg[7];
+}
+
+static inline void cec_msg_htng_input_sel_usb(struct cec_msg *msg,
+ __u16 input)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_INPUT_SEL_USB);
+ msg->msg[msg->len++] = input >> 8;
+ msg->msg[msg->len++] = input & 0xff;
+}
+
+static inline void cec_ops_htng_input_sel_usb(const struct cec_msg *msg,
+ __u16 *input)
+{
+ *input = (msg->msg[6] << 8) | msg->msg[7];
+}
+
+static inline void cec_msg_htng_set_def_pwr_on_input_src(struct cec_msg *msg,
+ __u8 htng_input_src,
+ __u8 htng_tuner_type,
+ __u8 major,
+ __u16 input)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_DEF_PWR_ON_INPUT_SRC);
+ msg->msg[msg->len++] = htng_input_src;
+ msg->msg[msg->len++] = htng_tuner_type;
+ if (htng_input_src == CEC_OP_HTNG_INPUT_SRC_TUNER_2PART)
+ msg->msg[msg->len++] = major;
+ msg->msg[msg->len++] = input >> 8;
+ msg->msg[msg->len++] = input & 0xff;
+ if (htng_input_src != CEC_OP_HTNG_INPUT_SRC_TUNER_2PART)
+ msg->msg[msg->len++] = 0;
+}
+
+static inline void cec_ops_htng_set_def_pwr_on_input_src(const struct cec_msg *msg,
+ __u8 *htng_input_src,
+ __u8 *htng_tuner_type,
+ __u8 *major,
+ __u16 *input)
+{
+ *htng_input_src = msg->msg[6];
+ *htng_tuner_type = msg->msg[7];
+ if (*htng_input_src == CEC_OP_HTNG_INPUT_SRC_TUNER_2PART) {
+ *major = msg->msg[8];
+ *input = (msg->msg[9] << 8) | msg->msg[10];
+ } else {
+ *major = 0;
+ *input = (msg->msg[8] << 8) | msg->msg[9];
+ }
+}
+
+static inline void cec_msg_htng_set_tv_speakers(struct cec_msg *msg,
+ __u8 on)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_TV_SPEAKERS);
+ msg->msg[msg->len++] = on;
+}
+
+static inline void cec_ops_htng_set_tv_speakers(const struct cec_msg *msg,
+ __u8 *on)
+{
+ *on = msg->msg[6];
+}
+
+static inline void cec_msg_htng_set_dig_audio(struct cec_msg *msg,
+ __u8 on)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_DIG_AUDIO);
+ msg->msg[msg->len++] = on;
+}
+
+static inline void cec_ops_htng_set_dig_audio(const struct cec_msg *msg,
+ __u8 *on)
+{
+ *on = msg->msg[6];
+}
+
+static inline void cec_msg_htng_set_ana_audio(struct cec_msg *msg,
+ __u8 on)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_ANA_AUDIO);
+ msg->msg[msg->len++] = on;
+}
+
+static inline void cec_ops_htng_set_ana_audio(const struct cec_msg *msg,
+ __u8 *on)
+{
+ *on = msg->msg[6];
+}
+
+static inline void cec_msg_htng_set_def_pwr_on_vol(struct cec_msg *msg,
+ __u8 vol)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_DEF_PWR_ON_VOL);
+ msg->msg[msg->len++] = vol;
+}
+
+static inline void cec_ops_htng_set_def_pwr_on_vol(const struct cec_msg *msg,
+ __u8 *vol)
+{
+ *vol = msg->msg[6];
+}
+
+static inline void cec_msg_htng_set_max_vol(struct cec_msg *msg,
+ __u8 vol)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_MAX_VOL);
+ msg->msg[msg->len++] = vol;
+}
+
+static inline void cec_ops_htng_set_max_vol(const struct cec_msg *msg,
+ __u8 *vol)
+{
+ *vol = msg->msg[6];
+}
+
+static inline void cec_msg_htng_set_min_vol(struct cec_msg *msg,
+ __u8 vol)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_MIN_VOL);
+ msg->msg[msg->len++] = vol;
+}
+
+static inline void cec_ops_htng_set_min_vol(const struct cec_msg *msg,
+ __u8 *vol)
+{
+ *vol = msg->msg[6];
+}
+
+static inline void cec_msg_htng_set_blue_screen(struct cec_msg *msg,
+ __u8 blue)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_BLUE_SCREEN);
+ msg->msg[msg->len++] = blue;
+}
+
+static inline void cec_ops_htng_set_blue_screen(const struct cec_msg *msg,
+ __u8 *blue)
+{
+ *blue = msg->msg[6];
+}
+
+static inline void cec_msg_htng_set_brightness(struct cec_msg *msg,
+ __u8 brightness)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_BRIGHTNESS);
+ msg->msg[msg->len++] = brightness;
+}
+
+static inline void cec_ops_htng_set_brightness(const struct cec_msg *msg,
+ __u8 *brightness)
+{
+ *brightness = msg->msg[6];
+}
+
+static inline void cec_msg_htng_set_color(struct cec_msg *msg,
+ __u8 color)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_COLOR);
+ msg->msg[msg->len++] = color;
+}
+
+static inline void cec_ops_htng_set_color(const struct cec_msg *msg,
+ __u8 *color)
+{
+ *color = msg->msg[6];
+}
+
+static inline void cec_msg_htng_set_contrast(struct cec_msg *msg,
+ __u8 contrast)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_CONTRAST);
+ msg->msg[msg->len++] = contrast;
+}
+
+static inline void cec_ops_htng_set_contrast(const struct cec_msg *msg,
+ __u8 *contrast)
+{
+ *contrast = msg->msg[6];
+}
+
+static inline void cec_msg_htng_set_sharpness(struct cec_msg *msg,
+ __u8 sharpness)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_SHARPNESS);
+ msg->msg[msg->len++] = sharpness;
+}
+
+static inline void cec_ops_htng_set_sharpness(const struct cec_msg *msg,
+ __u8 *sharpness)
+{
+ *sharpness = msg->msg[6];
+}
+
+static inline void cec_msg_htng_set_hue(struct cec_msg *msg,
+ __u8 hue)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_HUE);
+ msg->msg[msg->len++] = hue;
+}
+
+static inline void cec_ops_htng_set_hue(const struct cec_msg *msg,
+ __u8 *hue)
+{
+ *hue = msg->msg[6];
+}
+
+static inline void cec_msg_htng_set_led_backlight(struct cec_msg *msg,
+ __u8 led_backlight)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_LED_BACKLIGHT);
+ msg->msg[msg->len++] = led_backlight;
+}
+
+static inline void cec_ops_htng_set_led_backlight(const struct cec_msg *msg,
+ __u8 *led_backlight)
+{
+ *led_backlight = msg->msg[6];
+}
+
+static inline void cec_msg_htng_set_tv_osd_control(struct cec_msg *msg,
+ __u8 on)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_TV_OSD_CONTROL);
+ msg->msg[msg->len++] = on;
+}
+
+static inline void cec_ops_htng_set_tv_osd_control(const struct cec_msg *msg,
+ __u8 *on)
+{
+ *on = msg->msg[6];
+}
+
+static inline void cec_msg_htng_set_audio_only_display(struct cec_msg *msg,
+ __u8 on)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_AUDIO_ONLY_DISPLAY);
+ msg->msg[msg->len++] = on;
+}
+
+static inline void cec_ops_htng_set_audio_only_display(const struct cec_msg *msg,
+ __u8 *on)
+{
+ *on = msg->msg[6];
+}
+
+static inline void cec_msg_htng_set_date(struct cec_msg *msg,
+ const char *date)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_DATE);
+ memcpy(msg->msg + msg->len, date, 8);
+ msg->len += 8;
+}
+
+static inline void cec_ops_htng_set_date(const struct cec_msg *msg,
+ char *date)
+{
+ memcpy(date, msg->msg + 6, 8);
+ date[8] = '\0';
+}
+
+static inline void cec_msg_htng_set_date_format(struct cec_msg *msg,
+ __u8 ddmm)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_DATE_FORMAT);
+ msg->msg[msg->len++] = ddmm;
+}
+
+static inline void cec_ops_htng_set_date_format(const struct cec_msg *msg,
+ __u8 *ddmm)
+{
+ *ddmm = msg->msg[6];
+}
+
+static inline void cec_msg_htng_set_time(struct cec_msg *msg,
+ const char *time)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_TIME);
+ memcpy(msg->msg + msg->len, time, 6);
+ msg->len += 6;
+}
+
+static inline void cec_ops_htng_set_time(const struct cec_msg *msg,
+ char *time)
+{
+ memcpy(time, msg->msg + 6, 6);
+ time[6] = '\0';
+}
+
+static inline void cec_msg_htng_set_clk_brightness_standby(struct cec_msg *msg,
+ __u8 brightness)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_CLK_BRIGHTNESS_STANDBY);
+ msg->msg[msg->len++] = brightness;
+}
+
+static inline void cec_ops_htng_set_clk_brightness_standby(const struct cec_msg *msg,
+ __u8 *brightness)
+{
+ *brightness = msg->msg[6];
+}
+
+static inline void cec_msg_htng_set_clk_brightness_on(struct cec_msg *msg,
+ __u8 brightness)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_CLK_BRIGHTNESS_ON);
+ msg->msg[msg->len++] = brightness;
+}
+
+static inline void cec_ops_htng_set_clk_brightness_on(const struct cec_msg *msg,
+ __u8 *brightness)
+{
+ *brightness = msg->msg[6];
+}
+
+static inline void cec_msg_htng_led_control(struct cec_msg *msg,
+ __u8 htng_led_control)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_LED_CONTROL);
+ msg->msg[msg->len++] = htng_led_control;
+}
+
+static inline void cec_ops_htng_led_control(const struct cec_msg *msg,
+ __u8 *htng_led_control)
+{
+ *htng_led_control = msg->msg[6];
+}
+
+static inline void cec_msg_htng_lock_tv_pwr_button(struct cec_msg *msg,
+ __u8 on)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_LOCK_TV_PWR_BUTTON);
+ msg->msg[msg->len++] = on;
+}
+
+static inline void cec_ops_htng_lock_tv_pwr_button(const struct cec_msg *msg,
+ __u8 *on)
+{
+ *on = msg->msg[6];
+}
+
+static inline void cec_msg_htng_lock_tv_vol_buttons(struct cec_msg *msg,
+ __u8 on)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_LOCK_TV_VOL_BUTTONS);
+ msg->msg[msg->len++] = on;
+}
+
+static inline void cec_ops_htng_lock_tv_vol_buttons(const struct cec_msg *msg,
+ __u8 *on)
+{
+ *on = msg->msg[6];
+}
+
+static inline void cec_msg_htng_lock_tv_chan_buttons(struct cec_msg *msg,
+ __u8 on)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_LOCK_TV_CHAN_BUTTONS);
+ msg->msg[msg->len++] = on;
+}
+
+static inline void cec_ops_htng_lock_tv_chan_buttons(const struct cec_msg *msg,
+ __u8 *on)
+{
+ *on = msg->msg[6];
+}
+
+static inline void cec_msg_htng_lock_tv_input_buttons(struct cec_msg *msg,
+ __u8 on)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_LOCK_TV_INPUT_BUTTONS);
+ msg->msg[msg->len++] = on;
+}
+
+static inline void cec_ops_htng_lock_tv_input_buttons(const struct cec_msg *msg,
+ __u8 *on)
+{
+ *on = msg->msg[6];
+}
+
+static inline void cec_msg_htng_lock_tv_other_buttons(struct cec_msg *msg,
+ __u8 on)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_LOCK_TV_OTHER_BUTTONS);
+ msg->msg[msg->len++] = on;
+}
+
+static inline void cec_ops_htng_lock_tv_other_buttons(const struct cec_msg *msg,
+ __u8 *on)
+{
+ *on = msg->msg[6];
+}
+
+static inline void cec_msg_htng_lock_everything(struct cec_msg *msg,
+ __u8 on)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_LOCK_EVERYTHING);
+ msg->msg[msg->len++] = on;
+}
+
+static inline void cec_ops_htng_lock_everything(const struct cec_msg *msg,
+ __u8 *on)
+{
+ *on = msg->msg[6];
+}
+
+static inline void cec_msg_htng_lock_everything_but_pwr(struct cec_msg *msg,
+ __u8 on)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_LOCK_EVERYTHING_BUT_PWR);
+ msg->msg[msg->len++] = on;
+}
+
+static inline void cec_ops_htng_lock_everything_but_pwr(const struct cec_msg *msg,
+ __u8 *on)
+{
+ *on = msg->msg[6];
+}
+
+static inline void cec_msg_htng_hotel_mode(struct cec_msg *msg,
+ __u8 on, __u8 options)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_HOTEL_MODE);
+ msg->msg[msg->len++] = on;
+ msg->msg[msg->len++] = options;
+}
+
+static inline void cec_ops_htng_hotel_mode(const struct cec_msg *msg,
+ __u8 *on, __u8 *options)
+{
+ *on = msg->msg[6];
+ *options = msg->msg[7];
+}
+
+static inline void cec_msg_htng_set_pwr_saving_profile(struct cec_msg *msg,
+ __u8 on, __u8 val)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_PWR_SAVING_PROFILE);
+ msg->msg[msg->len++] = on;
+ msg->msg[msg->len++] = val;
+}
+
+static inline void cec_ops_htng_set_pwr_saving_profile(const struct cec_msg *msg,
+ __u8 *on, __u8 *val)
+{
+ *on = msg->msg[6];
+ *val = msg->msg[7];
+}
+
+static inline void cec_msg_htng_set_sleep_timer(struct cec_msg *msg,
+ __u8 minutes)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_SLEEP_TIMER);
+ msg->msg[msg->len++] = minutes;
+}
+
+static inline void cec_ops_htng_set_sleep_timer(const struct cec_msg *msg,
+ __u8 *minutes)
+{
+ *minutes = msg->msg[6];
+}
+
+static inline void cec_msg_htng_set_wakeup_time(struct cec_msg *msg,
+ const char *time)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_WAKEUP_TIME);
+ memcpy(msg->msg + 6, time, 4);
+ msg->len += 4;
+}
+
+static inline void cec_ops_htng_set_wakeup_time(const struct cec_msg *msg,
+ char *time)
+{
+ memcpy(time, msg->msg + 6, 4);
+ time[4] = '\0';
+}
+
+static inline void cec_msg_htng_set_auto_off_time(struct cec_msg *msg,
+ const char *time)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_AUTO_OFF_TIME);
+ memcpy(msg->msg + 6, time, 4);
+ msg->len += 4;
+}
+
+static inline void cec_ops_htng_set_auto_off_time(const struct cec_msg *msg,
+ char *time)
+{
+ memcpy(time, msg->msg + 6, 4);
+ time[4] = '\0';
+}
+
+static inline void cec_msg_htng_set_wakeup_src(struct cec_msg *msg,
+ __u8 htng_input_src,
+ __u8 htng_tuner_type,
+ __u8 major,
+ __u16 input)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_WAKEUP_SRC);
+ msg->msg[msg->len++] = htng_input_src;
+ msg->msg[msg->len++] = htng_tuner_type;
+ if (htng_input_src == CEC_OP_HTNG_INPUT_SRC_TUNER_2PART)
+ msg->msg[msg->len++] = major;
+ msg->msg[msg->len++] = input >> 8;
+ msg->msg[msg->len++] = input & 0xff;
+ if (htng_input_src != CEC_OP_HTNG_INPUT_SRC_TUNER_2PART)
+ msg->msg[msg->len++] = 0;
+}
+
+static inline void cec_ops_htng_set_wakeup_src(const struct cec_msg *msg,
+ __u8 *htng_input_src,
+ __u8 *htng_tuner_type,
+ __u8 *major,
+ __u16 *input)
+{
+ *htng_input_src = msg->msg[6];
+ *htng_tuner_type = msg->msg[7];
+ if (*htng_input_src == CEC_OP_HTNG_INPUT_SRC_TUNER_2PART) {
+ *major = msg->msg[8];
+ *input = (msg->msg[9] << 8) | msg->msg[10];
+ } else {
+ *major = 0;
+ *input = (msg->msg[8] << 8) | msg->msg[9];
+ }
+}
+
+static inline void cec_msg_htng_set_init_wakeup_vol(struct cec_msg *msg,
+ __u8 vol,
+ __u8 minutes)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_SET_INIT_WAKEUP_VOL);
+ msg->msg[msg->len++] = vol;
+ msg->msg[msg->len++] = minutes;
+}
+
+static inline void cec_ops_htng_set_init_wakeup_vol(const struct cec_msg *msg,
+ __u8 *vol,
+ __u8 *minutes)
+{
+ *vol = msg->msg[6];
+ *minutes = msg->msg[7];
+}
+
+static inline void cec_msg_htng_clr_all_sleep_wake(struct cec_msg *msg)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_CLR_ALL_SLEEP_WAKE);
+}
+
+static inline void cec_msg_htng_global_direct_tune_freq(struct cec_msg *msg,
+ __u8 htng_chan_type,
+ __u8 htng_prog_type,
+ __u8 htng_system_type,
+ __u16 freq,
+ __u16 service_id,
+ __u8 htng_mod_type,
+ __u8 htng_symbol_rate,
+ __u16 symbol_rate)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_GLOBAL_DIRECT_TUNE_FREQ);
+ msg->msg[msg->len++] = (htng_chan_type & 7) |
+ ((htng_prog_type & 1) << 3) |
+ (htng_system_type << 4);
+ msg->msg[msg->len++] = freq >> 8;
+ msg->msg[msg->len++] = freq & 0xff;
+ msg->msg[msg->len++] = service_id >> 8;
+ msg->msg[msg->len++] = service_id & 0xff;
+ msg->msg[msg->len++] = (htng_mod_type & 0xf) |
+ ((htng_symbol_rate & 1) << 7);
+ if (htng_symbol_rate == CEC_OP_HTNG_SYMBOL_RATE_MANUAL) {
+ msg->msg[msg->len++] = symbol_rate >> 8;
+ msg->msg[msg->len++] = symbol_rate & 0xff;
+ }
+}
+
+static inline void cec_ops_htng_global_direct_tune_freq(const struct cec_msg *msg,
+ __u8 *htng_chan_type,
+ __u8 *htng_prog_type,
+ __u8 *htng_system_type,
+ __u16 *freq,
+ __u16 *service_id,
+ __u8 *htng_mod_type,
+ __u8 *htng_symbol_rate,
+ __u16 *symbol_rate)
+{
+ *htng_chan_type = msg->msg[6] & 7;
+ *htng_prog_type = (msg->msg[6] >> 3) & 1;
+ *htng_system_type = (msg->msg[6] >> 4) & 0xf;
+ *freq = (msg->msg[7] << 8) | msg->msg[8];
+ *service_id = (msg->msg[9] << 8) | msg->msg[10];
+ *htng_mod_type = msg->msg[11] & 0xf;
+ *htng_symbol_rate = (msg->msg[11] >> 7) & 1;
+ if (*htng_symbol_rate == CEC_OP_HTNG_SYMBOL_RATE_MANUAL)
+ *symbol_rate = (msg->msg[12] << 8) | msg->msg[13];
+ else
+ *symbol_rate = 0;
+}
+
+static inline void cec_msg_htng_global_direct_tune_chan(struct cec_msg *msg,
+ __u8 htng_chan_type,
+ __u8 htng_prog_type,
+ __u16 chan)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_GLOBAL_DIRECT_TUNE_CHAN);
+ msg->msg[msg->len++] = (htng_chan_type & 7) |
+ ((htng_prog_type & 1) << 3);
+ msg->msg[msg->len++] = chan >> 8;
+ msg->msg[msg->len++] = chan & 0xff;
+}
+
+static inline void cec_ops_htng_global_direct_tune_chan(const struct cec_msg *msg,
+ __u8 *htng_chan_type,
+ __u8 *htng_prog_type,
+ __u16 *chan)
+{
+ *htng_chan_type = msg->msg[6] & 7;
+ *htng_prog_type = (msg->msg[6] >> 3) & 1;
+ *chan = (msg->msg[7] << 8) | msg->msg[8];
+}
+
+static inline void cec_msg_htng_global_direct_tune_ext_freq(struct cec_msg *msg,
+ __u8 htng_ext_chan_type,
+ __u8 htng_prog_type,
+ __u8 htng_system_type,
+ __u16 freq,
+ __u16 service_id,
+ __u8 htng_mod_type,
+ __u8 htng_onid,
+ __u16 onid,
+ __u8 htng_nid,
+ __u16 nid,
+ __u8 htng_tsid_plp,
+ __u16 tsid_plp,
+ __u8 htng_symbol_rate,
+ __u16 symbol_rate)
+{
+ cec_msg_htng_init(msg, CEC_MSG_HTNG_GLOBAL_DIRECT_TUNE_EXT_FREQ);
+ msg->msg[msg->len++] = (htng_ext_chan_type & 7) |
+ ((htng_prog_type & 1) << 3) |
+ (htng_system_type << 4);
+ msg->msg[msg->len++] = freq >> 8;
+ msg->msg[msg->len++] = freq & 0xff;
+ msg->msg[msg->len++] = service_id >> 8;
+ msg->msg[msg->len++] = service_id & 0xff;
+ msg->msg[msg->len++] = (htng_mod_type & 0xf) |
+ ((htng_onid & 1) << 4) |
+ ((htng_nid & 1) << 5) |
+ ((htng_tsid_plp & 1) << 6) |
+ ((htng_symbol_rate & 1) << 7);
+ if (htng_onid == CEC_OP_HTNG_ONID_MANUAL) {
+ msg->msg[msg->len++] = onid >> 8;
+ msg->msg[msg->len++] = onid & 0xff;
+ }
+ if (htng_nid == CEC_OP_HTNG_NID_MANUAL) {
+ msg->msg[msg->len++] = nid >> 8;
+ msg->msg[msg->len++] = nid & 0xff;
+ }
+ if (msg->len < CEC_MAX_MSG_SIZE &&
+ htng_tsid_plp == CEC_OP_HTNG_TSID_PLP_MANUAL) {
+ msg->msg[msg->len++] = tsid_plp >> 8;
+ msg->msg[msg->len++] = tsid_plp & 0xff;
+ }
+ if (msg->len < CEC_MAX_MSG_SIZE &&
+ htng_symbol_rate == CEC_OP_HTNG_SYMBOL_RATE_MANUAL) {
+ msg->msg[msg->len++] = symbol_rate >> 8;
+ msg->msg[msg->len++] = symbol_rate & 0xff;
+ }
+}
+
+static inline void cec_ops_htng_global_direct_tune_ext_freq(const struct cec_msg *msg,
+ __u8 *htng_ext_chan_type,
+ __u8 *htng_prog_type,
+ __u8 *htng_system_type,
+ __u16 *freq,
+ __u16 *service_id,
+ __u8 *htng_mod_type,
+ __u8 *htng_onid,
+ __u16 *onid,
+ __u8 *htng_nid,
+ __u16 *nid,
+ __u8 *htng_tsid_plp,
+ __u16 *tsid_plp,
+ __u8 *htng_symbol_rate,
+ __u16 *symbol_rate)
+{
+ unsigned offset = 12;
+
+ *htng_ext_chan_type = msg->msg[6] & 7;
+ *htng_prog_type = (msg->msg[6] >> 3) & 1;
+ *htng_system_type = (msg->msg[6] >> 4) & 0xf;
+ *freq = (msg->msg[7] << 8) | msg->msg[8];
+ *service_id = (msg->msg[9] << 8) | msg->msg[10];
+ *htng_mod_type = msg->msg[11] & 0xf;
+ *htng_onid = (msg->msg[11] >> 4) & 1;
+ *htng_nid = (msg->msg[11] >> 5) & 1;
+ *htng_tsid_plp = (msg->msg[11] >> 6) & 1;
+ *htng_symbol_rate = (msg->msg[11] >> 7) & 1;
+ if (*htng_onid == CEC_OP_HTNG_ONID_MANUAL) {
+ *onid = (msg->msg[offset] << 8) | msg->msg[offset + 1];
+ offset += 2;
+ } else {
+ *onid = 0;
+ }
+ if (*htng_nid == CEC_OP_HTNG_NID_MANUAL) {
+ *nid = (msg->msg[offset] << 8) | msg->msg[offset + 1];
+ offset += 2;
+ } else {
+ *nid = 0;
+ }
+ if (offset < CEC_MAX_MSG_SIZE &&
+ *htng_tsid_plp == CEC_OP_HTNG_TSID_PLP_MANUAL) {
+ *tsid_plp = (msg->msg[offset] << 8) | msg->msg[offset + 1];
+ offset += 2;
+ } else {
+ *tsid_plp = 0;
+ }
+ if (offset < CEC_MAX_MSG_SIZE &&
+ *htng_symbol_rate == CEC_OP_HTNG_SYMBOL_RATE_MANUAL) {
+ *symbol_rate = (msg->msg[offset] << 8) | msg->msg[offset + 1];
+ offset += 2;
+ } else {
+ *symbol_rate = 0;
+ }
+}
+
+#endif
diff --git a/utils/common/cec-htng.h b/utils/common/cec-htng.h
new file mode 100644
index 00000000..b157ff3d
--- /dev/null
+++ b/utils/common/cec-htng.h
@@ -0,0 +1,172 @@
+/*
+ * cec-htng - HDMI CEC messages for Hospitality Profile
+ *
+ * Copyright 2016-2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
+ *
+ * This program is free software; you may redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * Alternatively you can redistribute this file under the terms of the
+ * BSD license as stated below:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. The names of its contributors may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef _CEC_HTNG_H
+#define _CEC_HTNG_H
+
+#include <linux/cec.h>
+
+#define VENDOR_ID_HTNG 0x00d38d
+
+#define CEC_MSG_HTNG_TUNER_1PART_CHAN 0x00
+/* HTNG Tuner Type Operand (htng_tuner_type) */
+#define CEC_OP_HTNG_TUNER_TYPE_AIR 0x00
+#define CEC_OP_HTNG_TUNER_TYPE_CABLE 0x01
+#define CEC_OP_HTNG_TUNER_TYPE_SAT 0x02
+#define CEC_OP_HTNG_TUNER_TYPE_NOT_SPECIFIED 0x03
+
+#define CEC_MSG_HTNG_TUNER_2PART_CHAN 0x01
+#define CEC_MSG_HTNG_INPUT_SEL_AV 0x02
+#define CEC_MSG_HTNG_INPUT_SEL_PC 0x03
+#define CEC_MSG_HTNG_INPUT_SEL_HDMI 0x04
+#define CEC_MSG_HTNG_INPUT_SEL_COMPONENT 0x05
+#define CEC_MSG_HTNG_INPUT_SEL_DVI 0x06
+#define CEC_MSG_HTNG_INPUT_SEL_DP 0x07
+#define CEC_MSG_HTNG_INPUT_SEL_USB 0x08
+
+#define CEC_MSG_HTNG_SET_DEF_PWR_ON_INPUT_SRC 0x10
+/* HTNG Input Source Operand (htng_input_src) */
+#define CEC_OP_HTNG_INPUT_SRC_TUNER_1PART 0x00
+#define CEC_OP_HTNG_INPUT_SRC_TUNER_2PART 0x01
+#define CEC_OP_HTNG_INPUT_SRC_AV 0x02
+#define CEC_OP_HTNG_INPUT_SRC_PC 0x03
+#define CEC_OP_HTNG_INPUT_SRC_HDMI 0x04
+#define CEC_OP_HTNG_INPUT_SRC_COMPONENT 0x05
+#define CEC_OP_HTNG_INPUT_SRC_DVI 0x06
+#define CEC_OP_HTNG_INPUT_SRC_DP 0x07
+#define CEC_OP_HTNG_INPUT_SRC_USB 0x08
+
+#define CEC_MSG_HTNG_SET_TV_SPEAKERS 0x20
+#define CEC_MSG_HTNG_SET_DIG_AUDIO 0x21
+#define CEC_MSG_HTNG_SET_ANA_AUDIO 0x22
+#define CEC_MSG_HTNG_SET_DEF_PWR_ON_VOL 0x23
+#define CEC_MSG_HTNG_SET_MAX_VOL 0x24
+#define CEC_MSG_HTNG_SET_MIN_VOL 0x25
+
+#define CEC_MSG_HTNG_SET_BLUE_SCREEN 0x40
+/* HTNG TV Screen Color Operand (htng_tv_screen_color) */
+#define CEC_OP_HTNG_TV_SCREEN_BLACK 0x00
+#define CEC_OP_HTNG_TV_SCREEN_BLUE 0x01
+
+#define CEC_MSG_HTNG_SET_BRIGHTNESS 0x41
+#define CEC_MSG_HTNG_SET_COLOR 0x42
+#define CEC_MSG_HTNG_SET_CONTRAST 0x43
+#define CEC_MSG_HTNG_SET_SHARPNESS 0x44
+#define CEC_MSG_HTNG_SET_HUE 0x45
+#define CEC_MSG_HTNG_SET_LED_BACKLIGHT 0x46
+#define CEC_MSG_HTNG_SET_TV_OSD_CONTROL 0x47
+#define CEC_MSG_HTNG_SET_AUDIO_ONLY_DISPLAY 0x48
+
+#define CEC_MSG_HTNG_SET_DATE 0x60
+#define CEC_MSG_HTNG_SET_DATE_FORMAT 0x61
+#define CEC_MSG_HTNG_SET_TIME 0x62
+#define CEC_MSG_HTNG_SET_CLK_BRIGHTNESS_STANDBY 0x63
+#define CEC_MSG_HTNG_SET_CLK_BRIGHTNESS_ON 0x64
+#define CEC_MSG_HTNG_LED_CONTROL 0x65
+/* HTNG LED Control Operand (htng_led_control) */
+#define CEC_OP_HTNG_LED_CONTROL_DEFAULT 0x00
+#define CEC_OP_HTNG_LED_CONTROL_ON 0x01
+#define CEC_OP_HTNG_LED_CONTROL_OFF 0x02
+
+#define CEC_MSG_HTNG_LOCK_TV_PWR_BUTTON 0x66
+#define CEC_MSG_HTNG_LOCK_TV_VOL_BUTTONS 0x67
+#define CEC_MSG_HTNG_LOCK_TV_CHAN_BUTTONS 0x68
+#define CEC_MSG_HTNG_LOCK_TV_INPUT_BUTTONS 0x69
+#define CEC_MSG_HTNG_LOCK_TV_OTHER_BUTTONS 0x6a
+#define CEC_MSG_HTNG_LOCK_EVERYTHING 0x6b
+#define CEC_MSG_HTNG_LOCK_EVERYTHING_BUT_PWR 0x6c
+#define CEC_MSG_HTNG_HOTEL_MODE 0x6d
+
+#define CEC_MSG_HTNG_SET_PWR_SAVING_PROFILE 0x80
+#define CEC_MSG_HTNG_SET_SLEEP_TIMER 0x81
+#define CEC_MSG_HTNG_SET_WAKEUP_TIME 0x82
+#define CEC_MSG_HTNG_SET_AUTO_OFF_TIME 0x83
+#define CEC_MSG_HTNG_SET_WAKEUP_SRC 0x84
+#define CEC_MSG_HTNG_SET_INIT_WAKEUP_VOL 0x85
+#define CEC_MSG_HTNG_CLR_ALL_SLEEP_WAKE 0x86
+#define CEC_MSG_HTNG_GLOBAL_DIRECT_TUNE_FREQ 0x88
+/* HTNG Channel Type Operand (htng_chan_type) */
+#define CEC_OP_HTNG_CHAN_TYPE_AUTO 0x00
+#define CEC_OP_HTNG_CHAN_TYPE_ANA_ANT 0x01
+#define CEC_OP_HTNG_CHAN_TYPE_ANA_CABLE 0x02
+#define CEC_OP_HTNG_CHAN_TYPE_DIG_ANT 0x03
+#define CEC_OP_HTNG_CHAN_TYPE_DIG_CABLE 0x04
+#define CEC_OP_HTNG_CHAN_TYPE_SATELLITE 0x06
+/* HTNG Program Type Operand (htng_prog_type) */
+#define CEC_OP_HTNG_PROG_TYPE_AV 0x00
+#define CEC_OP_HTNG_PROG_TYPE_RADIO 0x01
+/* HTNG System Type Operand (htng_system_type) */
+#define CEC_OP_HTNG_SYSTEM_TYPE_PAL_BG 0x00
+#define CEC_OP_HTNG_SYSTEM_TYPE_PAL_I 0x01
+#define CEC_OP_HTNG_SYSTEM_TYPE_PAL_DK 0x02
+#define CEC_OP_HTNG_SYSTEM_TYPE_PAL_M 0x03
+#define CEC_OP_HTNG_SYSTEM_TYPE_PAL_N 0x04
+#define CEC_OP_HTNG_SYSTEM_TYPE_SECAM_BG 0x05
+#define CEC_OP_HTNG_SYSTEM_TYPE_SECAM_DK 0x06
+#define CEC_OP_HTNG_SYSTEM_TYPE_SECAM_L 0x07
+#define CEC_OP_HTNG_SYSTEM_TYPE_NTSC_M 0x08
+/* HTNG Modulation Type Operand (htng_mod_type) */
+#define CEC_OP_HTNG_MOD_TYPE_AUTO 0x00
+#define CEC_OP_HTNG_MOD_TYPE_QPSK 0x01
+#define CEC_OP_HTNG_MOD_TYPE_QCAM16 0x02
+#define CEC_OP_HTNG_MOD_TYPE_QCAM32 0x03
+#define CEC_OP_HTNG_MOD_TYPE_QCAM64 0x04
+#define CEC_OP_HTNG_MOD_TYPE_QCAM128 0x05
+#define CEC_OP_HTNG_MOD_TYPE_QCAM256 0x06
+#define CEC_OP_HTNG_MOD_TYPE_DQPSK 0x07
+/* HTNG Symbol Rate Operand (htng_symbol_rate) */
+#define CEC_OP_HTNG_SYMBOL_RATE_AUTO 0x00
+#define CEC_OP_HTNG_SYMBOL_RATE_MANUAL 0x01
+
+#define CEC_MSG_HTNG_GLOBAL_DIRECT_TUNE_CHAN 0x89
+#define CEC_MSG_HTNG_GLOBAL_DIRECT_TUNE_EXT_FREQ 0x8a
+/* HTNG Extended Channel Type Operand (htng_ext_chan_type) */
+#define CEC_OP_HTNG_EXT_CHAN_TYPE_AUTO 0x00
+#define CEC_OP_HTNG_EXT_CHAN_TYPE_ANA_ANT 0x01
+#define CEC_OP_HTNG_EXT_CHAN_TYPE_ANA_CABLE 0x02
+#define CEC_OP_HTNG_EXT_CHAN_TYPE_DVB_T_ISDB_T_DTMB 0x03
+#define CEC_OP_HTNG_EXT_CHAN_TYPE_DVB_C 0x04
+#define CEC_OP_HTNG_EXT_CHAN_TYPE_DVB_T2 0x05
+/* HTNG ONID Operand (htng_onid) */
+#define CEC_OP_HTNG_ONID_AUTO 0x00
+#define CEC_OP_HTNG_ONID_MANUAL 0x01
+/* HTNG NID Operand (htng_nid) */
+#define CEC_OP_HTNG_NID_AUTO 0x00
+#define CEC_OP_HTNG_NID_MANUAL 0x01
+/* HTNG TSID PLP Operand (htng_tsid_plp) */
+#define CEC_OP_HTNG_TSID_PLP_AUTO 0x00
+#define CEC_OP_HTNG_TSID_PLP_MANUAL 0x01
+
+#endif
diff --git a/utils/common/cec-log.cpp b/utils/common/cec-log.cpp
index e184e423..7e68ebc2 100644
--- a/utils/common/cec-log.cpp
+++ b/utils/common/cec-log.cpp
@@ -39,6 +39,7 @@
#include <stdarg.h>
#include <string>
#include <linux/cec-funcs.h>
+#include "cec-htng-funcs.h"
#define CEC_MAX_ARGS 16
@@ -317,6 +318,7 @@ static void log_ui_command(const char *arg_name, const struct cec_op_ui_command
static void log_descriptors(const char *arg_name, unsigned num, const __u32 *descriptors);
static void log_u8_array(const char *arg_name, unsigned num, const __u8 *vals);
static void log_unknown_msg(const struct cec_msg *msg);
+static void log_htng_unknown_msg(const struct cec_msg *msg);
#include "cec-log.h"
@@ -440,34 +442,61 @@ static void log_u8_array(const char *arg_name, unsigned num, const __u8 *vals)
log_arg(&arg_u8, arg_name, vals[i]);
}
+static void log_htng_unknown_msg(const struct cec_msg *msg)
+{
+ __u32 vendor_id;
+ const __u8 *bytes;
+ __u8 size;
+ unsigned i;
+
+ cec_ops_vendor_command_with_id(msg, &vendor_id, &size, &bytes);
+ printf("CEC_MSG_VENDOR_COMMAND_WITH_ID:\n");
+ log_arg(&arg_vendor_id, "vendor-id", vendor_id);
+ printf("\tvendor-specific-data:");
+ for (i = 0; i < size; i++)
+ printf(" 0x%02x", bytes[i]);
+ printf("\n");
+}
+
static void log_unknown_msg(const struct cec_msg *msg)
{
__u32 vendor_id;
__u16 phys_addr;
+ const __u8 *bytes;
+ __u8 size;
unsigned i;
switch (msg->msg[1]) {
case CEC_MSG_VENDOR_COMMAND:
printf("CEC_MSG_VENDOR_COMMAND:\n");
+ cec_ops_vendor_command(msg, &size, &bytes);
printf("\tvendor-specific-data:");
- for (i = 2; i < msg->len; i++)
- printf(" 0x%02x", msg->msg[i]);
+ for (i = 0; i < size; i++)
+ printf(" 0x%02x", bytes[i]);
printf("\n");
break;
case CEC_MSG_VENDOR_COMMAND_WITH_ID:
- printf("CEC_MSG_VENDOR_COMMAND_WITH_ID:\n");
- cec_ops_device_vendor_id(msg, &vendor_id);
- log_arg(&arg_vendor_id, "vendor-id", vendor_id);
- printf("\tvendor-specific-data:");
- for (i = 5; i < msg->len; i++)
- printf(" 0x%02x", msg->msg[i]);
- printf("\n");
+ cec_ops_vendor_command_with_id(msg, &vendor_id, &size, &bytes);
+ switch (vendor_id) {
+ case VENDOR_ID_HTNG:
+ log_htng_msg(msg);
+ break;
+ default:
+ printf("CEC_MSG_VENDOR_COMMAND_WITH_ID:\n");
+ log_arg(&arg_vendor_id, "vendor-id", vendor_id);
+ printf("\tvendor-specific-data:");
+ for (i = 0; i < size; i++)
+ printf(" 0x%02x", bytes[i]);
+ printf("\n");
+ break;
+ }
break;
case CEC_MSG_VENDOR_REMOTE_BUTTON_DOWN:
printf("CEC_MSG_VENDOR_REMOTE_BUTTON_DOWN:\n");
+ cec_ops_vendor_remote_button_down(msg, &size, &bytes);
printf("\tvendor-specific-rc-code:");
- for (i = 2; i < msg->len; i++)
- printf(" 0x%02x", msg->msg[i]);
+ for (i = 0; i < size; i++)
+ printf(" 0x%02x", bytes[i]);
printf("\n");
break;
case CEC_MSG_CDC_MESSAGE:

Privacy Policy