WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Howto connect your 3g usb dongle with tcl.  (Read 26978 times)

Offline pema

  • Newbie
  • *
  • Posts: 48
Howto connect your 3g usb dongle with tcl.
« on: January 17, 2009, 05:52:54 AM »
OBS !!
Updated 20090117 time 2021CET. I wrote down wrong scripts first time, sorry.
Updated 20090117 time 2102 CET Improved scripts.

Writing a rough howto connect your tcl to internet using a 3g usb dongle.
Improvments are possible and welcome, I just wanted to get it working quickly.
Preferrably use tcl 1.x as it has usbserial support.

1. Download and install pppd and pppsetup(dont forget bash to pppsetup).
2. Run pppsetup and create the files, the pppsetup will not fit perfect for our purpose but we edit the scripts later. Put in the information required to pppsetup, use chap, no dialback.

3. Edit the file etc/ppp/pppscript to:

TIMEOUT 10
ABORT ERROR
ABORT BUSY
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
"" ATZ
OK "ATE1V1&D2&C1S0=0"
OK "ATE1"
TIMEOUT 60
"" "ATD*99#"
CONNECT

4. Edit the file etc/ppp/options :

lock
defaultroute
noipdefault
usepeerdns
modem
/dev/ttyUSB0
#460800
nocrtscts
ipxcp-accept-local
ipxcp-accept-remote
debug
passive
asyncmap 0
name "user"

5. Edit etc/ppp/options.demand:

lock
defaultroute
noipdefault
usepeerdns
modem
/dev/ttyUSB0
#460800
nocrtscts
debug
passive
asyncmap 0
name "user"
ipcp-accept-local
ipcp-accept-remote
#0.0.0.0:10.10.10.10
#demand
connect "chat -v -f /etc/ppp/pppscript"

6. leave the ip-up and ip-down scripts as is.
8. Write nameserver adresses in etc/resolv.conf like

nameserver 80.251.192.244
nameserver 80.251.192.245
(this might depend on your ISP)

9. Hook up your dongle, wait until it is recognised and command sudo ppp-go in terminal and you should be online, ppp-off for shutdown. Remember to backup your files with filetool.
In your web browser you might have to set automatic proxy in tools/preferences to get it online.
« Last Edit: January 17, 2009, 04:03:33 PM by pema »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Howto connect your 3g usb dongle with tcl.
« Reply #1 on: January 17, 2009, 06:04:25 AM »
I wonder, why only 460kbps? I thought these dongles could do up to 7Mbps when in a strong network?
The only barriers that can stop you are the ones you create yourself.

Offline pema

  • Newbie
  • *
  • Posts: 48
Re: Howto connect your 3g usb dongle with tcl.
« Reply #2 on: January 17, 2009, 12:20:53 PM »
@ curaga. yes Im struggling with that, the limitation does not seem to be in connect scripts but somewhere in linux, I have not yet been able getting same PRACTICAL modem speed in linux as in winxp, I noticed higher speeds in ubuntu 8.10 though but have not digged deep in to that, any tips or help is appreciated. Raising speed theoretical is easy, just type a higher value in connect script. Ubutnu 8.10 seems to have a new approach, they use network manager, dont know if that calls ppp. One concern is webbrowser, tried midbrowser(mozilla mobile browser) in ubutnu and that was neat, quick and different, guess it is designed for small memory hardware.

Offline pema

  • Newbie
  • *
  • Posts: 48
Re: Howto connect your 3g usb dongle with tcl.
« Reply #3 on: March 07, 2009, 11:43:15 AM »
Found out you dont really need installing pppsetup, setup following files (yes, some of the files are same as above) and you will be able connecting with command :
sudo pppd -detach connect "chat -v -s -f /etc/ppp/pppscript"

1. Make a file etc/ppp/pppscript, with this contents:

TIMEOUT 10
ABORT ERROR
ABORT BUSY
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
"" ATZ
OK "ATE1V1&D2&C1S0=0"
OK "ATE1"
TIMEOUT 60
"" "ATD*99#"
CONNECT

2. Make the file etc/ppp/options :

lock
defaultroute
noipdefault
usepeerdns
modem
/dev/ttyUSB0
#460800
nocrtscts
ipxcp-accept-local
ipxcp-accept-remote
debug
passive
asyncmap 0
name "user"

3. Next file is etc/ppp/options.demand:

lock
defaultroute
noipdefault
usepeerdns
modem
/dev/ttyUSB0
#460800
nocrtscts
debug
passive
asyncmap 0
name "user"
ipcp-accept-local
ipcp-accept-remote
#0.0.0.0:10.10.10.10
#demand
connect "chat -v -f /etc/ppp/pppscript"

4. Next file is etc/ppp/ip-up:

PATH=/usr/bin:/usr/sbin:/usr/local/bin:/sbin:/bin
export PATH

if [ -s /var/log/messages ] && ( ps xc 2>/dev/null | grep -q syslogd 2>/dev/null ); then
S=`tail -n 30 /var/log/messages 2>/dev/null | grep "CARRIER[^)]" 2>/dev/null | tr -d "^M" 2>/dev/null | cut -d: -f4 2>/dev/null`
echo -n "$S" >/dev/tty0
echo " Local: $4 -> Remote: $5 $1" >/dev/tty0
else
echo " Local: $4 -> Remote: $5 $1" >/dev/tty0
fi

5. Next file is etc/ppp/ip-down:

#!/bin/sh
#
# This script is run by pppd after the PPP connection is ended.
#
# The companion file is /etc/ppp/ip-up, it's run when the PPP
# connection is started.
#
# This file is created when you run pppsetup: Mon Jan  5 22:49:55 UTC 2009
#
# The environment is cleared before executing this script
# so the path must be reset.
#
PATH=/usr/sbin:/sbin:/usr/bin:/usr/local/bin:/bin
export PATH

# Send "ath" = hangup etc. to modem when ppp connection ends.

6. Write nameserver adresses in etc/resolv.conf like
nameserver 80.251.192.244
nameserver 80.251.192.245
(this might depend on your ISP)
7. In terminal, command:
pppd connect "chat -v -s -f /etc/ppp/pppscript"
8. Open your webbrowser and surf, you might have to set automatic proxy in your webbrowser in the edit/preferences menu.
« Last Edit: March 10, 2009, 07:37:45 AM by pema »

Offline alu

  • Sr. Member
  • ****
  • Posts: 429
Re: Howto connect your 3g usb dongle with tcl.
« Reply #4 on: March 20, 2009, 06:45:46 PM »
@pema

your scripts work for me but to one problem with an huawei e220 which can be solved that way. i need to input a password in order to login, and i did the following:

echo 'at+cpin="YOURPIN"'>/dev/ttyUSB0

afterwards, i did

pppd -detach connect "chat -v -s -f /etc/ppp/ppscript"

and it runs well.

Offline Onyarian

  • Sr. Member
  • ****
  • Posts: 337
Re: Howto connect your 3g usb dongle with tcl.
« Reply #5 on: March 21, 2009, 05:49:27 AM »
It works for me too.

With minor changes, lake /dev/ttyACM0 and the login and password for the connection, works with my 3g mobil-phone.

I made a menu entry for the connection:

acm-movil:
Quote
<JWM>
<Program label="acm-movil">aterm -e sudo pppd -detach connect "chat -v -s -f /etc/ppp/pppscript"</Program>
</JWM>

in this way with one click it makes the connection.

Offline mchiareli

  • Newbie
  • *
  • Posts: 4
Re: Howto connect your 3g usb dongle with tcl.
« Reply #6 on: June 17, 2009, 09:00:09 PM »
I trying to use my usb modem with the TCL 2.x, but the modem is not recognized, the dev/ttyUSB0 is not created, does somebody have idea?

I installed the module usb-to-serial and ppp.

Offline stupida

  • Newbie
  • *
  • Posts: 19
Re: Howto connect your 3g usb dongle with tcl.
« Reply #7 on: August 10, 2009, 02:02:46 PM »

hey love your topic, im new here so i really need help!!!!!!!!! ;D

Processor = P3
Memory = 64mb
i use TC 1.4.3

so after i get pppd.tce and load it what now?????????? ???

where do i edit those codes that you wrote?????????? ???


Offline pema

  • Newbie
  • *
  • Posts: 48
Re: Howto connect your 3g usb dongle with tcl.
« Reply #8 on: August 14, 2009, 09:58:08 AM »
@mchiareli: been a while since I played with TCL, try boot your system, connect your modem and command modprobe usb_serial and see if you find dev/ttyusb(could be dev/usb/ttyusb, dont remember), maybe ls usb might give you a hint. Sorry for not being more specific, it is summer and Im spending all my time in the garage with my mx-bike, linux is for cold winter time.

@stupida: usb-serial support in core kernel came somewhere in tcl ver 2.01, I recommend to start with a newer version(Im now presuming you are using a usb-serial modem at usb-port, if other ports Im lost). Regarding files/search paths, I can not be more specific, search paths are in windows style c:\etc\ppp , you make the files and edit from terminal or file-explorer, the emelfm is my favourite. Linux costs the beginner some patience since you normally starting from the windows world, patience my friend, patience.

Offline stupida

  • Newbie
  • *
  • Posts: 19
Re: Howto connect your 3g usb dongle with tcl.
« Reply #9 on: August 26, 2009, 05:53:01 AM »
hey, just wondering if we have the same 3g, because im using Huweii i160 and just wondering if the script above applies to it also.....

and this site:
http://www.review-ninja.com/2009/05/huawei-e160-and-ubuntu-e160-linux-howto.html

we have the same 3g and could i do this in Tiny Core or i should just concentrate on the script?

more power t you guys been im loving  every bit of Tiny Core heheh ;D

Offline stupida

  • Newbie
  • *
  • Posts: 19
Re: Howto connect your 3g usb dongle with tcl.
« Reply #10 on: September 08, 2009, 03:30:50 AM »
"Linux costs the beginner some patience since you normally starting from the windows world, patience my friend, patience."

true to that man!!!!

hello to all again

i really need a newbie help!!!!!!!!!!

   I really dont know which is which, if my script is wrong (but maybe its not cuz I followed the script above to the dot) or just maybe I cant detect my usb-3g.... I really cant tell.... First off, my usb is a Huawei E160,also im using Tiny Core 2.2 and my extensions are

mc.tce
mc-locale.tce
glib1.tcel
pppd.tcel
bash.tce
expat2.tcel
glib2.tcel
graphics-libs-1.tcel
libxml2.tcel
fontconfig.tcel
gtk2.tcel
atk.tcel
cairo.tcel
pango.tcel
pixman.tcel
libasound.tcel
dbus.tcel
dbus_glib.tcel
curl.tcel
openssl-0.9.8h.tcel
firefox.tce
openssl-0.9.8h-devs.tcz
openssl-0.9.8h.tczl
gcc.tczl
(just maybe im missing an important extensions)


   1-> how would I know if It has detected my 3g-usb? Tried the
      $modprobe usb_serial but it gives out an FATAL: Module usb_serial not found.
   (dont also know if my command is right)

   2-> when I run $sudo pppd -detach connect “chat -v -s -f /etc/ppp/pppscript” I really feel its connecting, im also not sure if it does hehehe ;D...... heres what it does=

tc@box:~$ sudo pppd -detach connect "chat -v -s -f /etc/ppp/pppscript"
timeout set to 10 seconds
abort on (ERROR)
abort on (BUSY)
abort on (NO CARRIER)
abort on (NO DIALTONE)
send (ATZ^M)
expect (OK)
TZ^M^M
OK
 -- got it

send (ATE1V1&D2&C1S0=0^M)
expect (OK)
^M
ATE1V1&D2&C1S0=0^M^M
OK
 -- got it

send (ATE1^M)
timeout set to 60 seconds
send (ATD*99#^M)
expect (CONNECT)
^M
ATE1^M^M
OK^M
ATD*99#^M^M
CONNECT
 -- got it

Serial connection established.
using channel 3
Using interface ppp0
Connect: ppp0 <--> /dev/ttyUSB0
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xb04627bc> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x8 <asyncmap 0x0> <auth chap MD5> <magic 0xe89fa5> <pcomp>                                                                                      <accomp>]
No auth is possible
sent [LCP ConfRej id=0x8 <auth chap MD5>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xb04627bc> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x9 <asyncmap 0x0> <magic 0xe89fa5> <pcomp> <accomp>]
sent [LCP ConfAck id=0x9 <asyncmap 0x0> <magic 0xe89fa5> <pcomp> <accomp>]
sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15>]
sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> <                                                                                     ms-dns3 0.0.0.0>]
rcvd [LCP DiscReq id=0xa magic=0xe89fa5]
rcvd [LCP ProtRej id=0xb 80 fd 01 01 00 0c 1a 04 78 00 18 04 78 00]
Protocol-Reject for 'Compression Control Protocol' (0x80fd) received
rcvd [IPCP ConfNak id=0x1 <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14> <ms-wins 1                                                                                     0.11.12.13> <ms-wins 10.11.12.14>]
sent [IPCP ConfReq id=0x2 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 10.11.12.1                                                                                     3> <ms-dns3 10.11.12.14>]
rcvd [IPCP ConfReq id=0x4]
sent [IPCP ConfNak id=0x4 <addr 0.0.0.0>]
rcvd [IPCP ConfRej id=0x2 <compress VJ 0f 01>]
sent [IPCP ConfReq id=0x3 <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14>]
rcvd [IPCP ConfReq id=0x5]
sent [IPCP ConfAck id=0x5]
rcvd [IPCP ConfNak id=0x3 <addr 10.154.55.212> <ms-dns1 202.138.128.54> <ms-dns3 202.138.128.50>]
sent [IPCP ConfReq id=0x4 <addr 10.154.55.212> <ms-dns1 202.138.128.54> <ms-dns3 202.138.128.50>]
rcvd [IPCP ConfAck id=0x4 <addr 10.154.55.212> <ms-dns1 202.138.128.54> <ms-dns3 202.138.128.50>]
Could not determine remote IP address: defaulting to 10.64.64.64
local  IP address 10.154.55.212
remote IP address 10.64.64.64
primary   DNS address 202.138.128.54
secondary DNS address 202.138.128.50
Script /etc/ppp/ip-up started (pid 4720)
Script /etc/ppp/ip-up finished (pid 4720), status = 0xff

I press control+c (to end session)

Terminating on signal 2
Connect time 1.1 minutes.
Sent 0 bytes, received 0 bytes.
Script /etc/ppp/ip-down started (pid 4724)
sent [LCP TermReq id=0x2 "User request"]
Script /etc/ppp/ip-down finished (pid 4724), status = 0x0
rcvd [LCP TermAck id=0x2]
Connection terminated.
tc@box:~$

and thats it, this is what it always does.....hope you could help me :D
More power to all you guys, im really enjoying this!!!!!!!!!!!!!!!!!!!!!!!

Offline stupida

  • Newbie
  • *
  • Posts: 19
Re: Howto connect your 3g usb dongle with tcl.
« Reply #11 on: September 09, 2009, 10:57:05 AM »
Just forget what I wrote above............

cuz Fuc$%^g shit I finally got it!!!!!!!!!!!!!!!

   yaaaaaaaaaaattttttttttttttttttttaaaaaaaaaahhhhhhhhhhhhhhhhhhh!!!!!!!!!!!!!!!!!!!
I did what you wrote above!!!!!!!!!!! now everything is sssssssoooooooo perfect!!!!!!!!

I found the error and it was only the resolv.conf I hadn't transfered it to the /etc and now its running!!!!!!!!!!

only one last question regarding the net issues,

what is the alternative for Limewire In windows here in TC?

God bless you all, now all that I need are here!!!!!!!!!!!
THANK YOU SO MUCH GUYS!!!!!!!!!!!!!!!!!!!!!!More power to you all !!!!!!!!!!!!!!!

Offline sbaguz

  • Newbie
  • *
  • Posts: 42
Re: Howto connect your 3g usb dongle with tcl.
« Reply #12 on: April 11, 2010, 11:40:53 AM »
Thank you so much pema and alu!

Starting from your suggestions I finally made my Huawei E172 usb modem working on a very old 64 Mb RAM laptop!  ;D (Now I have to find a good but light web browser, something more complete than Dillo but not so heavy as Firefox...  ??? )

Today I think I could easily say that Tiny Core is the best distro for old PCs. Only one suggestion: to put the Xfbdev package into the base distro.

I only had to erase the ABORT "NO CARRIER" and ABORT "NO DIALTONE" lines in pppscript and to add a -chap line in both options and options.demand (hoping this could help someone else... ;) ).


12/04/10: Talking about browsers, I'm going to test Midori... ;)
« Last Edit: April 12, 2010, 04:20:11 AM by sbaguz »

Offline Guy

  • Hero Member
  • *****
  • Posts: 1089
Re: Howto connect your 3g usb dongle with tcl.
« Reply #13 on: November 09, 2010, 03:02:35 PM »
You will probably find there is no need to edit

etc/ppp/options.demand

unless you use demand dialing.

Does anybody use that now?

Correct me if I am wrong.
Many people see what is. Some people see what can be, and make a difference.

Offline Guy

  • Hero Member
  • *****
  • Posts: 1089
Re: Howto connect your 3g usb dongle with tcl.
« Reply #14 on: November 09, 2010, 03:15:27 PM »
I believe pppsetup only works for modems connected to a serial port, without needing to be manually edited. I think it is an old application, written before usb modems existed.

It would probably be a good idea to make a new extension of one of the more modern applications for connecting a modem to the internet. This would make it much simpler for new users.

Another option, probably not as good, would be to edit the pppsetup script to include more options. I think both call back and demand dialing are no longer used. So they could also be removed. Correct me if I am wrong.

Any volunteers?
« Last Edit: November 09, 2010, 03:44:07 PM by Guy »
Many people see what is. Some people see what can be, and make a difference.