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, &level,
54 _E("no message : [%s:%s]", err.name, err.message);
58 dbus_message_unref(msg);
59 dbus_error_free(&err);
60 sleep(TEST_WAIT_TIME_INTERVAL);
64 static int test_hdcp(void)
70 msg = dbus_method_sync_with_reply(DEVICED_BUS_NAME,
72 DEVICED_INTERFACE_SYSNOTI,
73 METHOD_GET_HDCP, NULL, NULL);
75 _E("fail : %s %s %s %s",
76 DEVICED_BUS_NAME, DEVICED_PATH_SYSNOTI, DEVICED_INTERFACE_SYSNOTI,
81 dbus_error_init(&err);
83 ret = dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &level,
86 _E("no message : [%s:%s]", err.name, err.message);
90 dbus_message_unref(msg);
91 dbus_error_free(&err);
92 sleep(TEST_WAIT_TIME_INTERVAL);
96 static int test_hdmi_audio(void)
102 msg = dbus_method_sync_with_reply(DEVICED_BUS_NAME,
103 DEVICED_PATH_SYSNOTI,
104 DEVICED_INTERFACE_SYSNOTI,
105 METHOD_GET_HDMI_AUDIO, NULL, NULL);
107 _E("fail : %s %s %s %s",
108 DEVICED_BUS_NAME, DEVICED_PATH_SYSNOTI, DEVICED_INTERFACE_SYSNOTI,
109 METHOD_GET_HDMI_AUDIO);
113 dbus_error_init(&err);
115 ret = dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &level,
118 _E("no message : [%s:%s]", err.name, err.message);
122 dbus_message_unref(msg);
123 dbus_error_free(&err);
124 sleep(TEST_WAIT_TIME_INTERVAL);
128 static int test(int index)
135 param[0] = METHOD_SET_DEVICE;
137 param[2] = device_change_types[index].name;
138 param[3] = device_change_types[index].status;
140 msg = dbus_method_sync_with_reply(DEVICED_BUS_NAME,
141 DEVICED_PATH_SYSNOTI,
142 DEVICED_INTERFACE_SYSNOTI,
143 METHOD_SET_DEVICE, "siss", param);
145 _E("fail : %s %s %s %s",
146 DEVICED_BUS_NAME, DEVICED_PATH_SYSNOTI, DEVICED_INTERFACE_SYSNOTI,
151 dbus_error_init(&err);
153 ret = dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &ret_val, DBUS_TYPE_INVALID);
155 _E("no message : [%s:%s]", err.name, err.message);
156 dbus_error_free(&err);
159 _I("%s %s", device_change_types[index].name, device_change_types[index].status);
160 dbus_message_unref(msg);
161 dbus_error_free(&err);
162 sleep(TEST_WAIT_TIME_INTERVAL);
166 static void unit(char *unit, char *status)
170 for (index = 0; index < ARRAY_SIZE(device_change_types); index++) {
171 if (strcmp(unit, device_change_types[index].name) != 0 ||
172 strcmp(status, device_change_types[index].status) != 0)
178 static void hdmi_init(void *data)
183 for (index = 0; index < ARRAY_SIZE(device_change_types); index++) {
191 static void hdmi_exit(void *data)
196 static int hdmi_unit(int argc, char **argv)
205 unit(argv[1], argv[2]);
210 static const struct test_ops hdmi_test_ops = {
211 .priority = TEST_PRIORITY_NORMAL,
218 TEST_OPS_REGISTER(&hdmi_test_ops)