Merge "buildroot: Add has-tuneable-laser and has-g.hn"
diff --git a/fs/skeleton/bin/has-ghn b/fs/skeleton/bin/has-ghn
new file mode 100755
index 0000000..217a842
--- /dev/null
+++ b/fs/skeleton/bin/has-ghn
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# Returns 0 (true) if this device has a local G.hn node
+# By checking for marvell's DEK tool: configlayer
+#
+. /etc/utils.sh
+if runnable configlayer; then
+ exit 0
+else
+ exit 1
+fi
diff --git a/fs/skeleton/bin/has-tuneable-laser b/fs/skeleton/bin/has-tuneable-laser
new file mode 100755
index 0000000..3e97d37
--- /dev/null
+++ b/fs/skeleton/bin/has-tuneable-laser
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# Returns 0 (true) if this device has a tuneable laser
+#
+. /etc/utils.sh
+plat=$(cat /etc/platform)
+if startswith "$plat" "GFLT3" ; then
+ exit 0
+else
+ exit 1
+fi
diff --git a/fs/skeleton/etc/init.d/S74lasertune.platform_gfiberlt b/fs/skeleton/etc/init.d/S74lasertune.platform_gfiberlt
index aa4dff5..7dc8d78 100755
--- a/fs/skeleton/etc/init.d/S74lasertune.platform_gfiberlt
+++ b/fs/skeleton/etc/init.d/S74lasertune.platform_gfiberlt
@@ -1,11 +1,10 @@
#!/bin/sh
. /etc/utils.sh
-platform=$(cat /etc/platform)
case "$1" in
start)
- if startswith "$platform" "GFLT3"; then
+ if has-tuneable-laser; then
echo "Starting lasertune."
babysit 5 lasertune 2>&1 | logos lasertune &
fi
diff --git a/fs/skeleton/usr/bin/ghn-periodic-stats.platform_gfiberlt b/fs/skeleton/usr/bin/ghn-periodic-stats.platform_gfiberlt
index 879d1b6..ad3ddba 100755
--- a/fs/skeleton/usr/bin/ghn-periodic-stats.platform_gfiberlt
+++ b/fs/skeleton/usr/bin/ghn-periodic-stats.platform_gfiberlt
@@ -16,9 +16,7 @@
exit 99
}
-platform=$(cat /etc/platform)
-if ! startswith "$platform" "GFLT4"; then
- # Only GFLT400 has G.hn chip (Marvell's 88x5153)
+if ! has-ghn; then
exit 0
fi
diff --git a/fs/skeleton/usr/bin/lasertune.platform_gfiberlt b/fs/skeleton/usr/bin/lasertune.platform_gfiberlt
index 7b7a091..aa0f553 100755
--- a/fs/skeleton/usr/bin/lasertune.platform_gfiberlt
+++ b/fs/skeleton/usr/bin/lasertune.platform_gfiberlt
@@ -3,7 +3,6 @@
. /etc/utils.sh
laser_channel_file="/sys/devices/platform/gpon/misc/laserChannel"
-platform=$(cat /etc/platform)
prev_laser_channel=-1
# Initially be very aggressive about acquiring a channel, then back off once
@@ -15,7 +14,7 @@
echo "$@" >&2
}
-if ! startswith "$platform" "GFLT3"; then
+if ! has-tuneable-laser; then
# not all fiberjacks have a tunable laser.
exit 0
fi
diff --git a/fs/skeleton/usr/bin/read-ghn-local.platform_gfiberlt b/fs/skeleton/usr/bin/read-ghn-local.platform_gfiberlt
index a3988d1..b528523 100755
--- a/fs/skeleton/usr/bin/read-ghn-local.platform_gfiberlt
+++ b/fs/skeleton/usr/bin/read-ghn-local.platform_gfiberlt
@@ -15,9 +15,7 @@
exit 99
}
-platform=$(cat /etc/platform)
-if ! startswith "$platform" "GFLT4"; then
- # Only GFLT400 has G.hn chip (Marvell's 88x5153)
+if ! has-ghn; then
exit 0
fi
diff --git a/fs/skeleton/usr/bin/reset-ghn.platform_gfiberlt b/fs/skeleton/usr/bin/reset-ghn.platform_gfiberlt
index 9f5bdf0..87f6a52 100755
--- a/fs/skeleton/usr/bin/reset-ghn.platform_gfiberlt
+++ b/fs/skeleton/usr/bin/reset-ghn.platform_gfiberlt
@@ -12,8 +12,7 @@
exit 99
}
-platform=$(cat /etc/platform)
-if ! startswith "$platform" "GFLT4"; then
+if ! has-ghn; then
# Only GFLT400 has G.hn chip (Marvell's 88x5153)
exit 0
fi
diff --git a/fs/skeleton/usr/bin/set_laser_channel.platform_gfiberlt b/fs/skeleton/usr/bin/set_laser_channel.platform_gfiberlt
index 48ced0e..ea159c8 100755
--- a/fs/skeleton/usr/bin/set_laser_channel.platform_gfiberlt
+++ b/fs/skeleton/usr/bin/set_laser_channel.platform_gfiberlt
@@ -2,8 +2,6 @@
. /etc/utils.sh
-platform=$(cat /etc/platform)
-
usage() {
echo "Usage:"
echo
@@ -15,7 +13,7 @@
exit 99
}
-if ! startswith "$platform" "GFLT3"; then
+if ! has-tuneable-laser; then
# not all fiberjacks have tuneable optics.
exit 0
fi