automatically connect to 3g


7 posts
by raspberian » Sun Sep 09, 2012 9:07 pm
playing with Debian on raspberry pi.

I have a 3g dongle modem on the system and there is a software called sakis3g to connect to internet. I want system to connect to internet automatically every time it starts. It takes about 30-40 seconds to get connected. copied sakis3g to /sbin folder. This command has to be run as root:

sakis3g connect parameters blah blah blah
I tried to put it in the /etc/rc.local and rebooted system, but no luck.

I tried to put it in the crontab as:

@reboot sakis3g connect parameters blah blah blah

but it does not connect me on every boot :(

What am I missing here?
Posts: 4
Joined: Sun Sep 09, 2012 9:00 pm
by p4trykx » Thu Oct 04, 2012 11:37 pm
Maybe try this
http://zool33.uni-graz.at/petz/umtskeeper/
apart from connecting it should keep the connection alive
Posts: 119
Joined: Wed Jan 11, 2012 2:55 pm
by p4trykx » Fri Oct 05, 2012 9:59 am
What do you mean that is does not connect on every boot? Does it connect sometimes?

I just tried putting my connect command to a file /home/pi/connect.sh
Code: Select all
sudo /home/pi/sakis3g connect --console --interactive APN=CUSTOM_APN CUSTOM_APN='darmowy' APN_USER='0' APN_PASS='0' USBINTERFACE=3 USBDRIVER=sierra USBMODEM=1199:68a3 OTHER=USBMODEM MODEM=OTHER

and then in rc.local
Code: Select all
/home/pi/connect.sh


I haven't tried it a lot of times but so far it connects.

Maybe in your case the modem isn't ready when rc.local calls connect script? Try adding some sleep before connection.
Posts: 119
Joined: Wed Jan 11, 2012 2:55 pm
by p4trykx » Mon Nov 05, 2012 10:07 pm
I made some more test to rule out other things
Code: Select all
#!/bin/bash

progDir=`dirname $0`
progName=`basename $0`
sakisProg="sudo ${progDir}/sakis3g"

sakisActors="connect"
sakisSwitches="--console"
sakisOperators="APN='CUSTOM_APN' USBINTERFACE='3' USBDRIVER='sierra' USBMODEM='1199:68a3' OTHER='USBMODEM' MODEM='OTHER' CUSTOM_APN='darmowy' APN_USER='user' APN_PASS='pass'"

echo "$sakisProg $sakisActors $sakisSwitches $sakisOperators"

$sakisProg $sakisActors $sakisSwitches $sakisOperators

output is
Code: Select all
./test
sudo ./sakis3g connect --console APN='CUSTOM_APN' USBINTERFACE='3' USBDRIVER='sierra' USBMODEM='1199:68a3' OTHER='USBMODEM' MODEM='OTHER' CUSTOM_APN='darmowy' APN_USER='user' APN_PASS='pass'
Failed to load module " sierra ".
Unable to load driver " sierra " for device "1199:68a3"
Failed to connect.


This one works
Code: Select all
#!/bin/bash

sudo ./sakis3g  connect --console APN='CUSTOM_APN' USBINTERFACE='3' USBDRIVER='sierra' USBMODEM='1199:68a3' OTHER='USBMODEM' MODEM='OTHER' CUSTOM_APN='darmowy' APN_USER='user' APN_PASS='pass'

Output
Code: Select all
pi@raspberrypi ~/3g $ ./test2
USB 307 connected to Aero2 (26001).
Posts: 119
Joined: Wed Jan 11, 2012 2:55 pm
by cillerman » Sat Mar 23, 2013 3:09 pm
To make this work, use
Code: Select all
eval $sakisProg $sakisActors $sakisSwitches $sakisOperators
This must also be modified manually in the original "umtskeeper".
Posts: 2
Joined: Sat Mar 23, 2013 2:46 pm
by p4trykx » Sat Mar 23, 2013 7:27 pm
I can't recall exactly but I think that there is some kind of bug in sakis3g it adds additional space to sierra module name. I tried to contact the author but sakis3g seems to be an abandonware
Posts: 119
Joined: Wed Jan 11, 2012 2:55 pm
by cillerman » Sun Mar 24, 2013 9:05 am
This happens when using "optional" as the driver, too.

In any case, the fix above should work.
Did/can you try it?
Posts: 2
Joined: Sat Mar 23, 2013 2:46 pm