I am working on a script to fetch all possible stored data from the SIM card of my broadband usb modem .
It goes something like this :
1) create a database file with the current supported AT commands by sending ' " AT+CLAC" |tr ',' '\n' |sort -d >database.file ' .
2) read the databasefile line for line and send
"AT${line}?" to show the current setting
and
"AT${line}=?" to show the supported settings .
Sending the AT commands i came up using the /usr/sbin/modem-stats binary , which is the best tool i have found so far .
Now i have the problem to locate the source for "modem-stats" .
I can not find it on google, debian, ubuntu, bkhome.org/sources or inside woof tarball .
Could anyone point me there ?
Read SMS on SIM CARD
-
- Posts: 282
- Joined: Wed 16 Dec 2009, 21:38
- Location: Earth
Re: Read SMS on SIM CARD
I hope that is what you want.Karl Godt wrote: Could anyone point me there ?
- Attachments
-
- modem-stats-1.0.1.src.elf.tar.gz
- (49.47 KiB) Downloaded 334 times
SUUM CUIQUE.
WOW ! From 1995 !! Not found even on archive.debian.net ..
At least the second time you've helped me out Panzerkopf !
Now i've something to chew on !
The problem is i have overstepped my 5GB limit and my second provider had apparently cut me off while dl win8 preview 64bit .iso . They apparently wanted me to confirm to order some GB more at UMTS speed while looking for /usr/bin/defaultbrowser, which was of course not available ..
My first provider squeezed the speed to 8KB/s without problems, which my second provider also did in former days (did not happen many times) .
So i got me a 2,5GB win.iso.part and a 750MB win.iso and want to wget -c it .
Somehow i was not able to connect anymore with Puppy to internet and also not able in windows .
Now the month from 6th to 5th is a new month and i can connect with windows, but pgprs-connect does still not work anymore, nor pupdial .. Grrrrr ...
Installed hyperterminal from xp to vista and here not much garbage output, but also a short CONNECTED 7200000 and "NO CARRIER" ..
Posting from racy with my first provider ...
Cannot get the SMS from the card :
AT+CMGF=1
AT+CMGL='"ALL"'
[empty space here]
OK
Seems that the SMS gets directly somewhere to c:\USERS\USER\AppData\Roaming\Vodafone ...
Some people say linux has a complicated folder structure , haha ..
At least the second time you've helped me out Panzerkopf !
Now i've something to chew on !
The problem is i have overstepped my 5GB limit and my second provider had apparently cut me off while dl win8 preview 64bit .iso . They apparently wanted me to confirm to order some GB more at UMTS speed while looking for /usr/bin/defaultbrowser, which was of course not available ..
My first provider squeezed the speed to 8KB/s without problems, which my second provider also did in former days (did not happen many times) .
So i got me a 2,5GB win.iso.part and a 750MB win.iso and want to wget -c it .
Somehow i was not able to connect anymore with Puppy to internet and also not able in windows .
Now the month from 6th to 5th is a new month and i can connect with windows, but pgprs-connect does still not work anymore, nor pupdial .. Grrrrr ...
Installed hyperterminal from xp to vista and here not much garbage output, but also a short CONNECTED 7200000 and "NO CARRIER" ..
Posting from racy with my first provider ...
Cannot get the SMS from the card :
AT+CMGF=1
AT+CMGL='"ALL"'
[empty space here]
OK
Seems that the SMS gets directly somewhere to c:\USERS\USER\AppData\Roaming\Vodafone ...
Some people say linux has a complicated folder structure , haha ..
Now my provider has turned up the download speed again and i can connect with pgprs-connect . Will take me some time to figure out settings to connect in isdn mode ..
So here's my get_modem_values.sh script :
It works pretty well at my 2 years old and grown 5GB+ Puppy-4.3x full installations,
while on Puppy-5.1.1 it got me a bunch of crap as answers to modem-stats -c AT$COMMAND $DEVICE
Note 1 : Every MODEM seems to have its own registers and commands, so it is probably the best to adjust to the needs, especially the "dangerous_func" .
Note 2 : googling "AT COMMANDS" gives a large amount of hits with a lot of PDFs .
Note 3 : My modem needs to be unlocked with pin=$MYPIN to answer the at+clac command to build the database .
So here's my get_modem_values.sh script :
It works pretty well at my 2 years old and grown 5GB+ Puppy-4.3x full installations,
while on Puppy-5.1.1 it got me a bunch of crap as answers to modem-stats -c AT$COMMAND $DEVICE
Code: Select all
#!/bin/bash
DEV_MODEM=/dev/ttyUSB0
CLAC_FILE=/modem-stats_AT+CLAC.sort_d.txt
VALUE_FILE=/get_modem_values.txt
Version=1.0-Puppy-4.3x
usage(){
MSG="
$0 [help|version] [force|/dev/MODEM|pin=3210]
"
if [ "$2" ];then
MSG="$MSG
$2
"
fi
echo "$MSG"
[ "$DISPLAY" ] && xmessage -bg cyan "$MSG"
exit $1
}
while [ "$1" ];do
case $1 in
help) usage 0;;
version) usage 0 "Version=$Version";;
force) rm $CLAC_FILE;shift;;
pin=*) PIN=${1##*=};modem-stats -c AT+CPIN=$PIN $DEV_MODEM;shift;;
/dev/*) DEV_MODEM=$1;shift;;
*|'') shift;;
esac;done
modem-stats ${DEV_MODEM}
if ! [ -f ${CLAC_FILE} ];then
modem-stats -c AT+CLAC ${DEV_MODEM} |tr ',' '\n' |sort -d >${CLAC_FILE}
fi
un_b_lock_function(){
PIN=3210 ##Change as needed/required to your PIN
PUK=76543210 ##Change as needed/required to your PUK
if [ "$1" = 'unlock' ];then
modem-stats -c "AT+CPIN=${PIN}" ${DEV_MODEM}
shift
fi
if [ "$1" = 'unblock' ];then
modem-stats -c AT+CPIN=${PUK},${PIN} ${DEV_MODEM}
shift
fi
}
#un_b_lock_function
[ -f ${VALUE_FILE} ] && cp --remove-destination ${VALUE_FILE} ${VALUE_FILE}.bak
date >${VALUE_FILE}
uname -a >>${VALUE_FILE}
. /etc/DISTRO_SPECS
echo "${DISTRO_NAME}*${DISTRO_VERSION}" >> ${VALUE_FILE}
modem-stats ${DEV_MODEM} >>${VALUE_FILE}
while read line;do
echo "'$line'"
[ "$line" ] || continue
line=`echo "${line}" |awk '{print $1}'`
STATUS=0
echo '#-------#' >>${VALUE_FILE}
echo "CMD=AT${line} [? & =? |'']" >>${VALUE_FILE}
echo '##CURRENT------#' >>${VALUE_FILE}
timeout -t 6 modem-stats -c "AT${line}?" ${DEV_MODEM} >>${VALUE_FILE} 2>&1
STATUS=$((STATUS+$?))
echo '##------#' >>${VALUE_FILE}
echo '###POSSIBLE-----#' >>${VALUE_FILE}
timeout -t 6 modem-stats -c "AT${line}=?" ${DEV_MODEM} >>${VALUE_FILE} 2>&1
STATUS=$((STATUS+$?))
echo '###-----#' >>${VALUE_FILE}
log_error_func(){
if [ "$STATUS" -ge 2 ];then
echo "'$line'" >>/at_commands_wo_output.txt
fi
}
log_error_func
display_func(){
if [ "$STATUS" -ge 2 ];then
if [ "`echo "$line" |grep -Ew '\+GMR|\+GSN|\+CGMI|\+CGMM|\+CGMR|\+CGSN|\+CERR|&V|I|\+GCAP|\+GMI|\+GMM'`" ];then
echo '####INFO --#' >>${VALUE_FILE}
timeout -t 6 modem-stats -c "AT${line}" ${DEV_MODEM} >>${VALUE_FILE} 2>&1
echo '####INFO --#' >>${VALUE_FILE}
fi
fi
}
display_func
own_possibles_func(){
if [ "$STATUS" -ge 2 ];then
if [ "`echo "$line" |grep -Ew '\^SYSINFO|\+CLAC'`" ];then
echo '####SYS ---#' >>${VALUE_FILE}
timeout -t 6 modem-stats -c "AT${line}" ${DEV_MODEM} >>${VALUE_FILE} 2>&1
echo '####SYS ---#' >>${VALUE_FILE}
fi
fi
}
own_possibles_func
sms_func(){
if [ "$STATUS" -ge 2 ];then
if [ "`echo "$line" |grep -w '\+CMGL'`" ];then
echo '####SMS ---#' >>${VALUE_FILE}
timeout -t 6 modem-stats -c "AT${line}=\"ALL\"" ${DEV_MODEM} >>${VALUE_FILE} 2>&1
echo '####SMS ---#' >>${VALUE_FILE}
fi
fi
}
sms_func
dangerous_func(){ #enable it if you know what your doing
if [ "$STATUS" -ge 2 ];then ##coreutils timeout returns 124 when timeout occurs;still have to check busybox for this
echo '####SIMPLE----#' >>${VALUE_FILE}
if [ "${line} " != '&F' ];then #warn:loads factory profile
if [ ! "`echo "$line" |grep -Ew '\+CSAS|\+CRES|A|D|;|H1|L0|M0|M1|M2|M3|\\G|\\G0|\\G1|&K|&K0|&K3|&K4|&K5|&K6|S'`" ];then #TODO:make list more proof, or: grep only proofed commands
timeout -t 6 modem-stats -c "AT${line}" ${DEV_MODEM} >>${VALUE_FILE} 2>&1
else
echo '####OMITTED----#'
fi
else
echo '####NOT SETTING FACTORY DEFAULT----#'
fi
echo '####----#' >>${VALUE_FILE}
fi
}
#dangerous_func #enable it if you know what your doing
echo "CMD=AT${line} [? & =? |'']" >>${VALUE_FILE}
echo '#-------#' >>${VALUE_FILE}
done << EOF
$(cat ${CLAC_FILE})
EOF
mkdir -p /etc/ppp/modem_info.d
cp -ai $CLAC_FILE /etc/ppp/modem_info.d/
cp -ai $VALUE_FILE /etc/ppp/modem_info.d/
exit 0
Note 2 : googling "AT COMMANDS" gives a large amount of hits with a lot of PDFs .
Note 3 : My modem needs to be unlocked with pin=$MYPIN to answer the at+clac command to build the database .
-
- Posts: 282
- Joined: Wed 16 Dec 2009, 21:38
- Location: Earth
Hi Karl !Karl Godt wrote: Note 1 : Every MODEM seems to have its own registers and commands, so it is probably the best to adjust to the needs, especially the "dangerous_func" .
As far as I know, every modem has Hayes compatibile commands and as option - some extended commands.
Also, some modems have own additional vendor specific commands.
This should be described in these standards: TIA/EIA-602, V.250 and GSM07.07
SUUM CUIQUE.