qualcomm: generalize log function to pass the log level

We need to pass different log levels depending on the message, so they
appear in the console, so generalize the 'log' function.

https://jira.digi.com/browse/DEL-4682

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2017-07-27 14:05:29 +02:00
parent 071339a1d4
commit b421fb7995
2 changed files with 11 additions and 11 deletions

View File

@ -18,7 +18,7 @@
# At this point of the boot (udev script), the system log (syslog) is not # At this point of the boot (udev script), the system log (syslog) is not
# available yet, so use the kernel log buffer from userspace. # available yet, so use the kernel log buffer from userspace.
log() { log() {
printf "<5>qca6564: $1\n" >/dev/kmsg printf "<$1>qca6564: $2\n" >/dev/kmsg
} }
# Do nothing if the module is already loaded # Do nothing if the module is already loaded
@ -60,7 +60,7 @@ case "${DTB_REGION_CODE}" in
REGULATORY_DOMAIN="${DTB_REGION_CODE}";; REGULATORY_DOMAIN="${DTB_REGION_CODE}";;
*) *)
if [ -n "${DTB_REGION_CODE}" ]; then if [ -n "${DTB_REGION_CODE}" ]; then
log "[WARN] Invalid region code in device tree, using OTP value" log "5" "[WARN] Invalid region code in device tree, using OTP value"
fi fi
REGULATORY_DOMAIN="${OTP_REGION_CODE}";; REGULATORY_DOMAIN="${OTP_REGION_CODE}";;
esac esac
@ -74,19 +74,19 @@ esac
BDATA_SOURCE="bdwlan30_US.bin" BDATA_SOURCE="bdwlan30_US.bin"
case "${REGULATORY_DOMAIN}" in case "${REGULATORY_DOMAIN}" in
${US_CODE}) ${US_CODE})
log "Setting US wireless region";; log "5" "Setting US wireless region";;
${WW_CODE}|${JP_CODE}) ${WW_CODE}|${JP_CODE})
if [ -f "bdwlan30_World.bin" ]; then if [ -f "bdwlan30_World.bin" ]; then
log "Setting WW (world wide) wireless region" log "5" "Setting WW (world wide) wireless region"
BDATA_SOURCE="bdwlan30_World.bin" BDATA_SOURCE="bdwlan30_World.bin"
else else
log "[WARN] No WW (worldwide) board data file, using US" log "5" "[WARN] No WW (worldwide) board data file, using US"
fi fi
;; ;;
"") "")
log "[WARN] region code not found, using US";; log "5" "[WARN] region code not found, using US";;
*) *)
log "[WARN] Invalid region code, using US";; log "5" "[WARN] Invalid region code, using US";;
esac esac
# We don't want to rewrite NAND every time we boot so only # We don't want to rewrite NAND every time we boot so only
@ -108,7 +108,8 @@ modprobe wlan
# Verify the interface is present # Verify the interface is present
if [ -d "/sys/class/net/wlan0" ]; then if [ -d "/sys/class/net/wlan0" ]; then
# Create 'wlan1' virtual interface # Create 'wlan1' virtual interface
virtwlans.sh VIRTWLANS_OUT="$(virtwlans.sh)"
[ -n "${VIRTWLANS_OUT}" ] && log "3" "${VIRTWLANS_OUT}"
else else
log "[ERROR] Loading qca6564 module" log "3" "[ERROR] Loading qca6564 module"
fi fi

View File

@ -21,8 +21,7 @@ if [ -s "/proc/device-tree/wireless/mac-address1" ] &&
[ -s "/proc/device-tree/wireless/mac-address3" ]; then [ -s "/proc/device-tree/wireless/mac-address3" ]; then
: :
else else
echo "WARNING: Using default MAC addresses for virtual interfaces, please " echo "[WARN] Using default MAC addresses for virtual interfaces, please program them referring to the Digi U-Boot Documentation"
echo "program them referring to the Digi U-Boot Documentation"
fi fi
if [ ! -d "/sys/class/net/wlan1" ]; then if [ ! -d "/sys/class/net/wlan1" ]; then