Using your phone as a Bluetooth modem in Linux

Software Package Requirements:

  • wvdial
  • bluez
  • bluetooth

Install packages for Ubutun/Debian systems
sudo apt-get install wvdial bluez bluetooth

Steps to get your Bluetooth modem working

  1. Turn phone’s Bluetooth connection and set to discoverable mode
  2. Scan for your device:
    sudo hcitool scan
    Result:
    Scanning ...
    00:11:22:33:44:55 MyPhone
  3. Search device to see if supports Dial-Up Networking (DUN) for use as a modem. Look out for RFCOMM channel
    sdptool search --bdaddr 00:11:22:33:44:55 DUN
    Result:
    Searching for DUN on 00:11:22:33:44:55 ...
    Service Name: Dial-Up Networking
    Service RecHandle: 0x1000f
    Service Class ID List:
    "Dialup Networking" (0x1103)
    Protocol Descriptor List:
    "L2CAP" (0x0100)
    "RFCOMM" (0x0003)
    Channel: 4
    Language Base Attr List:
    code_ISO639: 0x454e
    encoding: 0x6a
    base_offset: 0x100
    Profile Descriptor List:
    "Dialup Networking" (0x1103)
    Version: 0x0100
  4. Bind the modem on the RFCOMM Channel to a device
    sudo rfcomm bind /dev/rfcomm0 00:11:22:33:44:55 4
  5. Dial and connect (ensure your wvdial configuration is correct, for sample see below)
    sudo wvdial dstbt
    Result:
    --> WvDial: Internet dialer version 1.60
    --> Cannot get information for serial port.
    --> Initializing modem.
    --> Sending: ATZ
    ATZ
    OK
    --> Sending: AT+CGDCONT=,,"dst.internet"
    AT+CGDCONT=,,"dst.internet"
    OK
    --> Modem initialized.
    --> Sending: ATDT*99#
    --> Waiting for carrier.
    ATDT*99#
    CONNECT
    ~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~
    --> Carrier detected. Waiting for prompt.
    ~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~
    --> PPP negotiation detected.
    --> Starting pppd at Wed Aug 19 23:45:04 2009
    --> Pid of pppd: 17558
    --> Using interface ppp0
    --> local IP address 10.84.2.128
    --> remote IP address 10.6.6.6
    --> primary DNS address 202.152.64.27
    --> secondary DNS address 202.152.64.28
  6. You’re connected! Surf and enjoy the Internet!

Sample wvdial configuration file

  • Stored in ~/.wvdialrc
  • Change “dst.internet” to your provider’s APN

[Dialer dstbt]

Modem = /dev/rfcomm0 # modem device
Baud = 115200 # 921600 / 460800 / 115200 / 57600

Init = ATZ # far card with no PIN
# Init = ATZ+CPIN=”0000″ # for card with PIN, replace 0000 with your PIN

# If you know your ISP’s APN, specify it instead of YOUR_ISP_APN below.
# There’s also an APN table at https://wiki.ubuntu.com/NetworkManager/Hardware/3G .
# use one of the following 3 options. change to your providers APN
Init2 = AT+CGDCONT=,,”dst.internet”
#Init2 = AT+CGDCONT=1,”IP”,”YOUR_ISP_APN”
#Init2 = AT+CGDCONT=1,”IP”

# Most services/devices dial with *99# . A few seem to require *99***1#
Phone = *99#

# These often suffice, but your ISP might require different details. They’re
# often dummy details used for all users on the ISP, frequently the ISP’s
# name, but some ISP’s do require you to use a real username and password.
# any details possible
Username = internet
Password = internet

PS: bmobile customers change APN to “bmobilewap”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s