3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
30 static char *def_values[][IDX_END] = {
31 {"PM_INPUT", "/dev/event0:/dev/event1"},
33 {"PM_TO_NORMAL", "600"},
34 {"PM_TO_LCDDIM", "5"},
35 {"PM_TO_LCDOFF", "5"},
37 {"PM_SYS_POWER", "/sys/power/state"},
38 {"PM_SYS_BRIGHT", "/sys/class/backlight/mobile-bl/brightness"},
39 {"PM_SYS_BRIGHT", "/sys/class/backlight/mobile-bl/max_brightness"},
40 {"PM_SYS_BLPWR", "/sys/class/backlight/mobile-bl/bl_power"},
41 {"PM_SYS_DIMBRT", "0"},
43 {"PM_SYS_BLOFF", "4"},
44 {"PM_SYS_FB_NORMAL", "1"},
45 {"PM_SYS_STATE", "mem"},
46 {"PM_EXEC_PRG", NULL},
50 static char *_find_default(char *name)
55 while (strcmp("PM_END", def_values[i][IDX_NAME])) {
56 if (!strcmp(name, def_values[i][IDX_NAME])) {
57 ret = def_values[i][IDX_DEFAULT];
65 int get_env(char *name, char *buf, int size)
70 if ((ret == NULL) || (strlen(ret) > 1024)) {
71 ret = _find_default(name);
73 snprintf(buf, size, "%s", ret);
75 snprintf(buf, size, "");
77 snprintf(buf, size, "%s", ret);