diff --git a/general/overlay/usr/sbin/light b/general/overlay/usr/sbin/light index be2d0fdc..88d334d2 100644 --- a/general/overlay/usr/sbin/light +++ b/general/overlay/usr/sbin/light @@ -1,7 +1,7 @@ #!/bin/sh -GPIO_RED=78 -GPIO_GREEN=75 +GPIO_RED= +GPIO_GREEN= GPIO_BLUE= help() { @@ -14,7 +14,7 @@ setRed() { if [ -n "$GPIO_RED" ]; then [ $1 -eq 1 ] && gpio set "$GPIO_RED" || gpio clear "$GPIO_RED" else - echo "Red GPIO undefined" + echo "[INFO] Status Lights: Red GPIO undefined in /usr/sbin/light" > /dev/kmsg fi } @@ -22,7 +22,7 @@ setGreen() { if [ -n "$GPIO_GREEN" ]; then [ $1 -eq 1 ] && gpio set "$GPIO_GREEN" || gpio clear "$GPIO_GREEN" else - echo "Green GPIO undefined" + echo "[INFO] Status Lights: Green GPIO undefined in /usr/sbin/light" > /dev/kmsg fi } @@ -30,7 +30,7 @@ setBlue() { if [ -n "$GPIO_BLUE" ]; then [ $1 -eq 1 ] && gpio set "$GPIO_BLUE" || gpio clear "$GPIO_BLUE" else - echo "Blue GPIO undefined" + echo "[INFO] Status Lights: Blue GPIO undefined in /usr/sbin/light" > /dev/kmsg fi } diff --git a/general/package/quirc-openipc/files/qrparse b/general/package/quirc-openipc/files/qrparse new file mode 100755 index 00000000..fdbb36a2 --- /dev/null +++ b/general/package/quirc-openipc/files/qrparse @@ -0,0 +1,113 @@ +#!/bin/sh + +################################################################################ +# +# THIS SCRIPT WILL PARSE AN ZXING FORMAT QR CODE PAYLOAD FOR WIFI CREDENTIALS +# +# INPUT MUST BE PASSED IN SINGLE QUOTES +# +# BARCODE CONTENTS CAN BE FOUND HERE +# https://github.com/zxing/zxing/wiki/Barcode-Contents#wi-fi-network-config-android-ios-11 +# +# THIS SCRIPT USES SIMILAR LOGIC TO: +# https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/client/result/WifiResultParser.java +# +# @author jayfan0 +# +# OPENIPC USAGE: qrparse $(qrscan -p /mnt/mmcblk0p1/qrcode2.jpg | head -n 1) +# OPENIPC FULL USAGE: curl -s -o /tmp/img.jpg http://127.0.0.1/image.jpg ; qrparse $(qrscan -p /tmp/img.jpg | head -n 1) +################################################################################ + +if [ "$1" = "help" ]; then + echo -e "\n================= QRPARSER usage =================\n" + echo -e "Parse the QR code scanned by qrscan and extract wifi credentials\n" + echo -e "INPUT MUST BE PASSED IN SINGLE QUOTES\n" + echo -e "USAGE EXAMPLES:\n" + echo -e 'Standalone:\t\t qrparse $(qrscan -p /mnt/mmcblk0p1/qrcode2.jpg | head -n 1)\n' + echo -e 'With camera sensor:\t curl -s -o /tmp/img.jpg http://127.0.0.1/image.jpg ; qrparse $(qrscan -p /tmp/img.jpg | head -n 1)\n' + exit +fi + +# scan='WIFI:S:thi$iSmdsywifi;H:false;T:WPA2;P:$e£cr3tt;PH2:MSCHAPv2;;' +scan=$1 + +if [[ ${scan:0:5} == "WIFI:" ]]; then + + trunc=$(echo $scan | sed 's/WIFI://') + + delims=${trunc//[^;]} + + count=${#delims} + + fields=$(( $count-1 )) + + for i in $(seq 1 $fields); + do + line=$(echo $trunc | cut -d ';' -f $i) + + for j in $(seq 1 2); + do + single=$(echo $line | cut -d ':' -f $j) + + case $single in + S) + SSID=$(echo $line | cut -d ':' -f $(( j + 1 ))) + [ -z $SSID ] && echo "SSID Empty. Aborting" && exit + echo "SSID = $SSID" + ;; + + P) + password=$(echo $line | cut -d ':' -f $(( j + 1 ))) + echo "Password = $password" + ;; + + T) + auth=$(echo $line | cut -d ':' -f $(( j + 1 ))) + [ -z $auth ] && auth = "nopass" + echo "Authentication type = $auth" + ;; + + H) + hidden=$(echo $line | cut -d ':' -f $(( j + 1 ))) +# echo "Hidden SSID = $hidden" + ;; + + E) + eap=$(echo $line | cut -d ':' -f $(( j + 1 ))) + echo "EAP method = $eap" + ;; + + A) + anon=$(echo $line | cut -d ':' -f $(( j + 1 ))) + echo "Anonymous identity = $anon" + ;; + + I) + identity=$(echo $line | cut -d ':' -f $(( j + 1 ))) + echo "Identity = $identity" + ;; + + PH2) + ph2=$(echo $line | cut -d ':' -f $(( j + 1 ))) + echo "PH2 = $ph2" + ;; + esac + done + done + + # Unfortunately, in the past, H: was not just used for boolean 'hidden', but 'phase 2 method'. + # To try to retain backwards compatibility, we set one or the other based on whether the string + #is 'true' or 'false': + if [ ! -z $hidden ]; then + # If PH2 was specified separately, or if the value is clearly boolean, interpret it as 'hidden' + if [ ! -z "$ph2" ] || [[ $(echo "$hidden" | tr '[:upper:]' '[:lower:]') = $(echo "true") ]] || [[ $(echo "$hidden" | tr '[:upper:]' '[:lower:]') = $(echo "false") ]]; then + hidden=$hidden + echo "Hidden = $hidden" + else + ph2=$hidden + echo "PH2 = $ph2" + fi + fi +else + echo "Invalid QR Code" +fi diff --git a/general/package/quirc-openipc/quirc-openipc.mk b/general/package/quirc-openipc/quirc-openipc.mk index 24144f34..86a3abd8 100644 --- a/general/package/quirc-openipc/quirc-openipc.mk +++ b/general/package/quirc-openipc/quirc-openipc.mk @@ -20,6 +20,8 @@ endef define QUIRC_OPENIPC_INSTALL_TARGET_CMDS $(INSTALL) -m 0755 -D $(@D)/qrscan $(TARGET_DIR)/usr/sbin + $(INSTALL) -m 755 -d $(TARGET_DIR)/usr/sbin + $(INSTALL) -m 755 -t $(TARGET_DIR)/usr/sbin $(QUIRC_OPENIPC_PKGDIR)files/qrparse endef $(eval $(generic-package)) diff --git a/general/package/wireless-configuration/files/script/adapter b/general/package/wireless-configuration/files/script/adapter index 6bf546aa..b3b0a4de 100755 --- a/general/package/wireless-configuration/files/script/adapter +++ b/general/package/wireless-configuration/files/script/adapter @@ -15,3 +15,9 @@ if [ "$CONFIG" = "hi3516ev300_ultimate_defconfig" ]; then echo 7 > /sys/class/gpio/unexport modprobe mt7601usta fi + +# Ingenic T21 +if [ "$CONFIG" = "t21_lite_defconfig" ]; then + gpio clear 50 + modprobe 8188fu +fi