Nokia 6310i and Bluetooth with Linux using T-Mobile

Here is how I got my Nokia 6310i phone to work with Bluetooth and the T-Mobile Internet GPRS using a Belkin F8T001 USB adaptor. The same configuration also worked with a D-Link DWB-120M Bluetooth USB adpator. Your mileage may vary.

I chose the 6310i handset because it has tri-band GSM, Bluetooth, good sound quality and the standard Nokia menus that I've been using for years. It does not come in wild colors or have a camera which I don't care for anyways. I read a lot of reviews online before buying the phone, which all rated this phone very highly. I chose the Belkin F8T001 because of its extended range (100m), though this does not seem to work well through walls.

Before you go through the trouble of setting all this stuff up, you need to know what to expect from GPRS in advance so that you won't be disappointed. Do not expect to get near the 56Kbps speed that is advertised - this is a theoretical maximum and it is unlikely that you'll ever get that much throughput as it depends on network conditions and the type of phone you are using. Distract yourself from thinking about how slow the service is by marveling about how cool you look and feel while using a wireless Internet connection over a wireless Bluetooth connection.

The throughput you'll get is similar to that of a noisy 28.8Kbps dialup connection, but with much higher latency. Ping times average around 700ms to 800ms. The best throughput that I have seen is just under 4KBps, which I measured using FTP over a 1/2 hour time period. In reality using a web browser to look at web pages will yield much less throughput. What the service is useful for though is checking mail when you are traveling and are not near any other form of Internet access, say if you were stuck in an airport that did not have a T-Mobile HotSpot.

I have also found GPRS on T-Mobile's network to be extremely unreliable. Quite often my phone is not able to initiate a GPRS connection, or takes a long time to fetch web pages with WAP and just sits there. This is in addition to the high latency mentioned above.

Basically, you have to do these steps to enable Internet access over your phone:

  1. Configure your handset (once)
  2. Configure USB and Bluetooth support for Linux (once)
  3. Insert the Bluetooth USB adaptor and load the firmware (every time)
  4. Make a Bluetooth connection between your computer and the phone (every time)
  5. Configure PPP (once)
  6. Start PPP (every time)
My Nokia firmware version is "V 5.50 03-03-03". There are some reports of problems with Bluetooth under older firmware versions. You can find out the firmware version of your handset by dialing "*#0000#".


In my area, T-Mobile does not offer this particular Nokia phone so you need to configure your handset to work with T-Mobile if you did not get the phone from T-Mobile. Skip this section if your phone works already with T-Mobile, or you are not using T-Mobile.

T-Mobile offers two GRPS options in the United States from what I understand:

  • T-Mobile Internet

    T-Mobile Internet service enables devices, such as a PDA or laptop, to use the phone's GPRS capabilities. You need to enable this on your T-Mobile account first. Note: this is not the T-Mobile HotSpot service, which is 802.11b wireless access.

    Setup your phone as instructed at T-Mobile's web site under "Help > Services > T-Mobile Internet" (currently here). I followed their instructions and here is what I set.

    Go to "Menu->Settings->GPRS modem settings->Edit active access point" on your phone and set the following options:
    Alias for access point: T-Mobile GPRS
    GPRS access point: internet2.voicestream.com

    You can setup other access points in case you need to change them on the fly but I have not found a need to do so with T-Mobile.

    Note: In firmware version "V 5.51 08-07-03", this menu option has changed to "Menu->Services->Settings->Edit active service settings".

  • t-zones

    t-zones is GPRS for your phone only, which enables you to get content to your phone but does not let other devices use your phone's GPRS as far as I can tell. t-zones came free with my T-Mobile Internet service but I haven't found it that useful so far, mainly because it is so slow. But you should spend some time playing around with it.

    Setup your phone as instructed at T-Mobile's web site under "Help > Services > t-zones" (currently here). I followed their instructions and here is what I set.

    Go to "Menu->Services->Settings->Edit active service settings" on your phone and set the following options:
    Settings' name: T-Mobile
    Home page: http://wap.myvoicestream.com
    Session mode: Temporary
    Connection security: Off
    Data bearer: GPRS
    GPRS connection: When needed
    GPRS access point: wap.voicestream.com
    IP address: 216.155.165.050
    Authentication type: Normal
    Login type: Automatic
    User name: (none)
    Password: (none)

    Once you get back to "Menu->Services", select "Home" and off you go. You can setup multiple service profiles in case you need to change them on the fly but I have not found a need to do so with T-Mobile.


Once you have the phone setup, you need to get Bluetooth working under Linux. There is a lot of help at Bluez. You need to get and install the following software:

  • Linux 2.4.21 kernel (with USB and Bluetooth support enabled)
  • bluez-libs
  • bluez-utils
  • bluez-bluefw (firmware for the Broadcom chip in the Belkin F8T001 USB adaptor)
Follow the installation instructions that come with each package. If you want you can install the other Bluez packages that are available but I did not in order to get my phone working as I describe here.

When Linux sees the Bluetooth adaptor when you insert it, then USB and Bluetooth support is working. Then you'll need to do the following steps in order to get Linux to talk to the phone each time you want to use GPRS. There is probably a way to automate this process. Make sure you are root.

  • Insert the Bluetooth adaptor into a USB port. Skip to the next section if you are not using a USB adaptor with a Broadcom chip.

    Check which USB device number it was assigned. In the output below, it is 006.

    doom# ls /proc/bus/usb/001/
    total 1
       0 ./     0 ../     1 001     0 006
    
    On my laptop it always appears as a device under /proc/bus/usb/001, which is USB bus number 001. You'll probably see lots of messages from hotplug stating that the device is not supported. Don't worry about them, the messages appear because hotplug doesn't have any configurations for this particular adaptor. Like I said, this could probably be automated.

    Load the firmware to the adaptor by specifying the bus and device number. On my laptop the device number changes every time I insert it.

    doom# bluefw usb 001/006
    bluefw[8272]: Loading firmware to usb device 0a5c:2033
    bluefw[8272]: FW loaded
    
  • Fire up the HCI daemon. I've found that you need to do this fairly quickly because hotplug disables the adaptor after a few seconds unless hcid is running.
    doom# hcid
    
    There are lots of options for hcid. Here is what I used in /etc/bluetooth/hcid.conf. Use killall -HUP hcid if you change options to reload it.
    #
    # HCI daemon configuration file.
    #
    
    # HCId options
    options {
            # Automatically initialize new devices
            autoinit yes;
    
            # Security Manager mode
            #   none - Security manager disabled
            #   auto - Use local PIN for incoming connections
            #   user - Always ask user for a PIN
            #
            security auto;
    
            # Pairing mode
            #   none  - Pairing disabled
            #   multi - Allow pairing with already paired devices
            #   once  - Pair once and deny successive attempts
            pairing multi;
    
            # PIN helper
            #pin_helper /bin/bluepin;
            pin_helper /usr/local/bin/bluez_pin_simple;
    }
    
    # Default settings for HCI devices
    device {
            # Local device name
            #   %d - device id
            #   %h - host name
            name "doom";
    
            # Local device class
            class 0x100;
    
            # Default packet type
            #pkt_type DH1,DM1,HV1;
    
            # Inquiry and Page scan
            iscan enable; pscan enable;
    
            # Default link mode
            #   none   - no specific policy 
            #   accept - always accept incoming connections
            #   master - become master on incoming connections,
            #            deny role switch on outgoing connections
            #
            lm accept,master;
            #
            #lm accept;
    
            # Default link policy
            #   none    - no specific policy
            #   rswitch - allow role switch
            #   hold    - allow hold mode
            #   sniff   - allow sniff mode
            #   park    - allow park mode
            #
            #lp hold,sniff;
            #
            lp hold,sniff,park;
    
            # Authentication and Encryption
            #auth enable;
            #encrypt enable;
    }
    
    At this point, the hci0 interface should be up. Check it using this command.
    doom% hciconfig -a
    hci0:   Type: USB 
            BD Address: 00:03:C9:2E:5D:2A ACL MTU: 377:10  SCO MTU: 16:0
            UP RUNNING PSCAN ISCAN 
            RX bytes:5791 acl:55 sco:0 events:213 errors:0
            TX bytes:4160 acl:44 sco:0 commands:129 errors:0
            Features: 0xff 0xfd 0x05 0x00
            Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
            Link policy: HOLD SNIFF PARK 
            Link mode: ACCEPT MASTER 
            Name: 'doom'
            Class: 0x000100
            Service Classes: Unspecified
            Device Class: Computer, Uncategorized
            HCI Ver: 1.1 (0x1) HCI Rev: 0x2 LMP Ver: 1.1 (0x1) LMP Subver: 0xf07
            Manufacturer: Broadcom Corporation (15)
    
  • Next, turn on Bluetooth on your phone. Then, see if Linux sees it on your Bluetooth network. For the BD address in the next commands, insert the one that is returned for your phone. Each Bluetooth device will have a different BD address.
    doom# hcitool scan
    Scanning ...
            00:02:EE:6E:14:C7       Nokia 6310i
    doom# hcitool info 00:02:EE:6E:14:C7
    Requesting information ...
            BD Address:  00:02:EE:6E:14:C7
            Device Name: Nokia 6310i
            LMP Version: 1.1 (0x1) LMP Subversion: 0x23b
            Manufacturer: Nokia Mobile Phones (1)
            Features: 0xbf 0x28 0x21 0x00
                    <3-slot packets> <5-slot packets> <encryption> <slot offset> 
                    <timing accuracy> <role switch> <sniff mode> <SCO link> 
                    <HV3 packets> <CVSD> 
    
    If you like, ping the phone some.
    doom# l2ping 00:02:EE:6E:14:C7
    Ping: 00:02:EE:6E:14:C7 from 00:03:C9:2E:5D:2A (data size 20) ...
    0 bytes from 00:02:EE:6E:14:C7 id 200 time 17.83ms
    0 bytes from 00:02:EE:6E:14:C7 id 201 time 19.02ms
    0 bytes from 00:02:EE:6E:14:C7 id 202 time 17.83ms
    0 bytes from 00:02:EE:6E:14:C7 id 203 time 17.64ms
    0 bytes from 00:02:EE:6E:14:C7 id 204 time 23.47ms
    0 bytes from 00:02:EE:6E:14:C7 id 205 time 15.25ms
    0 bytes from 00:02:EE:6E:14:C7 id 206 time 20.08ms
    0 bytes from 00:02:EE:6E:14:C7 id 207 time 17.90ms
    8 sent, 8 received, 0% loss
    

Once Linux sees the handset, you can continue to this next step.

  • Now, you need to use rfcomm to connect Linux to the phone. If you don't have a /dev/rfcomm0, create it using this command first.
    doom# mknod -mode 666 /dev/rfcomm0 c 216 0
    
    Before you connect to the phone, you need to choose a five digit PIN. The program to enter the PIN runs under X Windows and is called /bin/bluepin and will pop up automatically when you make a Bluetooth connection. If you would like to supply a static PIN without entering it every time, set your PIN to something other than 12345 in the following script that goes in /usr/local/bin/bluez_pin_simple.
    #!/bin/sh
    echo "PIN:12345"
    
    Also, set pin_helper /usr/local/bin/bluez_pin_simple; in /etc/bluetooth/hcid.conf. Don't forget to chmod +x /usr/local/bin/bluez_pin_simple. Once you have chosen a PIN, then you run this command to set up an RFCOMM connection to the phone.
    doom# rfcomm connect rfcomm0 00:02:EE:6E:14:C7
    Connected /dev/rfcomm0 to 00:02:EE:6E:14:C7 on channel 1
    Press CTRL-C for hangup
    
    On your phone, you will be asked to accept the connection and then will be prompted for the PIN the first time you establish a pairing between your computer and the phone. At this point, the connection should be established successfully.
    doom# hcitool con
    Connections:
            < ACL 00:02:EE:6E:14:C7 handle 6 state 1 lm MASTER ENCRYPT
    
    The following log messages will appear if you have syslog enabled.
    Aug 17 23:22:29 doom hcid[18883]: pin_code_request (sba=2A:5D:2E:C9:03:00, dba=C7:14:6E:EE:02:00) 
    Aug 17 23:22:30 doom hcid[18883]: link_key_notify (sba=2A:5D:2E:C9:03:00)
    Aug 17 23:22:30 doom hcid[18883]: Replacing link key 00:03:C9:2E:5D:2A 00:02:EE:6E:14:C7
    
  • When the RFCOMM connection is made over Bluetooth, you can then run PPP over the connection for wireless Internet access. But you need to configure PPP first.

    Put this into /etc/ppp/peers/gprs:

    debug
    noauth
    usepeerdns
    /dev/rfcomm0 115200
    115200
    local
    nocrtscts
    defaultroute
    noipdefault
    connect '/usr/sbin/chat -f /etc/ppp/chat -r /dev/console'
    
    This goes into /etc/ppp/chat-gprs:
    TIMEOUT         5
    ECHO            ON
    ABORT           '\nBUSY\r'
    ABORT           '\nERROR\r'
    ABORT           '\nNO ANSWER\r'
    ABORT           '\nNO CARRIER\r'
    ABORT           '\nNO DIALTONE\r'
    ABORT           '\nRINGING\r\n\r\nRINGING\r'
    # send the init string
    ''              \rAT
    TIMEOUT         12
    # dial the access number
    OK              ATD*98*2#
    CONNECT         ""
    
    Note: You may also want to add \rAT+cgdcont=1,,"internet2.voicestream.com" as the init string (recommended by T-Mobile).

    Note: The access number may be region dependent, check with T-Mobile for the correct access number in your region.

    To enable PPP to automatically get the DNS server information and put it into your /etc/resolv.conf, create these scripts and chmod +x to them.

    In /etc/ppp/ip-up.local:

    #!/bin/bash
    
    export PATH=/sbin:/usr/sbin:/bin:/usr/bin
    
    if [ -f /etc/ppp/resolv.conf ]; then
       mv /etc/resolv.conf /etc/resolv.conf-saved-by-pppd
       mv /etc/ppp/resolv.conf /etc/resolv.conf
    fi
    
    exit 0
    
    In /etc/ppp/ip-down.local:
    #!/bin/bash
    
    export PATH=/sbin:/usr/sbin:/bin:/usr/bin
    
    if [ -f /etc/resolv.conf-saved-by-pppd ]; then
       mv /etc/resolv.conf-saved-by-pppd /etc/resolv.conf
    fi
    
    exit 0
    
    Presently the nameservers returned are 216.155.175.105 and 216.155.175.106. You'll need to use these nameservers because HTTP connections on port 80 are redirected to a proxy server that compresses content called getmorespeed.tmobile.com which is only resolvable through the supplied DNS servers. You can read about the proxy on T-Mobile's Internet Accelerator help page, but you should experiment with disabling the proxy to see if that works better for you.

  • Finally, all you have to do is to start PPP.
    doom# pppd call gprs
    
    If you have syslog enabled you'll see something similar to these messages.
    Aug 17 23:27:21 doom pppd[19154]: pppd 2.4.1 started by root, uid 0
    Aug 17 23:27:23 doom pppd[19154]: Serial connection established.
    Aug 17 23:27:23 doom pppd[19154]: using channel 14
    Aug 17 23:27:23 doom pppd[19154]: Using interface ppp0
    Aug 17 23:27:23 doom pppd[19154]: Connect: ppp0 < /dev/rfcomm0
    Aug 17 23:27:23 doom /etc/hotplug/net.agent: assuming ppp0 is already up
    Aug 17 23:27:24 doom pppd[19154]: sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x48b51929> <pcomp> <accomp>]
    Aug 17 23:27:24 doom pppd[19154]: rcvd [LCP ConfRej id=0x1 <magic 0x48b51929> <pcomp> <accomp>]
    Aug 17 23:27:24 doom pppd[19154]: sent [LCP ConfReq id=0x2 <asyncmap 0x0>]
    Aug 17 23:27:24 doom pppd[19154]: rcvd [LCP ConfAck id=0x2 <asyncmap 0x0>]
    Aug 17 23:27:26 doom pppd[19154]: rcvd [LCP ConfReq id=0x0 <auth pap> <mru 1500> <asyncmap 0xa0000>]
    Aug 17 23:27:26 doom pppd[19154]: sent [LCP ConfRej id=0x0 <auth pap>]
    Aug 17 23:27:26 doom pppd[19154]: rcvd [LCP ConfReq id=0x1 <mru 1500> <asyncmap 0xa0000>]
    Aug 17 23:27:26 doom pppd[19154]: sent [LCP ConfAck id=0x1 <mru 1500> <asyncmap 0xa0000>]
    Aug 17 23:27:26 doom pppd[19154]: sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <compress VJ 0f 01> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
    Aug 17 23:27:26 doom pppd[19154]: sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
    Aug 17 23:27:26 doom pppd[19154]: rcvd [IPCP ConfReq id=0x0 <addr 10.6.6.6>]
    Aug 17 23:27:26 doom pppd[19154]: sent [IPCP ConfAck id=0x0 <addr 10.6.6.6>]
    Aug 17 23:27:26 doom pppd[19154]: rcvd [LCP ProtRej id=0x0 80 fd 01 01 00 0f 1a 04 78 00 18 04 78 00 15 03 2f]
    Aug 17 23:27:28 doom pppd[19154]: rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01>]
    Aug 17 23:27:28 doom pppd[19154]: sent [IPCP ConfReq id=0x2 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
    Aug 17 23:27:28 doom pppd[19154]: rcvd [IPCP ConfNak id=0x2 <addr 10.145.29.223> <ms-dns1 216.155.175.105> <ms-dns3 216.155.175.106>]
    Aug 17 23:27:28 doom pppd[19154]: sent [IPCP ConfReq id=0x3 <addr 10.145.29.223> <ms-dns1 216.155.175.105> <ms-dns3 216.155.175.106>]
    Aug 17 23:27:28 doom pppd[19154]: rcvd [IPCP ConfAck id=0x3 <addr 10.145.29.223> <ms-dns1 216.155.175.105> <ms-dns3 216.155.175.106>]
    Aug 17 23:27:28 doom pppd[19154]: local  IP address 10.145.29.223
    Aug 17 23:27:28 doom pppd[19154]: remote IP address 10.6.6.6
    Aug 17 23:27:28 doom pppd[19154]: primary   DNS address 216.155.175.105
    Aug 17 23:27:28 doom pppd[19154]: secondary DNS address 216.155.175.106
    Aug 17 23:27:28 doom pppd[19154]: Script /etc/ppp/ip-up started (pid 19164)
    Aug 17 23:27:28 doom pppd[19154]: Script /etc/ppp/ip-up finished (pid 19164), status = 0x0
    
    When the PPP connection is started, your phone will say "Creating GPRS connection". Once PPP is up you'll see "G ((*))" in the top left corner of the phone, indicating that GPRS and Bluetooth are both active.

  • When you are done, be sure to kill the PPP and HCI daemon. If you used my ip-up.local and ip-down.local scripts then PPP will restore your resolv.conf. Also, remove the Bluetooth USB adaptor and turn off Bluetooth on your phone.
    doom# killall pppd
    doom# killall hcid
    

References

I gathered a lot of information from these pages. They may help you too.

Note

Here is an interesting observation from Stefan Mashkevich:
   One more remark... it *seems* to me that whatever is in "Menu->Services->Settings->Edit active service settings" isn't even relevant for using the thing as a modem (don't know about t-zones: I didn't get them to work, but I couldn't care less). At least when I (following techsupport's suggestions) changed "GPRS access point" in there from internet2 to internet3, nothing changed; but when I did the same change in the AT string, it stopped establishing the GPRS connection. So, in my case, it is the AT string that's crucial (I wish I knew what exactly it means).

Acknowledgments

Thanks to the following people for contributing information to this page.
  • Hx KSA
  • Stefan Mashkevich

Greg Hankins, ghankins@mindspring.com
$Id: nokia-6310i.html,v 1.3 2021/03/19 03:27:51 ghankins Exp $
Back to Greg's Home Page