2 * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
23 #include "animation.h"
26 #include "boot_sound.h"
33 void(*boot_exit)(void);
35 static int __check_on_off_type(void *user_data)
41 int type = TYPE_UNKNOWN;
42 struct args *args = user_data;
43 static struct option long_options[] = {
44 {"start", no_argument, 0, 's' },
45 {"off", no_argument, 0, 'o' },
46 {"stop", no_argument, 0, 'p' },
47 {"clear", no_argument, 0, 'c' },
53 if(argc < 0 || argc > 2)
55 __E("Invalid argument count for boot animation: [argc: %d]", argc);
59 for (i = 0; i < argc; i++)
60 __D("argc %d [%s]", i, argv[i]);
62 while ((c = getopt_long(argc, argv, "sopc", long_options, NULL)) >= 0) {
69 type = TYPE_OFF_NOEXIT;
75 type = TYPE_OFF_NOEXIT;
79 __D("[Boot-ani] unknown arg [%s]", optarg);
89 int main(int argc, char *argv[])
93 setenv("HOME", "/home/root", 1);
96 printf("Usage) %s {--start|--stop}\n", argv[0]);
98 printf(" # %s --start\n", argv[0]);
99 printf(" # %s --stop\n", argv[0]);
100 printf(" # %s --off\n", argv[0]);
108 static int invoked_flag = 0;
109 if (invoked_flag == 1)
115 fd = open("/tmp/myfile.txt", O_CREAT|O_RDWR, S_IRWXU|S_IRGRP);
116 __D("Result of log file open: %d", fd);
118 elm_init(argc, argv);
119 boot_exit = elm_exit;
122 boot_type = __check_on_off_type(&args);
124 __E("Failed to get on off type or UNKNOWN_TYPE: %d", boot_type);
128 if (animation_init(boot_type) != EXIT_SUCCESS) {
129 __E("Exit boot-animation");
133 if (vconf_set_int(VCONFKEY_BOOT_ANIMATION_FINISHED, 0) != 0)
134 __D("Failed to set finished value to 0\n");
136 play_boot_sound(boot_type);
149 int __t__check_on_off_type(void *user_data)
151 return __check_on_off_type(user_data);