maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   Connect 3G modem from terminal? (https://talk.maemo.org/showthread.php?t=54185)

jainoxi 2010-05-28 06:57

Connect 3G modem from terminal?
 
is there a way to connect to a predefined 3G modem APN from the commandline / terminal? I've got this desktop shortcut that creates a connection via ssh, but it doesn't automatically establishes internet connection. Also, AutoDisconnect is installed and active.

jainoxi 2010-05-28 07:53

Re: Connect 3G modem from terminal?
 
It seems that this script works:

Code:

dbus-send --type=method_call --system --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:"Vodafone GPRS" uint32:0

jainoxi 2010-05-30 13:36

Re: Connect 3G modem from terminal?
 
I've got a simple bash script that connects to 3G, waits 10 seconds (so the connection is completed) and creates a SSH connection. I now want to extend it so that the first two commands (dbus script and wait 10s) only execute if the 3G connection isn't online. Otherwise, I always need to wait 10s before my SSH session launches..

jainoxi 2010-05-31 17:38

Re: Connect 3G modem from terminal?
 
So, this script checks for a gprs0 connection, and brings the APN online and loops until done before ssh'ing:
Quote:

#/bin/bash
if
[ -d /sys/class/net/gprs0 ] && /sbin/ifconfig gprs0 | grep UP;
then
ssh irc;
else
dbus-send --type=method_call --system --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:"Vodafone GPRS" uint32:0;
for i in $(seq 0 10);
do
if
/sbin/ifconfig gprs0 | grep UP;
then
i=10;
else
sleep 1;
fi;
done;
ssh irc;
fi;


All times are GMT. The time now is 20:37.

vBulletin® Version 3.8.8