2995ce99f2cfa4cc2a87614108a86b246ca46ebc
[platform/core/system/deviced.git] / src / auto-test / display.c
1 /*
2  * test
3  *
4  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
5  *
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
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  */
18 #include <stdio.h>
19 #include <error.h>
20 #include <tzplatform_config.h>
21 #include <device/display-internal.h>
22
23 #include "test.h"
24
25 #define METHOD_DISPLAY_GETBRIGHTNESS            "getbrightness"
26 #define METHOD_DISPLAY_SETBRIGHTNESS            "setbrightness"
27 #define METHOD_DISPLAY_GETMAXBRIGHTNESS         "GetMaxBrightness"
28 #define METHOD_DISPLAY_SETMAXBRIGHTNESS         "SetMaxBrightness"
29 #define METHOD_DISPLAY_HOLDBRIGHTNESS           "HoldBrightness"
30 #define METHOD_DISPLAY_RELEASEBRIGHTNESS        "ReleaseBrightness"
31 #define METHOD_DISPLAY_CUSTOMBRIGHTNESS         "CustomBrightness"
32 #define METHOD_DISPLAY_SETAUTOBRIGHTNESSMIN     "setautobrightnessmin"
33 #define METHOD_DISPLAY_SETREFRESHRATE           "SetRefreshRate"
34 #define METHOD_DISPLAY_GETDISPLAYCOUNT          "GetDisplayCount"
35 #define METHOD_DISPLAY_CHANGESTATE                      "ChangeState"
36 #define METHOD_DISPLAY_LOCKSTATE_NOPT           "lockstate_nopt"
37 #define METHOD_DISPLAY_UNLOCKSTATE                      "unlockstate"
38 #define METHOD_DISPLAY_SETLCDTIMEOUT            "setlcdtimeout"
39 #define METHOD_DISPLAY_CUSTOMLCDON                      "CustomLCDOn"
40 #define METHOD_DISPLAY_LCDPANEL_OFFMODE         "LCDPanelOffMode"
41 #define METHOD_DISPLAY_STAYTOUCHSCREEN_OFF      "StayTouchScreenOff"
42 #define METHOD_DISPLAY_LOCKSCREENBGON           "LockScreenBgOn"
43 #define METHOD_DISPLAY_DUMPMODE                         "Dumpmode"
44 #define METHOD_DISPLAY_SAVELOG                          "SaveLog"
45 #define METHOD_DISPLAY_POWERKEY_IGNORE          "PowerKeyIgnore"
46 #define METHOD_DISPLAY_POWERKEY_LCDOFF          "PowerKeyLCDOff"
47 #define METHOD_DISPLAY_LOCKTIMEOUT_EXPIRED      "LockTimeoutExpired"
48 #define METHOD_DISPLAY_LOCKTIMEOUT_INPUT        "LockTimeoutInput"
49 #define METHOD_DISPLAY_ACTORCONTROL                     "ActorControl"
50 #define METHOD_DISPLAY_START                            "start"
51 #define METHOD_DISPLAY_STOP                                     "stop"
52 #define METHOD_CHANGE_STATE_BY_REASON           "ChangeStateByReason"
53
54 #define PM_STATE_LOG_FILE                       "/var/log/pm_state.log"
55 #define PALM_STR                                "palm"
56
57 static bool get_display_method(const char *method, GVariant *param, int *value)
58 {
59         GVariant *msg;
60         int val, err;
61         bool ret = FALSE;
62
63         err = dbus_handle_method_sync_with_reply_var(DEVICED_BUS_NAME,
64                         DEVICED_PATH_DISPLAY,
65                         DEVICED_INTERFACE_DISPLAY,
66                         method, param, &msg);
67         if (err < 0) {
68                 _E("fail (%s): no reply", method);
69                 return ret;
70         }
71         if (!g_variant_get_safe(msg, "(i)", &val))
72                 _E("fail (%s): no message", method);
73         else {
74                 _I("success (%s): %d", method, val);
75                 ret = TRUE;
76                 if (NULL != value)
77                         *value = val;
78         }
79
80         g_variant_unref(msg);
81         return ret;
82 }
83
84 static bool set_display_method(const char *method, GVariant *param)
85 {
86         GVariant *msg;
87         int val, err;
88         bool ret = FALSE;
89
90         err = dbus_handle_method_sync_with_reply_var(DEVICED_BUS_NAME,
91                         DEVICED_PATH_DISPLAY,
92                         DEVICED_INTERFACE_DISPLAY,
93                         method, param, &msg);
94         if (err < 0) {
95                 _E("fail (%s): no reply", method);
96                 return ret;
97         }
98
99         if (!g_variant_get_safe(msg, "(i)", &val))
100                 _E("fail (%s): no message", method);
101         else {
102                 if ((val == -ENOTSUP) || (val == -ENOSYS)) {
103                         _I("Not supported feature! (%s): %d", method, val);
104                         ret = TRUE;
105                 } else if (val < 0) {
106                         _E("fail (%s): returned fail (%d)", method, val);
107                 } else {
108                         _I("success (%s): %d", method, val);
109                         ret = TRUE;
110                 }
111         }
112
113         g_variant_unref(msg);
114         return ret;
115 }
116
117 static bool set_display_method_noreply(const char *method, GVariant *var)
118 {
119         GVariant *msg;
120         int err;
121
122         err = dbus_handle_method_sync_with_reply_var(DEVICED_BUS_NAME,
123                         DEVICED_PATH_DISPLAY,
124                         DEVICED_INTERFACE_DISPLAY,
125                         method, var, &msg);
126         if (err < 0) {
127                 _E("fail (%s): no reply", method);
128                 return FALSE;
129         }
130
131         g_variant_unref(msg);
132         return TRUE;
133 }
134
135 static bool set_display_maxbrightness(int brightness)
136 {
137         return set_display_method(METHOD_DISPLAY_SETMAXBRIGHTNESS, g_variant_new("(i)", brightness));
138 }
139
140 static bool set_display_holdbrightness(int brightness)
141 {
142         return set_display_method(METHOD_DISPLAY_HOLDBRIGHTNESS, g_variant_new("(i)", brightness));
143 }
144
145 static bool set_display_releasebrightness()
146 {
147         return set_display_method(METHOD_DISPLAY_RELEASEBRIGHTNESS, NULL);
148 }
149
150 static bool get_display_custombrightness()
151 {
152         return get_display_method(METHOD_DISPLAY_CUSTOMBRIGHTNESS, NULL, NULL);
153 }
154
155 static bool set_display_autobrightness_min(int min)
156 {
157         GVariant *msg;
158         int val = 0, err;
159         bool ret = FALSE;
160
161         err = dbus_handle_method_sync_with_reply_var(DEVICED_BUS_NAME,
162                                                 DEVICED_PATH_DISPLAY,
163                                                 DEVICED_INTERFACE_DISPLAY,
164                                                 METHOD_DISPLAY_SETAUTOBRIGHTNESSMIN,
165                                                 g_variant_new("(i)", min),
166                                                 &msg);
167         if (err < 0) {
168                 _E("fail : no reply");
169                 return ret;
170         }
171
172         if (!g_variant_get_safe(msg, "(i)", &val)) {
173                 _E("fail : no message");
174         } else {
175                 if ((min < 1) || (min > 100)) {
176                         if (val < 0) {
177                                 _I("success : autobrightness min value should be 1~100. can't set (%d).", min);
178                                 ret = TRUE;
179                         } else {
180                                 _I("fail : can't set (%d). but returned success", min);
181                         }
182                 } else {
183                         if (val < 0) {
184                                 _E("fail : return fail (%d)", val);
185                         } else {
186                                 _I("success : %d", val);
187                                 ret = TRUE;
188                         }
189                 }
190         }
191         g_variant_unref(msg);
192         return ret;
193 }
194
195 #if 0
196 static bool set_display_refreshrate(int app, int rate)
197 {
198         return set_display_method(METHOD_DISPLAY_SETREFRESHRATE, g_variant_new("(ii)", app, rate));
199 }
200 #endif
201
202 static bool get_display_count()
203 {
204         return get_display_method(METHOD_DISPLAY_GETDISPLAYCOUNT, NULL, NULL);
205 }
206
207 static bool set_display_changestate(char *state)
208 {
209         return set_display_method(METHOD_DISPLAY_CHANGESTATE, g_variant_new("(s)", state));
210 }
211
212 #if 0
213 static bool set_display_lockstate_nopt(char *state, char *option, char *ignore, int timeout)
214 {
215         char *param[4];
216         char str_timeout[10];
217
218         snprintf(str_timeout, sizeof(str_timeout), "%d", timeout);
219
220         param[0] = state;
221         param[1] = option;
222         param[1] = ignore;
223         param[1] = str_timeout;
224
225         return set_display_method(METHOD_DISPLAY_LOCKSTATE_NOPT, "sssi", param);
226 }
227
228 static bool set_display_unlockstate(char *state, char *option)
229 {
230         char *param[2];
231
232         param[0] = state;
233         param[1] = option;
234
235         return set_display_method(METHOD_DISPLAY_UNLOCKSTATE, "ss", param);
236 }
237 #endif
238
239 static bool set_display_lcdtimeout(int normal, int dim, int holdkey_block)
240 {
241         return set_display_method(METHOD_DISPLAY_SETLCDTIMEOUT, g_variant_new("(iii)", normal, dim, holdkey_block));
242 }
243
244 static bool set_display_customlcdon(int timeout_msec)
245 {
246         return set_display_method(METHOD_DISPLAY_CUSTOMLCDON, g_variant_new("(i)", timeout_msec));
247 }
248
249 static bool set_display_lcdpanel_offmode(int on)
250 {
251         return set_display_method(METHOD_DISPLAY_LCDPANEL_OFFMODE, g_variant_new("(i)", on));
252 }
253
254 static bool set_display_staytouchscreen_off(int on)
255 {
256         return set_display_method(METHOD_DISPLAY_STAYTOUCHSCREEN_OFF, g_variant_new("(i)", on));
257 }
258
259 static bool set_display_lockscreen_bg_on(char *on)
260 {
261         return set_display_method(METHOD_DISPLAY_LOCKSCREENBGON, g_variant_new("(s)", on));
262 }
263
264 static bool set_display_dumpmode(char *on)
265 {
266         return set_display_method(METHOD_DISPLAY_DUMPMODE, g_variant_new("(s)", on));
267 }
268
269 static bool set_display_savelog()
270 {
271         struct stat buf;
272         int r;
273         bool ret = FALSE;
274
275         if (!stat(PM_STATE_LOG_FILE, &buf)) {
276                 r = remove(PM_STATE_LOG_FILE);
277                 if (r < 0)
278                         _E("Remove file error : %d", r);
279         }
280
281         if (!set_display_method_noreply(METHOD_DISPLAY_SAVELOG, NULL))
282                 return ret;
283
284         sleep(3);
285
286         if (!stat(PM_STATE_LOG_FILE, &buf)) {
287                 _I("success : %s", PM_STATE_LOG_FILE);
288                 ret = TRUE;
289         }
290
291         return ret;
292 }
293
294 static bool set_display_powerkey_ignore(int on)
295 {
296         return set_display_method(METHOD_DISPLAY_POWERKEY_IGNORE, g_variant_new("(i)", on));
297 }
298
299 static bool set_display_powerkey_lcdoff()
300 {
301         return set_display_method(METHOD_DISPLAY_POWERKEY_LCDOFF, NULL);
302 }
303
304 #if 0
305 static bool set_display_locktimeout_expired(char *req_id)
306 {
307         DBusMessage *msg;
308         int val, err;
309         char *ret_req_id;
310         bool ret = FALSE;
311
312         err = dbus_handle_method_sync_with_reply_var(DEVICED_BUS_NAME,
313                         DEVICED_PATH_DISPLAY,
314                         DEVICED_INTERFACE_DISPLAY,
315                         METHOD_DISPLAY_LOCKTIMEOUT_EXPIRED, g_variant_new("(s)", req_id),
316                         &msg);
317         if (err < 0) {
318                 _E("fail: no reply");
319                 return ret;
320         }
321
322         if (dbus_message_get_args(msg, NULL,
323                                 DBUS_TYPE_STRING, &ret_req_id, //request id
324                                 DBUS_TYPE_INT32, &val,   //return value
325                                 DBUS_TYPE_INVALID) == 0)
326                 _E("fail: no message");
327         else {
328                 if ((0 != strcmp(req_id, ret_req_id)) || (val < 0)) {
329                         _E("fail: return fail");
330                 } else {
331                         _I("success: %s %d", ret_req_id, val);
332                         ret = TRUE;
333                 }
334         }
335
336         dbus_message_unref(msg);
337         return ret;
338 }
339
340 static bool set_display_locktimeout_input(char *req_id, int input)
341 {
342         char *param[2];
343         char str_input[10];
344
345         snprintf(str_input, sizeof(str_input), "%d", input);
346         param[0] = req_id;
347         param[1] = str_input;
348
349         return set_display_method(METHOD_DISPLAY_LOCKTIMEOUT_INPUT, g_variant_new("(si)", req_id, input));
350 }
351 #endif
352
353 static bool set_display_actorcontrol(char *command, int actor, int caps)
354 {
355         return set_display_method(METHOD_DISPLAY_ACTORCONTROL, g_variant_new("(sii)", command, actor, caps));
356 }
357
358 static bool get_display_brightness_state(display_state_e state, int *brightness)
359 {
360         int ret;
361
362         ret = device_display_get_brightness_state(0, state, brightness);
363
364         return capi_result(METHOD_DISPLAY_GETBRIGHTNESS, ret);
365 }
366
367 static bool get_display_max_brightness_state(display_state_e state, int *brightness)
368 {
369         int ret;
370
371         ret = device_display_get_max_brightness_state(0, state, brightness);
372
373         return capi_result(METHOD_DISPLAY_GETMAXBRIGHTNESS, ret);
374 }
375
376 static bool set_display_brightness_state(display_state_e state, int brightness)
377 {
378         int ret;
379         int getbrightness;
380
381         ret = device_display_set_brightness_state(0, state, brightness);
382         if (!capi_result(METHOD_DISPLAY_SETBRIGHTNESS, ret))
383                 return FALSE;
384
385         if (state == DISPLAY_STATE_NORMAL)
386                 set_display_changestate("lcdon");
387         else if (state == DISPLAY_STATE_SCREEN_DIM)
388                 set_display_changestate("lcddim");
389         else {
390                 _E("fail: unknown state(%d)", state);
391                 return FALSE;
392         }
393
394         ret = device_display_get_brightness_state(0, state, &getbrightness);
395         if (!capi_result(METHOD_DISPLAY_SETBRIGHTNESS, ret))
396                 return FALSE;
397
398         if (brightness != getbrightness)
399                 return FALSE;
400
401         return TRUE;
402 }
403
404 static bool set_display_state_by_reason(display_state_e type, const char *reason, int timeout, dbus_pending_cb cb)
405 {
406         int ret;
407
408         ret = device_display_change_state_by_reason(type, reason, timeout, cb);
409
410         return capi_result(METHOD_CHANGE_STATE_BY_REASON, ret);
411 }
412
413 static bool set_display_start()
414 {
415         return set_display_method_noreply(METHOD_DISPLAY_START, NULL);
416 }
417
418 static bool set_display_stop()
419 {
420         return set_display_method_noreply(METHOD_DISPLAY_STOP, NULL);
421 }
422
423 void display_test_all(int *success, int *fail)
424 {
425         int s = 0;
426         int f = 0;
427         int brt = 0;
428
429         (get_display_brightness_state(DISPLAY_STATE_NORMAL, &brt))             ? s++ : f++;
430         (get_display_brightness_state(DISPLAY_STATE_SCREEN_DIM, &brt))     ? s++ : f++;
431         (set_display_brightness_state(DISPLAY_STATE_NORMAL, 100))          ? s++ : f++;
432         (set_display_brightness_state(DISPLAY_STATE_SCREEN_DIM, 1))        ? s++ : f++;
433         (get_display_max_brightness_state(DISPLAY_STATE_NORMAL, &brt))                          ? s++ : f++;
434         (get_display_max_brightness_state(DISPLAY_STATE_SCREEN_DIM, &brt))                      ? s++ : f++;
435         (set_display_maxbrightness(80))         ? s++ : f++;    //not support, always success.
436         (set_display_holdbrightness(30))        ? s++ : f++;
437         (set_display_releasebrightness())       ? s++ : f++;
438         (get_display_custombrightness())        ? s++ : f++;
439         (set_display_autobrightness_min(15)) ? s++ : f++;
440         (set_display_autobrightness_min(0))     ? s++ : f++;
441         //(set_display_refreshrate(0, 30))      ? s++ : f++;
442         (get_display_count())                           ? s++ : f++;
443         (set_display_changestate("lcdon"))      ? s++ : f++;
444         //(set_display_lockstate_nopt("lcddim", "staycurstate", "", 3)) ? s++ : f++;
445         //(set_display_unlockstate("lcddim", "resettimer")) ? s++ : f++;
446         (set_display_lcdtimeout(5, 10, 1))      ? s++ : f++;
447         (set_display_customlcdon(6000))         ? s++ : f++;
448         (set_display_lcdpanel_offmode(1))       ? s++ : f++;
449         (set_display_lcdpanel_offmode(0))       ? s++ : f++;
450         (set_display_staytouchscreen_off(1)) ? s++ : f++;
451         (set_display_staytouchscreen_off(0)) ? s++ : f++;
452         (set_display_lockscreen_bg_on("true"))  ? s++ : f++;
453         (set_display_dumpmode("on"))            ? s++ : f++;
454         (set_display_dumpmode("off"))           ? s++ : f++;
455         (set_display_savelog())                         ? s++ : f++;
456         (set_display_powerkey_ignore(1))        ? s++ : f++;    //not support, always success.
457         (set_display_powerkey_lcdoff())         ? s++ : f++;    //not support, always success.
458         //(set_display_locktimeout_expired("auto_test")) ? s++ : f++;
459         //(set_display_locktimeout_input("auto_test", 1)) ? s++ : f++;
460         (set_display_actorcontrol("set", 4, 1<<3))   ? s++ : f++;
461         (set_display_actorcontrol("reset", 4, 1<<3)) ? s++ : f++;
462         (set_display_stop())                            ? s++ : f++;
463         (set_display_start())                           ? s++ : f++;
464         (set_display_state_by_reason(DISPLAY_STATE_SCREEN_OFF, PALM_STR, 0, __cb)) ? s++ : f++;
465
466         if (NULL != success)    *success = s;
467         if (NULL != fail)       *fail = f;
468 }
469
470 static void display_init(void *data)
471 {
472         int success = 0;
473         int fail = 0;
474
475         _I("start test");
476
477         display_test_all(&success, &fail);
478
479         _I("Total: %d, Success: %d, Fail: %d", success+fail, success, fail);
480 }
481
482 static void display_exit(void *data)
483 {
484         _I("end test");
485
486 }
487
488 static int display_unit(int argc, char **argv)
489 {
490         int brt = 0;
491
492         if (argc < 4) {
493                 int success = 0;
494                 int fail = 0;
495                 _I("start test");
496                 display_test_all(&success, &fail);
497                 _I("Total: %d, Success: %d, Fail: %d", success+fail, success, fail);
498         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_GETBRIGHTNESS)) {
499                 get_display_brightness_state(DISPLAY_STATE_NORMAL, &brt);
500                 get_display_brightness_state(DISPLAY_STATE_SCREEN_DIM, &brt);
501         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_SETBRIGHTNESS)) {
502                 set_display_brightness_state(DISPLAY_STATE_NORMAL, 100);
503                 set_display_brightness_state(DISPLAY_STATE_SCREEN_DIM, 1);
504         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_GETMAXBRIGHTNESS)) {
505                 get_display_max_brightness_state(DISPLAY_STATE_NORMAL, &brt);
506                 get_display_max_brightness_state(DISPLAY_STATE_SCREEN_DIM, &brt);
507         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_SETMAXBRIGHTNESS)) {
508                 set_display_maxbrightness(atoi(argv[4]));
509         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_HOLDBRIGHTNESS)) {
510                 set_display_holdbrightness(atoi(argv[4]));
511         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_RELEASEBRIGHTNESS)) {
512                 set_display_releasebrightness();
513         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_CUSTOMBRIGHTNESS)) {
514                 get_display_custombrightness();
515         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_SETAUTOBRIGHTNESSMIN)) {
516                 set_display_autobrightness_min(atoi(argv[4]));
517 //      } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_SETREFRESHRATE)) {
518 //              set_display_refreshrate(atoi(argv[4]), atoi(argv[5]));
519         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_GETDISPLAYCOUNT)) {
520                 get_display_count();
521         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_CHANGESTATE)) {
522                 set_display_changestate(argv[4]);
523 //      } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_LOCKSTATE_NOPT)) {
524 //              set_display_lockstate_nopt(argv[4], argv[5], argv[6], atoi(argv[7]));
525 //      } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_UNLOCKSTATE)) {
526 //              set_display_lockstate_nopt(argv[4], argv[5]);
527         } else if (0 == strcasecmp(argv[3], METHOD_CHANGE_STATE_BY_REASON)) {
528                 set_display_state_by_reason(DISPLAY_STATE_SCREEN_OFF, PALM_STR, 0, __cb);
529         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_SETLCDTIMEOUT)) {
530                 set_display_lcdtimeout(atoi(argv[4]), atoi(argv[5]), atoi(argv[6]));
531         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_CUSTOMLCDON)) {
532                 set_display_customlcdon(atoi(argv[4]));
533         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_LCDPANEL_OFFMODE)) {
534                 set_display_lcdpanel_offmode(atoi(argv[4]));
535         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_STAYTOUCHSCREEN_OFF)) {
536                 set_display_staytouchscreen_off(atoi(argv[4]));
537         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_LOCKSCREENBGON)) {
538                 set_display_lockscreen_bg_on(argv[4]);
539         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_DUMPMODE)) {
540                 set_display_dumpmode(argv[4]);
541         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_SAVELOG)) {
542                 set_display_savelog();
543         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_POWERKEY_IGNORE)) {
544                 set_display_powerkey_ignore(atoi(argv[4]));
545         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_POWERKEY_LCDOFF)) {
546                 set_display_powerkey_lcdoff();
547 //      } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_LOCKTIMEOUT_EXPIRED)) {
548 //              set_display_locktimeout_expired(argv[4]);
549 //      } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_LOCKTIMEOUT_INPUT)) {
550 //              set_display_locktimeout_input(argv[4], atoi(argv[4]));
551         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_ACTORCONTROL)) {
552                 set_display_actorcontrol(argv[4], atoi(argv[5]), atoi(argv[6]));
553         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_START)) {
554                 set_display_start();
555         } else if (0 == strcasecmp(argv[3], METHOD_DISPLAY_STOP)) {
556                 set_display_stop();
557         } else {
558                 _E("Unknown test case!!!");
559         }
560
561         return 0;
562 }
563
564 static const struct test_ops display_test_ops = {
565         .priority = TEST_PRIORITY_NORMAL,
566         .name     = "display",
567         .init     = display_init,
568         .exit    = display_exit,
569         .unit    = display_unit,
570 };
571
572 TEST_OPS_REGISTER(&display_test_ops)