The xor() function is defined in each of the caldata extraction
scripts for several targets. Move it to functions.sh to reduce
duplicate code.
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
LOAD_STATE=1
LIST_SEP=" "
+# xor multiple hex values of the same length
+xor() {
+ local val
+ local ret="0x$1"
+ local retlen=${#1}
+
+ shift
+ while [ -n "$1" ]; do
+ val="0x$1"
+ ret=$((ret ^ val))
+ shift
+ done
+
+ printf "%0${retlen}x" "$ret"
+}
+
append() {
local var="$1"
local value="$2"
printf "%b" "$caldata" > /lib/firmware/$FIRMWARE
}
-xor() {
- local val
- local ret="0x$1"
- local retlen=${#1}
-
- shift
- while [ -n "$1" ]; do
- val="0x$1"
- ret=$((ret ^ val))
- shift
- done
-
- printf "%0${retlen}x" "$ret"
-}
-
ath9k_patch_fw_mac() {
local mac=$1
local mac_offset=$(($2))
#!/bin/sh
+. /lib/functions.sh
. /lib/functions/k2t.sh
-# xor multiple hex values of the same length
-xor() {
- local val
- local ret="0x$1"
- local retlen=${#1}
-
- shift
- while [ -n "$1" ]; do
- val="0x$1"
- ret=$((ret ^ val))
- shift
- done
-
- printf "%0${retlen}x" "$ret"
-}
-
ath10kcal_die() {
echo "ath10cal: " "$*"
exit 1
[ -e /lib/firmware/$FIRMWARE ] && exit 0
-. /lib/functions.sh
. /lib/functions/system.sh
board=$(board_name)
#!/bin/sh
-# xor multiple hex values of the same length
-xor() {
- local val
- local ret="0x$1"
- local retlen=${#1}
-
- shift
- while [ -n "$1" ]; do
- val="0x$1"
- ret=$((ret ^ val))
- shift
- done
-
- printf "%0${retlen}x" "$ret"
-}
+. /lib/functions.sh
ath10kcal_die() {
echo "ath10cal: " "$*"
[ -e /lib/firmware/$FIRMWARE ] && exit 0
-. /lib/functions.sh
. /lib/functions/system.sh
board=$(board_name)
#!/bin/sh
-# xor multiple hex values of the same length
-xor() {
- local val
- local ret="0x$1"
- local retlen=${#1}
-
- shift
- while [ -n "$1" ]; do
- val="0x$1"
- ret=$((ret ^ val))
- shift
- done
-
- printf "%0${retlen}x" "$ret"
-}
+. /lib/functions.sh
ath10kcal_die() {
echo "ath10cal: " "$*"
[ -e /lib/firmware/$FIRMWARE ] && exit 0
-. /lib/functions.sh
. /lib/functions/system.sh
board=$(board_name)
. /lib/functions/system.sh
. /lib/upgrade/nand.sh
-# xor multiple hex values of the same length
-xor() {
- local val
- local ret="0x$1"
- local retlen=${#1}
-
- shift
- while [ -n "$1" ]; do
- val="0x$1"
- ret=$((ret ^ val))
- shift
- done
-
- printf "%0${retlen}x" "$ret"
-}
-
ath9k_eeprom_die() {
echo "ath9k eeprom: $*"
exit 1