Add support for PR3 battery device name
[apps/core/preloaded/settings.git] / setting-about / src / setting-about-main.c
index dcd10e4..01a17b1 100755 (executable)
@@ -1,22 +1,18 @@
 /*
  * setting
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
- *
- * Contact: MyoungJune Park <mj2004.park@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Flora License, Version 1.0 (the License);
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- * http://www.apache.org/licenses/LICENSE-2.0
+ *     http://floralicense.org/license/
  *
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
+ * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
  */
 #include <setting-cfg.h>
 #include <setting-about-main.h>
@@ -317,12 +313,18 @@ void setting_about_main_get_wifi_mac_address_string(char *str, int size)
 void setting_about_main_get_battery_string(char *str, int size)
 {
        setting_retm_if(str == NULL, "str parameter is NULL");
+       struct stat fileAttrs;
 
        int val = -1;
        char file[MAX_DISPLAY_STR_LEN_ON_PHONE_INFO] = { 0, };
        snprintf(file, MAX_DISPLAY_STR_LEN_ON_PHONE_INFO,
                 "%s/%s/%s", SETTING_ABOUT_POWER_SUPPLY_PATH, "battery", "capacity");
 
+       /* If Samsung battery not found, check if this is PR3 */
+       if (stat(file, &fileAttrs) < 0)
+               snprintf(file, MAX_DISPLAY_STR_LEN_ON_PHONE_INFO,
+                  "%s/%s/%s", SETTING_ABOUT_POWER_SUPPLY_PATH, "max170xx_battery", "capacity");
+
        char buf[MAX_DISPLAY_STR_LEN_ON_PHONE_INFO] = { 0, };
        int fd = 0;
        int r = 0;