This is something i consider a bug :
Pupdial owerwrites its /etc/wvdial.conf configuration file everytime, so
the suggestions written into it, to comment out lines
[Dialer wireless]
#To force only 2G or 3G, uncomment the Init4 line and append 0 (2G) or 2 (3G), and substitute your operator's name for MYOPS.
${INIT4M}
#Init6-Init9 lines are available for user purposes; the commented examples can be used as described:
#To force the 3G quality of service level, uncomment the Init6/Init7 line pair and set value two places each, for 384k/144k/64k, omitting the \"k\" (e.g., =1,4,64,384,64,384).
#To list all the APNs stored in the modem, uncomment the Init8 line; check the Connection status log for lines beginning with +CGDCONT:.
#To list the operator identifier stored in the modem, uncomment the Init9 line; check the Connection status log for a line beginning with +COPS:.
${INIT69M}" >> /etc/wvdial.conf
do not work
I have come with a solution like this :
Code: Select all
if ["`grep '\[Dialer wireless\]' /etc/wvdial.conf`" ];then
sed -n '/\[Dialer wireless\]/,/\$/ p' /etc/wvdial.conf >/tmp/wvdialconf.tail
fi
[]
echo -n "Modem = /dev/${DEVM}
[]
Init1 = AT+CPIN=${ENTRYWPINM}
" >>/etc/wvdial.conf
if [ -f /tmp/wvdialconf.tail ];then
echo >> /etc/wvdial.conf
cat /tmp/wvdialconf.tail >> /etc/wvdial.conf
echo >> /etc/wvdial.conf
else
echo "
[Dialer wireless]
#To force only 2G or 3G, uncomment the Init4 line and append 0 (2G) or 2 (3G), and substitute your operator's name for MYOPS.
${INIT4M}
#Init6-Init9 lines are available for user purposes; the commented examples can be used as described:
#To force the 3G quality of service level, uncomment the Init6/Init7 line pair and set value two places each, for 384k/144k/64k, omitting the \"k\" (e.g., =1,4,64,384,64,384).
#To list all the APNs stored in the modem, uncomment the Init8 line; check the Connection status log for lines beginning with +CGDCONT:.
#To list the operator identifier stored in the modem, uncomment the Init9 line; check the Connection status log for a line beginning with +COPS:.
${INIT69M}
" >> /etc/wvdial.conf
fi
Note : i am typing manually from looking at my eee, so typsos possible.
Note : [] stands for "here part of original code" .
Pupdial has some other crazy confusions in regards to
Init1 =
Init2 = ATZ
#v413 If first Init1 not null, move contents to Init2, and Init2 to Init3, to reserve Init1 for wireless PIN.
[ "$INIT1M" != "" ] && INIT3M="$INIT2M" && INIT2M="$INIT1M" && INIT1M="" #v413
in combination with
/usr/sbin/modemtest
I'll show how my head of /etc/wvdial should look like :
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","web.vodafone.de","",0,0
ATZ is neccessary for being able to connect , even if the modem has received the correct PIN and is unlocked; otherwise the code would need something like this :
if [ ! "`grep '^Init1 =' |grep ATZ`" ];then
modem-stats -c ATZ /dev/$DEVM;sleep 2
fi
wvdial ${WVISP} ${WVPIN} ${WVAPN} ${WVWRLS}