Results 1 to 3 of 3

Thread: TUTORIAL: Tether your phone on Linux via USB (and Bluetooth)

  1. #1
    Join Date
    Mar 2003
    Location
    Greater Puget Sound Area
    Posts
    7,426
    Phones
    N95-3
    Blackberry 8300
    Carrier
    T-Mobile
    Feedback Score
    0

    TUTORIAL: Tether your phone on Linux via USB (and Bluetooth)

    Ok, so TheMacAce has his Mac tutorial, xtremein motion has the PC tutorial, time for one for the rest of us geeks. This tutorial will serve as a reference for tethering your phone via USB or Bluetooth (though USB is the main focus) using a *nix box of some kind (should apply generally to Unix-like systems, BSD, Solaris, etc.)

    Bluetooth
    ----------
    Pairing your phone with Linux is a whole 'nother tutorial in and of itself. Check the MAN pages on your box, or check the reference pages for whichever BT manager you are using.

    USB
    ----------
    The first thing to do is check and make sure that your *nix box is recognizing your phone via USB. To start off, with the phone unplugged from the box, open up a terminal and run:

    Code:
    dmesg
    You should get something about USB being disconnected, or alternatively no message about USB at all (check the end of the output). Now, connect your phone to a USB port, and run dmesg again. You should see an output at the end that says something about 'high speed USB device' or something similar. You should also see where the device is located... for example, mine is located at /dev/ttyACM0. Remember that .

    The Setup
    -----------
    Ok, so once you have that output above, and you know that you're phone is being recognized, you need to setup the PPP configuration. Depending upon what dialer you decide to use (KPPP, wvdial, gnome-ppp, etc), your actual tabs and whatnot may vary, but the settings are the same. I'm going to be specific to wvdial, because I've found that I like it the best, and it's really easy to use from the command line.

    First off, once the phone is plugged in, and you've made sure it's recognized using dmesg, then you want to type

    Code:
    wvdialconf
    in a terminal window. (this is assuming that you have wvdial installed, if not install it first... if you don't know how to install it, then either stop using linux, or learn how quick).

    This will basically setup a blank .conf file for you to get in and edit, located at /etc/wvdial.conf.

    Using your favorite editor, get into the .conf file for editing (I prefer vim, but nano or whatever is fine). Make sure you do it as root, so it's not read only, i.e.:

    Code:
    sudo vim /etc/wvdial.conf
    or
    Code:
    su /etc/wvdial.conf
    or whatever depending on your distro's methodology of superuser access.

    You will get a screen that is asking for the parameters to be entered. Enter your parameters, until it looks just like this:

    Code:
    [Dialer Defaults]
    Init1 = AT+CGDCONT=1,"IP","wap.voicestream.com"
    Modem Type = USB Modem
    Phone = *99#
    Password = <Your Password>
    Username = <Your Login Name>
    Modem = /dev/ttyACM0
    Baud = 460800
    This may involve deleting the second init string (init2), leave password and login blank (since T-Mo doesn't use them, fill in the modem if it's not already, with the info from that dmesg way back when that I told you to remember. Once you are done, save the .conf file and exit the editor. Remember that you may need to replace the wap.voicestream.com APN with something else (internet2, internet3) if you are on a different data plan (I'm using blackberry add-on, which uses the wap.voicestream.com backbone, but with all ports open). T-zones users will have to enter the proxy settings into Konqueror, Firefox, Opera, whatever you are using to access. If you are using a bluetooth connection, change the /dev/ttyACM0 section to whatever is appropriate for your connection (/dev/rfcomm0 or whatever).

    Connecting
    ----------
    To connect you just need to enter

    Code:
    wvdial
    Into a terminal... keep in mind that this terminal will remain open while browsing... if you close it, you disconnect (though of course you can minimize it).

    To disconnect, give a ctrl-C in the terminal, and it will disconnect cleanly.

    Automating the Process
    -----------
    Now, so that you can have this a lot easier in the future, and not have to open a terminal, make a little bash shell program and put it in your /usr path. Open up a text editor, and type the following:

    Code:
    !/bin/bash
    wvdial
    Save the file as

    Code:
    GPRS.sh
    Now, go to your desktop, and create a new Link to Application (in KDE, right click on the desktop, and go to New->Link to Application, I'm not sure in Gnome because I never use it anymore). For the command, put in:

    Code:
    wvdial
    When double clicked, the icon start your connection for you without having to go into a terminal everytime.

    Hopefully that helps. The process for KPPP and other dialers is similar, just fill in the same values in whatever the corresponding fields are. I prefer wvdial because it is rock solid, where KPPP just locks up on me constantly.

    If you have any questions, let me know!

    When you are connected, you can see the details of the connection by doing an

    Code:
    ifconfig ppp0
    Enjoy!

    -olly

    *EDIT* oh and this was posted while tethering via USB through my 6681 on EDGE (speed of around 145kbps)... my lappy is running Kubuntu Dapper 6.04, KDE 3.5.1
    Last edited by ollywompus; 05-29-2006 at 02:08 AM.

  2. #2
    Join Date
    Nov 2005
    Posts
    181
    Feedback Score
    0
    Stickied. Great stuff!

  3. #3
    Join Date
    Mar 2003
    Location
    Greater Puget Sound Area
    Posts
    7,426
    Phones
    N95-3
    Blackberry 8300
    Carrier
    T-Mobile
    Feedback Score
    0
    Lol I just realized that I created a shell script and the neglected to use it.

    And really, it's not necessary... so ignore the whole part about creating a shell script.... just create the link to application.

    Thanks for the stickify!

    -olly

Bookmarks