meta-witherspoon: vcs-control: Add retries and journal entries

- Added journal entry for retrying ucd driver rebinding
- Added retry for finding the ucd driver entry
- Added sleep time in between retires to resolve any timing issue

Resolves openbmc/openbmc#1298

Change-Id: Id80f11e14d3f4ac59ead0ff171944ff83e8874b1
Signed-off-by: Saqib Khan <khansa@us.ibm.com>
diff --git a/meta-witherspoon/recipes-phosphor/chassis/vcs-pre-post/ucd_disable_vcs.sh b/meta-witherspoon/recipes-phosphor/chassis/vcs-pre-post/ucd_disable_vcs.sh
index 0ce07ea..49205cc 100644
--- a/meta-witherspoon/recipes-phosphor/chassis/vcs-pre-post/ucd_disable_vcs.sh
+++ b/meta-witherspoon/recipes-phosphor/chassis/vcs-pre-post/ucd_disable_vcs.sh
@@ -5,11 +5,21 @@
 # 10/28/16 PGR -
 # 11/10/16 PGR - unbind/bind UCD driver
 
+ucd_retries=5
+
 # unbind ucd driver to permit i2cset
 ucdpath="/sys/bus/i2c/drivers/ucd9000"
 if [ -e $ucdpath ]
 then
-  ucd=`ls $ucdpath | grep 64`
+  i=0
+  until [ $i -ge $ucd_retries ] || [ ! -z $ucd ]; do
+    ucd=`ls $ucdpath | grep 64`
+    if [ $i -ge "1" ]; then
+      echo "Unable to find UCD driver. Retry number $i"
+      sleep 1
+    fi
+    i=$((i+1))
+  done
   echo $ucd > $ucdpath/unbind
 fi
 
@@ -27,12 +37,15 @@
 i2cset -y 11 0x64 0x02 0x1A i
 
 # re-bind ucd driver
-ucd_retries="5"
 if [ -e $ucdpath ]; then
-  i=0
-  until [ $i -ge $ucd_retries ] || [ -e $ucdpath/$ucd ]; do
-    i=$((i+1))
+  j=0
+  until [ $j -ge $ucd_retries ] || [ -e $ucdpath/$ucd ]; do
+    j=$((j+1))
     echo $ucd > $ucdpath/bind || ret=$?
+        if [ $j -gt 1 ]; then
+          echo "rebinding UCD driver. Retry number $j"
+          sleep 1
+    fi
   done
   if [ ! -e $ucdpath/$ucd ]; then exit $ret; fi
 fi