2.0 alpha
[platform/core/system/devman.git] / src / display_wd.c
old mode 100755 (executable)
new mode 100644 (file)
similarity index 83%
rename from display_wd.c
rename to src/display_wd.c
index 9b179bc..3745221
@@ -4,7 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: DongGi Jang <dg0402.jang@samsung.com>
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -17,7 +17,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
-*/ 
+*/
 
 
 #include <stdio.h>
@@ -45,13 +45,16 @@ static void sig_quit(int signo)
        fprintf(stderr, "[DISPLAY_WD] display_wd will be exit for signal %d\n", signo);
        if(fifo_pollfd.fd >= 0)
                close(fifo_pollfd.fd);
-       if (access(fifo_path, F_OK) == 0) 
+       if (access(fifo_path, F_OK) == 0)
                unlink(fifo_path);
 }
 
 int main(void)
 {
-       int fd, ret, val = -1;
+       int fd = -1;
+       int ret = -1;
+       int val = -1;
+       int auto_brightness_state = -1;
        fifo_pollfd.fd = -1;
        setsid();
 
@@ -61,7 +64,7 @@ int main(void)
        fifo_pollfd.fd = open(fifo_path, O_WRONLY);
        if (fifo_pollfd.fd < 0) {
                fprintf(stderr, "[DISPLAY_WD] Cannot open the fifo file - %s.\n",
-                               fifo_path);
+                       fifo_path);
                return -1;
        }
 
@@ -74,7 +77,7 @@ int main(void)
        fifo_pollfd.fd = open(fifo_path, O_RDONLY);
        if (fifo_pollfd.fd < 0) {
                fprintf(stderr, "[DISPLAY_WD] Cannot open the fifo file - %s.\n",
-                               fifo_path);
+                       fifo_path);
                return -1;
        }
 
@@ -83,8 +86,8 @@ int main(void)
        while (ret != DISPLAY_WD_CANCEL) {
                if (poll(&fifo_pollfd, 1, -1) < 0) {
                        fprintf(stderr,
-                                       "[DISPLAY_WD] Cannot poll the fifo file - %s\n",
-                                       fifo_path);
+                               "[DISPLAY_WD] Cannot poll the fifo file - %s\n",
+                               fifo_path);
                        close(fifo_pollfd.fd);
                        return -1;
                }
@@ -92,8 +95,8 @@ int main(void)
                        read(fifo_pollfd.fd, &ret, sizeof(int));
                        if (ret == DISPLAY_WD_CANCEL) {
                                fprintf(stderr,
-                                               "[DISPLAY_WD] Canceled. - %s, %d\n",
-                                               fifo_path, ret);
+                                       "[DISPLAY_WD] Canceled. - %s, %d\n",
+                                       fifo_path, ret);
                                close(fifo_pollfd.fd);
                                return -1;
                        }
@@ -111,5 +114,11 @@ int main(void)
                device_set_property(DEVTYPE_LED, LED_PROP_BRIGHTNESS, 0);
        }
 
+       if (vconf_get_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, &auto_brightness_state) == 0) {
+               if (auto_brightness_state == SETTING_BRIGHTNESS_AUTOMATIC_PAUSE) {
+                       vconf_set_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, SETTING_BRIGHTNESS_AUTOMATIC_ON);
+               }
+       }
+
        return 0;
 }