Add support for PR3 battery device name
authorBrad Peters <brad.t.peters@intel.com>
Tue, 12 Feb 2013 22:19:12 +0000 (14:19 -0800)
committerBrad Peters <brad.t.peters@intel.com>
Tue, 12 Feb 2013 22:19:12 +0000 (14:19 -0800)
setting-about/src/setting-about-main.c

index 93d481b..01a17b1 100755 (executable)
@@ -313,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;