Files
quectel-rgmii-toolkit/simpleadmin/www/cgi-bin/get_atcommand
iamromulan 7d5d9fe74f Major Toolkit Update: socat and TTYd
-Both SMD11 and SMD7 are now used to create 2 separate AT command flows/streams
   -SMD11 is linked to ttyOUT
   -SMD7 is linked to ttyOUT2
-ttyOUT is intended for use with automated AT commands like the modem status parse script
-ttyOUT2 is intended for user initiated AT commands like the AT Commands page in simpleadmin or the new atcmd shell command

-Entware installation has been improved for better compatibility and smoother install.

-Added the option to try out TTYd
   -This is a web based shell console you can access via http on port 443
   -More improvements to come
2024-03-17 00:10:18 -04:00

30 lines
722 B
Bash

#!/bin/bash
QUERY_STRING=$(echo "${QUERY_STRING}" | sed 's/;//g')
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
if [ "${QUERY_STRING}" ]; then
export IFS="&"
for cmd in ${QUERY_STRING}; do
if [ "$(echo $cmd | grep '=')" ]; then
key=$(echo $cmd | awk -F '=' '{print $1}')
value=$(echo $cmd | awk -F '=' '{print $2}')
eval $key=$value
fi
done
fi
MYATCMD=$(printf '%b\n' "${atcmd//%/\\x}")
if [ -n "${MYATCMD}" ]; then
x=$(urldecode "$atcmd")
runcmd=$(echo -en "$x\r\n" | microcom -t 2000 /dev/ttyOUT2)
fi
echo "Content-type: text/plain"
echo $x
echo ""
echo $runcmd