.xinitrc: Added Pandora-Type recognition to determine safe speed after a crash happened
[openpandora.oe.git] / recipes / pandora-system / pandora-skel / .xinitrc
index 9caa08c..cebf5af 100644 (file)
@@ -44,6 +44,8 @@ xmodmap ~/.pndXmodmap
 #Write the current user into /tmp/currentuser for any scripts or programs who want to make use of it
 whoami > /tmp/currentuser
 id -u > /tmp/currentuid
+chmod 777 /tmp/currentuser
+chmod 777 /tmp/currentuid
 
 # HUP pndnotifyd to make sure it picks up the users home.
 killall -1 pndnotifyd &
@@ -81,15 +83,28 @@ chmod +x /tmp/gui.stop
 # after the old one is quit by simply executing the command that's in /tmp/gui.load
 
 # This way, we can easily do a quick switch from any session to the next one by simply
-# echo'ing the new session executable into /tmp/gui.load and exiting.
+# echo'ing the new session executable into /tmp/gui.load and exiting.    
+
+nocleanwarn=$(cat /tmp/nocleanwarn)
+
+if [ $nocleanwarn = "Yes" ]; then
+
+  pnd_version=$(dmesg | grep OMAP3 | grep ES | awk '{print $3}')
+  if [ "$pnd_version" == "OMAP3630" ]; then
+      safespeed="1000"
+  else
+      safespeed="600"
+  fi
 
-if [ -f /tmp/nocleanwarn ]; then
     defmhz="$(cat /etc/pandora/conf/cpu.conf | grep default | awk -F\: '{print $2}')"
-      if [ $defmhz -gt 600 ]; then
-       zenity --info --title="Unclean Shutdown" --text "Warning!\n\nThe system has not been shutdown properly last time.\n\nAs you overclocked the CPU as default speed, this might be the reason for that.\nTherefore, for this session, the current CPU speed has been set to 500 MHz."
+      if [ $defmhz -gt $safespeed ]; then
+         if zenity --question --title="Unclean Shutdown" --text="Warning!\n\nThe system has not been shutdown properly last time.\n\nAs you overclocked the CPU as default speed, this might be the reason for that.\nTherefore CPU speed has been currently set to the standard CPU speed of your SoC.\n\nShould it be set to your default speed ($defmhz MHz) or shall we keep safe setting for this session?" --ok-label="Set it to $defmhz MHz" --cancel-label="Leave it safe..."; then
+           sudo /usr/pandora/scripts/op_cpuspeed.sh $defmhz
+         fi
       fi
-  rm /tmp/nocleanwarn
- fi
+  echo "No" > /tmp/nocleanwarn
+fi
+
 while true
 do
        rm /tmp/gui.load