4 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #define METHOD_GET_HDMI "GetHDMI"
21 #define METHOD_GET_HDCP "GetHDCP"
22 #define METHOD_GET_HDMI_AUDIO "GetHDMIAudio"
24 static const struct device_change_type {
27 } device_change_types [] = {
32 static int test_hdmi(void)
38 msg = dbus_method_sync_with_reply(DEVICED_BUS_NAME,
40 DEVICED_INTERFACE_SYSNOTI,
41 METHOD_GET_HDMI, NULL, NULL);
43 _E("fail : %s %s %s %s",
44 DEVICED_BUS_NAME, DEVICED_PATH_SYSNOTI, DEVICED_INTERFACE_SYSNOTI,
49 dbus_error_init(&err);
51 ret = dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &val,
54 _E("no message : [%s:%s]", err.name, err.message);
59 _R("[NG] ---- %s", __func__);
61 _R("[OK] ---- %s : V(%d)", __func__, val);
62 dbus_message_unref(msg);
63 dbus_error_free(&err);
64 sleep(TEST_WAIT_TIME_INTERVAL);
68 static int test_hdcp(void)
74 msg = dbus_method_sync_with_reply(DEVICED_BUS_NAME,
76 DEVICED_INTERFACE_SYSNOTI,
77 METHOD_GET_HDCP, NULL, NULL);
79 _E("fail : %s %s %s %s",
80 DEVICED_BUS_NAME, DEVICED_PATH_SYSNOTI, DEVICED_INTERFACE_SYSNOTI,
85 dbus_error_init(&err);
87 ret = dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &val,
90 _E("no message : [%s:%s]", err.name, err.message);
95 _R("[NG] ---- %s", __func__);
97 _R("[OK] ---- %s : V(%d)", __func__, val);
98 dbus_message_unref(msg);
99 dbus_error_free(&err);
100 sleep(TEST_WAIT_TIME_INTERVAL);
104 static int test_hdmi_audio(void)
110 msg = dbus_method_sync_with_reply(DEVICED_BUS_NAME,
111 DEVICED_PATH_SYSNOTI,
112 DEVICED_INTERFACE_SYSNOTI,
113 METHOD_GET_HDMI_AUDIO, NULL, NULL);
115 _E("fail : %s %s %s %s",
116 DEVICED_BUS_NAME, DEVICED_PATH_SYSNOTI, DEVICED_INTERFACE_SYSNOTI,
117 METHOD_GET_HDMI_AUDIO);
121 dbus_error_init(&err);
123 ret = dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &val,
126 _E("no message : [%s:%s]", err.name, err.message);
131 _R("[NG] ---- %s", __func__);
133 _R("[OK] ---- %s : V(%d)", __func__, val);
134 dbus_message_unref(msg);
135 dbus_error_free(&err);
136 sleep(TEST_WAIT_TIME_INTERVAL);
140 static int hdmi(int index)
147 param[0] = METHOD_SET_DEVICE;
149 param[2] = device_change_types[index].name;
150 param[3] = device_change_types[index].status;
152 msg = dbus_method_sync_with_reply(DEVICED_BUS_NAME,
153 DEVICED_PATH_SYSNOTI,
154 DEVICED_INTERFACE_SYSNOTI,
155 METHOD_SET_DEVICE, "siss", param);
157 _E("fail : %s %s %s %s",
158 DEVICED_BUS_NAME, DEVICED_PATH_SYSNOTI, DEVICED_INTERFACE_SYSNOTI,
163 dbus_error_init(&err);
165 ret = dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &val, DBUS_TYPE_INVALID);
167 _E("no message : [%s:%s]", err.name, err.message);
168 dbus_error_free(&err);
171 _I("%s %s", device_change_types[index].name, device_change_types[index].status);
173 _R("[NG] ---- %s", __func__);
175 _R("[OK] ---- %s : V(%s %s)",
176 __func__, device_change_types[index].name, device_change_types[index].status);
177 dbus_message_unref(msg);
178 dbus_error_free(&err);
179 sleep(TEST_WAIT_TIME_INTERVAL);
183 static void unit(char *unit, char *status)
187 for (index = 0; index < ARRAY_SIZE(device_change_types); index++) {
188 if (strcmp(unit, device_change_types[index].name) != 0 ||
189 strcmp(status, device_change_types[index].status) != 0)
195 static void hdmi_init(void *data)
200 for (index = 0; index < ARRAY_SIZE(device_change_types); index++) {
208 static void hdmi_exit(void *data)
213 static int hdmi_unit(int argc, char **argv)
222 unit(argv[1], argv[2]);
227 static const struct test_ops hdmi_test_ops = {
228 .priority = TEST_PRIORITY_NORMAL,
235 TEST_OPS_REGISTER(&hdmi_test_ops)