-
-export CHG_ENV_BATT_CAP=/sys/class/power_supply/battery/capacity
-export CHG_ENV_BATT_VOL_NOW=/sys/class/power_supply/battery/voltage_now
-export CHG_ENV_BATT_CHG_NOW=/sys/class/power_supply/battery/charge_now
-export CHG_ENV_BATT_TEMP=/sys/class/power_supply/battery/temp
-export CHG_ENV_BATT_CHG_FULL=/sys/class/power_supply/battery/charge_full
-export CHG_ENV_BATT_ONLINE=/sys/class/power_supply/battery/online
-export CHG_ENV_BATT_HEALTH=/sys/class/power_supply/battery/health
-export CHG_ENV_BATT_PRESENT=/sys/class/power_supply/battery/present
-
-export CHG_ENV_POWER_STATE=/sys/power/state
-
-PATH_BRIGHT=
-for file in /sys/class/backlight/*; do
- if [ -e $file ]; then
- PATH_BRIGHT=$file
- break
- fi
-done
-
-export CHG_ENV_LCD_BRIGHT=${PATH_BRIGHT}/brightness
-
-
+CHG_ENV_BATT_CAP=/sys/class/power_supply/battery/capacity
+CHG_ENV_BATT_VOL_NOW=/sys/class/power_supply/battery/voltage_now
+CHG_ENV_BATT_CHG_NOW=/sys/class/power_supply/battery/charge_now
+CHG_ENV_BATT_TEMP=/sys/class/power_supply/battery/temp
+CHG_ENV_BATT_CHG_FULL=/sys/class/power_supply/battery/charge_full
+CHG_ENV_BATT_ONLINE=/sys/class/power_supply/battery/online
+CHG_ENV_BATT_HEALTH=/sys/class/power_supply/battery/health
+CHG_ENV_BATT_PRESENT=/sys/class/power_supply/battery/present
+
+CHG_ENV_POWER_STATE=/sys/power/state
+CHG_ENV_SUPPORT_FB=0
+CHG_ENV_SUPPORT_DRM=1
-export CHG_ENV_SUPPORT_FB=0
-export CHG_ENV_SUPPORT_DRM=1
+CHG_ENV_DEV_FB=
+CHG_ENV_DEV_DRM_NAME=exynos
-export CHG_ENV_DEV_FB=
-export CHG_ENV_DEV_DRM_NAME=exynos
+CHG_ENV_LCD_BRIGHT=/sys/class/backlight/s6e8aa0-bl/brightness
+CHG_ENV_LCD_BR_DIMM_VAL=0
+CHG_ENV_LCD_BR_NORM_VAL=10
-export CHG_ENV_LCD_BR_DIMM_VAL=0
-export CHG_ENV_LCD_BR_NORM_VAL=10
+CHG_ENV_LCD_BL_ONOFF=/sys/class/graphics/fb3/blank
+CHG_ENV_LCD_BL_ON_VAL=0
+CHG_ENV_LCD_BL_OFF_VAL=4
+CHG_ENV_LCD_BL_NORM_VAL=
-export CHG_ENV_LCD_BL_ONOFF=/sys/class/graphics/fb3/blank
-export CHG_ENV_LCD_BL_ON_VAL=0
-export CHG_ENV_LCD_BL_OFF_VAL=4
-export CHG_ENV_LCD_BL_NORM_VAL=
-
-export CHG_ENV_LCD_XRES=720
-export CHG_ENV_LCD_YRES=1280
-
-export CHG_ENV_KEY_EVENT=/dev/event1
+CHG_ENV_LCD_XRES=720
+CHG_ENV_LCD_YRES=1280
+CHG_ENV_KEY_EVENT=/dev/event1
--- /dev/null
+* Fri Jul 28 2012 Yin Kangkai <kangkai.yin@intel.com>
+- Port from sysV rc script based to systemd based.
Group: misc
License: Flora Software License
Source0: %{name}-%{version}.tar.gz
+Source100: charging-mode.target
+Source101: charging-mode.service
BuildRequires: cmake
cd cmake_tmp
%make_install
+# systemd related
+mkdir -p %{buildroot}%{_libdir}/systemd/system/
+install -m 0644 %{SOURCE100} %{buildroot}%{_libdir}/systemd/system/
+install -m 0644 %{SOURCE101} %{buildroot}%{_libdir}/systemd/system/
+mkdir -p %{buildroot}%{_libdir}/systemd/system/charging-mode.target.wants
+ln -s ../charging-mode.service %{buildroot}%{_libdir}/systemd/system/charging-mode.target.wants/charging-mode.service
+
%post
chmod 755 /etc/rc.d/init.d/run-chg-ani
mkdir -p /etc/rc.d/rc2.d
%files
%defattr(-,root,root,-)
-%{_prefix}/bin/*
-%{_prefix}/share/*
-/etc/*
-
-
+%attr(755,-,-) %{_sysconfdir}/rc.d/init.d/run-chg-ani
+%{_sysconfdir}/*
+%{_bindir}/*
+%dir %{_libdir}/systemd/system/charging-mode.target.wants
+%{_libdir}/systemd/system/*
+%{_datadir}/*
--- /dev/null
+[Unit]
+Description=Charging Mode Service
+OnFailure=basic.target
+
+[Service]
+Type=simple
+EnvironmentFile=-/usr/share/charging-animation/config/common.cfg
+EnvironmentFile=-/etc/sysconfig/charging-animation
+ExecStartPre=-/bin/bash -c '/bin/echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor'
+ExecStart=/usr/bin/charging-animation
+Restart=always
+RestartSec=5
--- /dev/null
+[Unit]
+Description=Charging Mode
+Conflicts=graphical.target
+AllowIsolate=yes
+
+[Install]
+Alias=default.target
#
# For Charging Boot
+set -a
+
do_charging_ani() {
echo "charging animation ..."
source @CFGDIR@/common.cfg
+ # export the platform specific variables
+ source /etc/sysconfig/charging-animation
+
if [ "${CHG_ENV_SUPPORT_DRM}" = "1" ]; then
/sbin/udevd --daemon
/sbin/udevadm trigger --subsystem-match=drm