platform: adding led error code for each channel
* Adding more specific codes for when the gflt3 is unable
to tune to the requested channel.
* Added previously missing case for ACS connectivity but no laser
channel
Change-Id: Ia61e7c0b357f70f7edb215db4986d456e7b264b5
diff --git a/ledpattern/ledpatterns b/ledpattern/ledpatterns
index 2e0ab63..0b86fb7 100644
--- a/ledpattern/ledpatterns
+++ b/ledpattern/ledpatterns
@@ -1,12 +1,28 @@
-HALTED,P,R
-NO_LASER_CHANNEL,P,P
-SET_LASER_FAILED,P,R,R
-LOSLOF_ALARM,P,R,B
-OTHER_ALARM,P,R,P
-GPON_INITIAL,P,B,R
-GPON_STANDBY,P,B,P
-GPON_SERIAL,P,P,R
-GPON_RANGING,P,P,B
+SET_LASER_FAILED_0,P,R,R,R,R
+SET_LASER_FAILED_1,P,R,R,R,B
+SET_LASER_FAILED_2,P,R,R,B,R
+SET_LASER_FAILED_3,P,R,R,B,B
+SET_LASER_FAILED_4,P,R,B,R,R
+SET_LASER_FAILED_5,P,R,B,R,B
+SET_LASER_FAILED_6,P,R,B,B,R
+SET_LASER_FAILED_7,P,R,B,B,B
+SET_LASER_FAILED_8,P,B,R,R,R
+SET_LASER_FAILED_9,P,B,R,R,B
+SET_LASER_FAILED_10,P,B,R,B,R
+SET_LASER_FAILED_11,P,B,R,B,B
+SET_LASER_FAILED_12,P,B,B,R,R
+SET_LASER_FAILED_13,P,B,B,R,B
+SET_LASER_FAILED_14,P,B,B,B,R
+SET_LASER_FAILED_15,P,B,B,B,B
+GPON_INITIAL,P,P,R,R
+GPON_STANDBY,P,P,R,B
+GPON_SERIAL,P,P,B,R
+GPON_RANGING,P,P,B,B
+HALTED,P,R,R
+NO_LASER_CHANNEL,P,R,B
+LOSLOF_ALARM,P,R,P
+OTHER_ALARM,P,B,R
WAIT_ACS,P,B,B
-ALL_OK,P,B,B,B
-UNKNOWN_ERROR,P,R,R,R
+ALL_OK,P,B
+UNKNOWN_ERROR,P,R
+
diff --git a/ledpattern/ledtapcode.sh b/ledpattern/ledtapcode.sh
index 6841f2f..7793993 100755
--- a/ledpattern/ledtapcode.sh
+++ b/ledpattern/ledtapcode.sh
@@ -44,8 +44,15 @@
if [ -f "$LASER_STATUS_FILE" ]; then
laser_status=$(cat "$LASER_STATUS_FILE")
if [ "$laser_status" -ne 0 ]; then
- echo "Playing SET_LASER_FAILED pattern"
- PlayPatternAndExit SET_LASER_FAILED
+ # Blink out requested laser channel that we failed to tune to
+ laser_channel=$(cat "$LASER_CHANNEL_FILE")
+ if [ "$laser_channel" -eq -1 ]; then
+ echo "$LASER_STATUS_FILE indicates success but there is no requested
+ channel in $LASER_CHANNEL_FILE"
+ PlayPatternAndExit UNKNOWN_ERROR
+ fi
+ echo "Playing SET_LASER_FAILED_${laser_channel} pattern"
+ PlayPatternAndExit "SET_LASER_FAILED_${laser_channel}"
fi
fi
@@ -89,19 +96,35 @@
PlayPatternAndExit GPON_RANGING
fi
-laser_channel=$(cat "$LASER_CHANNEL_FILE")
-if [ ! -f "$ACS_FILE" ] && [ "$laser_channel" -eq "-1" ]; then
- echo "Playing NO_LASER_CHANNEL pattern"
- PlayPatternAndExit NO_LASER_CHANNEL
-elif [ ! -f "$ACS_FILE" ] && [ $laser_channel -ne "-1" ]; then
- echo "Playing WAIT_ACS pattern"
- PlayPatternAndExit WAIT_ACS
-elif [ -f "$ACS_FILE" ] && [ $laser_channel -ne "-1" ]; then
- echo "Playing ALL_OK pattern"
- PlayPatternAndExit ALL_OK
-else
- # If we get all the way here and nothing triggered on the way then this really
- # is an unknown error...
- echo "Nothing triggered? Playing UNKNOWN_ERROR pattern..."
- PlayPatternAndExit UNKNOWN_ERROR
+# GFLT110 does not have tuneable laser
+tuneable_laser="false"
+if startswith "$(cat /etc/platform)" "GFLT3"; then
+ tuneable_laser="true"
fi
+
+if [ "$tuneable_laser" = false ]; then
+ if [ ! -f "$ACS_FILE" ]; then
+ echo "Playing WAIT_ACS pattern"
+ PlayPatternAndExit WAIT_ACS
+ else
+ echo "Playing ALL_OK pattern"
+ PlayPatternAndExit ALL_OK
+ fi
+else
+ laser_channel=$(cat "$LASER_CHANNEL_FILE")
+ if [ ! -f "$ACS_FILE" ] && [ "$laser_channel" -eq "-1" ]; then
+ echo "Playing NO_LASER_CHANNEL pattern"
+ PlayPatternAndExit NO_LASER_CHANNEL
+ elif [ ! -f "$ACS_FILE" ] && [ "$laser_channel" -ne "-1" ]; then
+ echo "Playing WAIT_ACS pattern"
+ PlayPatternAndExit WAIT_ACS
+ elif [ -f "$ACS_FILE" ] && [ "$laser_channel" -eq "-1" ]; then
+ echo "Has ACS but no laser channel"
+ echo "Playing NO_LASER_CHANNEL pattern"
+ PlayPatternAndExit NO_LASER_CHANNEL
+ else
+ echo "Playing ALL_OK pattern"
+ PlayPatternAndExit ALL_OK
+ fi
+fi
+