I have a Raspberry Pi with a 3G Dongle connected. I want to automatically switch in modem mode + load the ppp interface during the boot.
I use usb_modeswitch
to automatically switch in modem mode during the boot and it works.
And wvdial is well managed if it launches like it after the boot: sudo wvdial ppp0
. I can ping the world! (OK just IPs and domains)
The issue is the interfaces network are loaded before the modem switch in boot process... As you can see in the syslog
file (check dates and hours):
Feb 11 19:18:07 raspberrypi logger: /etc/ppp/wait-dialup-hardware: ERROR timeout waiting for required device /dev/gsmmodem
Feb 11 19:18:09 raspberrypi logger: usb_modeswitch: switched to 05c6:6000 on 001/005
I have tried this solution to force to wait the dialup hardware. Waiting the /dev/gsmmodem is mounted but it doesn't work.
My /etc/network/interfaces
file:
auto ppp0
iface ppp0 inet wvdial
provider ppp0
pre-up echo "3G dongle starting..."
pre-up /etc/ppp/wait-dialup-hardware gsmmodem 30
post-up echo "3G (ppp0) is online"
My /etc/ppp/wait-dialup-hardware
file:
#!/bin/sh
INTERFACE="/dev/$1"
MAX_SECONDS_TIMEOUT=$2
dsec=$(( MAX_SECONDS_TIMEOUT * 10 ))
retry=0
while [ "$retry" -le "$dsec" ]; do
if [ -c ${INTERFACE} ]; then
echo "$0: OK existing required device ${INTERFACE} (in $((retry / 10)).$((100 * (retry % 10) / 10)) seconds)"
logger "$0: OK existing required device ${INTERFACE} (in $((retry / 10)).$((100 * (retry % 10) / 10)) seconds)"
break
else
sleep 0.1
fi
retry=$(( retry + 1))
done
if [ ! -c ${INTERFACE} ]; then
echo "$0: ERROR timeout waiting for required device ${INTERFACE}"
logger "$0: ERROR timeout waiting for required device ${INTERFACE}"
exit 1
fi
How can I fix that?