added APN, Model, and Sim Slot query to loop

This commit is contained in:
dr-dolomite
2024-03-16 13:33:17 +08:00
parent 899d405d70
commit 9438fe515d

View File

@@ -1,18 +1,18 @@
#!/bin/bash
# Run AT+CGMM to get the modem model
echo -en "AT+CGMM\r\n" | microcom -t 1000 /dev/ttyOUT > /tmp/modemmodel.txt
sleep 2
# Run AT+CGCONTRDP once then proceed to while loop
echo -en "AT+CGCONTRDP\r\n" | microcom -t 1000 /dev/ttyOUT > /tmp/apn.txt
sleep 2
# Run AT+QUIMSLOT? to get the current sim slot
echo -en "AT+QUIMSLOT?\r\n" | microcom -t 1000 /dev/ttyOUT > /tmp/simslot.txt
sleep 2
while true; do
# Run AT+CGMM to get the modem model
echo -en "AT+CGMM\r\n" | microcom -t 1000 /dev/ttyOUT > /tmp/modemmodel.txt
sleep 2
# Run AT+CGCONTRDP once then proceed to while loop
echo -en "AT+CGCONTRDP\r\n" | microcom -t 1000 /dev/ttyOUT > /tmp/apn.txt
sleep 2
# Run AT+QUIMSLOT? to get the current sim slot
echo -en "AT+QUIMSLOT?\r\n" | microcom -t 1000 /dev/ttyOUT > /tmp/simslot.txt
sleep 2
# Send request to modem and wait 5 seconds for data
echo -en "AT+QSPN;+CEREG=2;+CEREG?;+CEREG=0;+C5GREG=2;+C5GREG?;+C5GREG=0;+CSQ;+QENG=\"servingcell\";+QRSRP;+QCAINFO;+QNWPREFCFG=\"mode_pref\";+QTEMP\r\n" \
| microcom -t 5000 /dev/ttyOUT > /tmp/modemstatus.txt