diff --git a/iopsys-brcm63xx-arm/base-files/usr/bin/kv_read b/iopsys-brcm63xx-arm/base-files/usr/bin/kv_read new file mode 100644 index 0000000000000000000000000000000000000000..bb626476dacb63dab30d3d440d1085870502307c --- /dev/null +++ b/iopsys-brcm63xx-arm/base-files/usr/bin/kv_read @@ -0,0 +1,8 @@ +#!/bin/sh +if [ "$1" == "" ] +then + cat /data/config/device_params +else + VALUE=$(cat /data/config/device_params | grep $1 | awk -F[=] '{print$2}') + echo "$VALUE" +fi diff --git a/iopsys-brcm63xx-arm/eagle/base-files/lib/functions/iopsys-environment.sh b/iopsys-brcm63xx-arm/eagle/base-files/lib/functions/iopsys-environment.sh new file mode 100644 index 0000000000000000000000000000000000000000..e5e422349aeac662d42b7a28e97da2ab900af1cb --- /dev/null +++ b/iopsys-brcm63xx-arm/eagle/base-files/lib/functions/iopsys-environment.sh @@ -0,0 +1,98 @@ +get_base_macaddr() { + local basemac="$(/usr/bin/kv_read BaseMacAddr)" + echo "$basemac" +} + +get_macaddr_maxsize() { + local maxsize="$(/usr/bin/kv_read NumMacAddrs)" + echo "$maxsize" +} + +get_board_id() { + local board_id="$(fw_printenv -n boardid | tr '_' '-')" + echo "$board_id" +} + +get_product_name() { + local prodname="$(/usr/bin/kv_read ProdName)" + echo "$prodname" +} + +get_serial_number() { + local serial_number="$(/usr/bin/kv_read SerialNumber)" + case $serial_number in + *[a-z]*|*[A-Z]*|*[0-9]*) ;; + *) serial_number="0000000000" ;; + esac + echo "$serial_number" +} + +get_psn() { + local psn="$(/usr/bin/kv_read PSN)" + case $psn in + *[a-z]*|*[A-Z]*|*[0-9]*) ;; + *) psn="0000000000" ;; + esac + echo "$psn" +} + +get_variant() { + local variant="$(/usr/bin/kv_read Variant)" + case $variant in + *[0-9]*) ;; + *) variant="0" ;; + esac + echo "$variant" +} + +get_hardware_version() { + local hardware_version="$(/usr/bin/kv_read HV)" + case $hardware_version in + .[0-9]*) hardware_version="1$hardware_version" ;; + [0-9]*) ;; + *) hardware_version="0" ;; + esac + echo "$hardware_version" +} + +get_wpa_key() { + local wpa_key="$(/usr/bin/kv_read WpaKey)" + case $wpa_key in + *[a-z]*|*[A-Z]*|*[0-9]*) wpa_key=$(echo $wpa_key | sed 's/[ \t]*$//') ;; + *) wpa_key="00000000" ;; + esac + echo "$wpa_key" +} + +get_des_key() { + local des_key="$(/usr/bin/kv_read DesKey)" + echo "$des_key" +} + +get_auth_key() { + local auth_key="$(/usr/bin/kv_read AuthKey)" + echo "$auth_key" +} + +get_user_password() { + local user_pass="$(/usr/bin/kv_read UserPassword)" + echo "$user_pass" +} + +get_acs_password() { + local acs_pass="$(/usr/bin/kv_read AcsPassword)" + echo "$acs_pass" +} + +get_production_mode() { + local production="$(/usr/bin/kv_read Production)" + echo "$production" +} + +get_dect_capability() { +# local dect=$(head -c 10 /proc/nvram/ulBoardStuffOption | tail -c 1) +# [ "$dect" = "1" -o "$dect" = "2" ] && dect="1" || dect="0" + local dect="0" + echo "$dect" +} + diff --git a/iopsys-brcm63xx-arm/panda/base-files/lib/functions/iopsys-environment.sh b/iopsys-brcm63xx-arm/panda/base-files/lib/functions/iopsys-environment.sh new file mode 100644 index 0000000000000000000000000000000000000000..e5e422349aeac662d42b7a28e97da2ab900af1cb --- /dev/null +++ b/iopsys-brcm63xx-arm/panda/base-files/lib/functions/iopsys-environment.sh @@ -0,0 +1,98 @@ +get_base_macaddr() { + local basemac="$(/usr/bin/kv_read BaseMacAddr)" + echo "$basemac" +} + +get_macaddr_maxsize() { + local maxsize="$(/usr/bin/kv_read NumMacAddrs)" + echo "$maxsize" +} + +get_board_id() { + local board_id="$(fw_printenv -n boardid | tr '_' '-')" + echo "$board_id" +} + +get_product_name() { + local prodname="$(/usr/bin/kv_read ProdName)" + echo "$prodname" +} + +get_serial_number() { + local serial_number="$(/usr/bin/kv_read SerialNumber)" + case $serial_number in + *[a-z]*|*[A-Z]*|*[0-9]*) ;; + *) serial_number="0000000000" ;; + esac + echo "$serial_number" +} + +get_psn() { + local psn="$(/usr/bin/kv_read PSN)" + case $psn in + *[a-z]*|*[A-Z]*|*[0-9]*) ;; + *) psn="0000000000" ;; + esac + echo "$psn" +} + +get_variant() { + local variant="$(/usr/bin/kv_read Variant)" + case $variant in + *[0-9]*) ;; + *) variant="0" ;; + esac + echo "$variant" +} + +get_hardware_version() { + local hardware_version="$(/usr/bin/kv_read HV)" + case $hardware_version in + .[0-9]*) hardware_version="1$hardware_version" ;; + [0-9]*) ;; + *) hardware_version="0" ;; + esac + echo "$hardware_version" +} + +get_wpa_key() { + local wpa_key="$(/usr/bin/kv_read WpaKey)" + case $wpa_key in + *[a-z]*|*[A-Z]*|*[0-9]*) wpa_key=$(echo $wpa_key | sed 's/[ \t]*$//') ;; + *) wpa_key="00000000" ;; + esac + echo "$wpa_key" +} + +get_des_key() { + local des_key="$(/usr/bin/kv_read DesKey)" + echo "$des_key" +} + +get_auth_key() { + local auth_key="$(/usr/bin/kv_read AuthKey)" + echo "$auth_key" +} + +get_user_password() { + local user_pass="$(/usr/bin/kv_read UserPassword)" + echo "$user_pass" +} + +get_acs_password() { + local acs_pass="$(/usr/bin/kv_read AcsPassword)" + echo "$acs_pass" +} + +get_production_mode() { + local production="$(/usr/bin/kv_read Production)" + echo "$production" +} + +get_dect_capability() { +# local dect=$(head -c 10 /proc/nvram/ulBoardStuffOption | tail -c 1) +# [ "$dect" = "1" -o "$dect" = "2" ] && dect="1" || dect="0" + local dect="0" + echo "$dect" +} + diff --git a/iopsys-brcm63xx-arm/panther/base-files/lib/functions/iopsys-environment.sh b/iopsys-brcm63xx-arm/panther/base-files/lib/functions/iopsys-environment.sh new file mode 100644 index 0000000000000000000000000000000000000000..e5e422349aeac662d42b7a28e97da2ab900af1cb --- /dev/null +++ b/iopsys-brcm63xx-arm/panther/base-files/lib/functions/iopsys-environment.sh @@ -0,0 +1,98 @@ +get_base_macaddr() { + local basemac="$(/usr/bin/kv_read BaseMacAddr)" + echo "$basemac" +} + +get_macaddr_maxsize() { + local maxsize="$(/usr/bin/kv_read NumMacAddrs)" + echo "$maxsize" +} + +get_board_id() { + local board_id="$(fw_printenv -n boardid | tr '_' '-')" + echo "$board_id" +} + +get_product_name() { + local prodname="$(/usr/bin/kv_read ProdName)" + echo "$prodname" +} + +get_serial_number() { + local serial_number="$(/usr/bin/kv_read SerialNumber)" + case $serial_number in + *[a-z]*|*[A-Z]*|*[0-9]*) ;; + *) serial_number="0000000000" ;; + esac + echo "$serial_number" +} + +get_psn() { + local psn="$(/usr/bin/kv_read PSN)" + case $psn in + *[a-z]*|*[A-Z]*|*[0-9]*) ;; + *) psn="0000000000" ;; + esac + echo "$psn" +} + +get_variant() { + local variant="$(/usr/bin/kv_read Variant)" + case $variant in + *[0-9]*) ;; + *) variant="0" ;; + esac + echo "$variant" +} + +get_hardware_version() { + local hardware_version="$(/usr/bin/kv_read HV)" + case $hardware_version in + .[0-9]*) hardware_version="1$hardware_version" ;; + [0-9]*) ;; + *) hardware_version="0" ;; + esac + echo "$hardware_version" +} + +get_wpa_key() { + local wpa_key="$(/usr/bin/kv_read WpaKey)" + case $wpa_key in + *[a-z]*|*[A-Z]*|*[0-9]*) wpa_key=$(echo $wpa_key | sed 's/[ \t]*$//') ;; + *) wpa_key="00000000" ;; + esac + echo "$wpa_key" +} + +get_des_key() { + local des_key="$(/usr/bin/kv_read DesKey)" + echo "$des_key" +} + +get_auth_key() { + local auth_key="$(/usr/bin/kv_read AuthKey)" + echo "$auth_key" +} + +get_user_password() { + local user_pass="$(/usr/bin/kv_read UserPassword)" + echo "$user_pass" +} + +get_acs_password() { + local acs_pass="$(/usr/bin/kv_read AcsPassword)" + echo "$acs_pass" +} + +get_production_mode() { + local production="$(/usr/bin/kv_read Production)" + echo "$production" +} + +get_dect_capability() { +# local dect=$(head -c 10 /proc/nvram/ulBoardStuffOption | tail -c 1) +# [ "$dect" = "1" -o "$dect" = "2" ] && dect="1" || dect="0" + local dect="0" + echo "$dect" +} + diff --git a/iopsys-brcm63xx-arm/tiger/base-files/lib/functions/iopsys-environment.sh b/iopsys-brcm63xx-arm/tiger/base-files/lib/functions/iopsys-environment.sh new file mode 100644 index 0000000000000000000000000000000000000000..e5e422349aeac662d42b7a28e97da2ab900af1cb --- /dev/null +++ b/iopsys-brcm63xx-arm/tiger/base-files/lib/functions/iopsys-environment.sh @@ -0,0 +1,98 @@ +get_base_macaddr() { + local basemac="$(/usr/bin/kv_read BaseMacAddr)" + echo "$basemac" +} + +get_macaddr_maxsize() { + local maxsize="$(/usr/bin/kv_read NumMacAddrs)" + echo "$maxsize" +} + +get_board_id() { + local board_id="$(fw_printenv -n boardid | tr '_' '-')" + echo "$board_id" +} + +get_product_name() { + local prodname="$(/usr/bin/kv_read ProdName)" + echo "$prodname" +} + +get_serial_number() { + local serial_number="$(/usr/bin/kv_read SerialNumber)" + case $serial_number in + *[a-z]*|*[A-Z]*|*[0-9]*) ;; + *) serial_number="0000000000" ;; + esac + echo "$serial_number" +} + +get_psn() { + local psn="$(/usr/bin/kv_read PSN)" + case $psn in + *[a-z]*|*[A-Z]*|*[0-9]*) ;; + *) psn="0000000000" ;; + esac + echo "$psn" +} + +get_variant() { + local variant="$(/usr/bin/kv_read Variant)" + case $variant in + *[0-9]*) ;; + *) variant="0" ;; + esac + echo "$variant" +} + +get_hardware_version() { + local hardware_version="$(/usr/bin/kv_read HV)" + case $hardware_version in + .[0-9]*) hardware_version="1$hardware_version" ;; + [0-9]*) ;; + *) hardware_version="0" ;; + esac + echo "$hardware_version" +} + +get_wpa_key() { + local wpa_key="$(/usr/bin/kv_read WpaKey)" + case $wpa_key in + *[a-z]*|*[A-Z]*|*[0-9]*) wpa_key=$(echo $wpa_key | sed 's/[ \t]*$//') ;; + *) wpa_key="00000000" ;; + esac + echo "$wpa_key" +} + +get_des_key() { + local des_key="$(/usr/bin/kv_read DesKey)" + echo "$des_key" +} + +get_auth_key() { + local auth_key="$(/usr/bin/kv_read AuthKey)" + echo "$auth_key" +} + +get_user_password() { + local user_pass="$(/usr/bin/kv_read UserPassword)" + echo "$user_pass" +} + +get_acs_password() { + local acs_pass="$(/usr/bin/kv_read AcsPassword)" + echo "$acs_pass" +} + +get_production_mode() { + local production="$(/usr/bin/kv_read Production)" + echo "$production" +} + +get_dect_capability() { +# local dect=$(head -c 10 /proc/nvram/ulBoardStuffOption | tail -c 1) +# [ "$dect" = "1" -o "$dect" = "2" ] && dect="1" || dect="0" + local dect="0" + echo "$dect" +} +