Skip to content

Instantly share code, notes, and snippets.

@b-alidra
Last active July 1, 2019 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b-alidra/98054a543114f564763c83443c76a26a to your computer and use it in GitHub Desktop.
Save b-alidra/98054a543114f564763c83443c76a26a to your computer and use it in GitHub Desktop.
Send AT commands using atinout to Huawei E3531 modem after Kannel service has started
#/bin/sh
SERVICE=kannel
ATINOUT_BIN=/usr/bin/atinout
TTY=/dev/gsmmodem
while ! sudo systemctl is-active --quiet $SERVICE; do
echo "waiting the $SERVICE service to start"
sleep 10
done;
echo "$SERVICE service started"
echo "Wait 30 more seconds for initialization"
sleep 30;
# Select Message Service
echo "Setting CSMS..."
echo "AT+CSMS=1" | $ATINOUT_BIN - $TTY -
echo ""
echo "Checking CSMS..."
echo "AT+CSMS?" | $ATINOUT_BIN - $TTY -
echo ""
# Indicate new messages to TE
echo "Setting CNMI..."
echo "AT+CNMI=1,2,0,1,0" | $ATINOUT_BIN - $TTY -
echo ""
echo "Checking CNMI..."
echo "AT+CNMI?" | $ATINOUT_BIN - $TTY -
echo ""
# Report Mobile Termination Error
echo "Setting CMEE..."
echo "AT+CMEE=1" | $ATINOUT_BIN - $TTY -
echo ""
echo "Checking CMEE..."
echo "AT+CMEE?" | $ATINOUT_BIN - $TTY -
echo ""
/home/pi/init_e3531.sh > /home/pi/e3531_init.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment