File:  [NetBSD Developer Wiki] / wikisrc / tutorials / how_to_use_nokia_6230i_over_bluetooth_as_a_gprs_modem.mdwn
Revision 1.2: download - view: text, annotated - select for diffs
Sun Feb 5 07:14:36 2012 UTC (9 years, 9 months ago) by schmonz
Branches: MAIN
CVS tags: HEAD
dos2unix

    1: **Contents**
    2: 
    3: [[!toc]]
    4: 
    5: #  Requirements 
    6: 
    7: You will need a mobile phone with GPRS and Bluetooth, a Bluetooth device and a NetBSD system that supports Bluetooth (4.0 and above). 
    8: 
    9: In this example, we are using a Nokia 6230i phone, a Broadcom USB dongle and NetBSD 4.9.11. 
   10: 
   11: #  Setting up pppd 
   12: 
   13: We need to create some pppd options and chat scripts, first create the directories 
   14:     
   15:       # mkdir /etc/ppp /etc/ppp/peers
   16:     
   17: 
   18: Create a /etc/ppp/options file containing 
   19:     
   20:       #
   21:       # default options file for [pppd(8)](http://netbsd.gw.com/cgi-bin/man-cgi?pppd+8+NetBSD-current)
   22:       #
   23:       57600
   24:       crtscts
   25:       local
   26:       defaultroute
   27:       usepeerdns
   28:       noipdefault
   29:       nodetach
   30:     
   31: 
   32: 
   33: and a /etc/ppp/chat.gsm file containing 
   34:     
   35:       #
   36:       #  Chat script to dial out with GSM phone
   37:       #
   38:       ABORT     "BUSY"
   39:       ABORT     "NO CARRIER"
   40:       ABORT     "DELAYED"
   41:       ABORT     "NO DIALTONE"
   42:       ABORT     "VOICE"
   43:       
   44:       TIMEOUT   10
   45:       ""        AT
   46:       OK-AT-OK  AT&F
   47:       OK        AT+CGDCONT=1,"IP","\U"
   48:       
   49:       TIMEOUT   60
   50:       OK        ATDT\T
   51:       CONNECT   \c
   52:     
   53: 
   54: Create a /etc/ppp/peers/gprs file containing 
   55:     
   56:       #
   57:       # pppd(8) options file for GPRS
   58:       #
   59:       # The Access Point Name (APN) used by your GSM Operator may need
   60:       # to be different from the "internet" used below.
   61:       #
   62:       pty "rfcomm_sppd -a phone -d ubt0 -s DUN -m encrypt"
   63:       connect "/usr/sbin/chat -V -f /etc/ppp/chat.gsm -U internet -T *99#"
   64:       noccp
   65:     
   66: 
   67: ##  Configuring Bluetooth 
   68: 
   69: First, activate Bluetooth on your phone, on the Nokia 6230i as follows 
   70:     
   71:       Menu > Settings > Connectivity > Bluetooth > Bluetooth settings > My phone's name
   72:       Choose a name for your device, for this example I will use "My Nokia"
   73:       
   74:       Menu > Settings > Connectivity > Bluetooth > Bluetooth settings > My phone's visbility
   75:       Choose "Shown to all"
   76:       
   77:       Menu > Settings > Connectivity > Bluetooth > Bluetooth >
   78:       Choose "Bluetooth on"
   79:     
   80: 
   81: Plug your Bluetooth dongle into your computer and you should see something like the following on the console 
   82:     
   83:       ubt0 at uhub0 port 1 configuration 1 interface 0
   84:       ubt0: Broadcom BCM92035DGROM, rev 1.10/0.04, addr 2
   85:     
   86: 
   87: Now, we need to establish a Bluetooth connection between your phone and computer. Enable the Bluetooth dongle 
   88:     
   89:       # /etc/rc.d/btconfig start
   90:       Configuring Bluetooth controllers: ubt0.
   91:     
   92: 
   93: and perform an inquiry to discover the Bluetooth device address of your phone 
   94:     
   95:       # btconfig ubt0 inquiry
   96:       Device Discovery from device ubt0 ..... 1 response
   97:        1: bdaddr 00:22:b3:22:3e:32
   98:         : name "My Nokia"
   99:         ...
  100:     
  101: 
  102: Add an alias of the bdaddr (yours will be different) to /etc/bluetooth/hosts 
  103:     
  104:       # echo "00:22:b3:22:3e:32 phone" >> /etc/bluetooth/hosts
  105:     
  106: 
  107: Next set up a PIN in order to pair the phone with your Bluetooth dongle 
  108:     
  109:       # btpin -a phone -r -l 6
  110:       PIN: 928434
  111:     
  112: 
  113: and attempt to open a manual RFCOMM connection to the Dial Up Networking (DUN) service on the phone (press ^C to close the connection) 
  114:     
  115:       # rfcomm_sppd -a phone -s DUN
  116:       Starting on stdio...
  117:       AT
  118:       OK
  119:       ATI
  120:       Nokia
  121:       ATI3
  122:       Nokia 6230i
  123:       
  124:       OK
  125:       ^C
  126:     
  127: 
  128: Your phone should prompt you for accepting the connection from your computer, accept it and enter the PIN that btpin generated to complete the pairing process. 
  129: 
  130: Now we can start pppd 
  131:     
  132:       # pppd call gprs
  133:       Serial connection established.
  134:       Connect:  ppp0 <--> /dev/ttyp9
  135:       local     IP address 10.177.120.221
  136:       Remote    IP address 10.4.4.4
  137:       Primary   DNS address IP
  138:       Secondary DNS address IP
  139:     
  140: 
  141: You are now online. To terminate your pppd session just press Control + C, or send a SIGHUP to the pppd process. 
  142: 
  143: #  Advanced Configuration 
  144: 
  145: You may find that some phones require authentication when connecting to PPP, this will be a username/password provided by your GSM Operator. 
  146: 
  147: Create a /etc/ppp/chap-secrets file, owned by root and unreadable by anybody else (mode 0600) containing 
  148:     
  149:       #
  150:       # CHAP/PAP secrets file
  151:       #
  152:       "user" * "pass"
  153:     
  154: 
  155: and add the following line to the /etc/ppp/peers/gprs file 
  156:     
  157:        user "user"
  158:     
  159: 
  160: To automatically configure the DNS server when the PPP link is brought up, create a /etc/ppp/ip-up file containing 
  161:     
  162:       #!/bin/sh
  163:       #
  164:       # ip-up <interface> <tty> <speed> <local-ip> <remote-ip> <ipparam>
  165:       #            $1      $2      $3       $4         $5          $6
  166:       #
  167:       
  168:       if [ -f /etc/ppp/resolv.conf ]; then
  169:           rm -f /etc/resolv.conf
  170:           mv /etc/ppp/resolv.conf /etc/resolv.conf
  171:       fi
  172:     
  173: 
  174: #  See Also 
  175: 
  176: The [[Bluetooth]] wiki page contains more general Bluetooth configuration, and details of all PPP options can be found in the [pppd(8)](http://netbsd.gw.com/cgi-bin/man-cgi?pppd+8+NetBSD-current) manpage. 

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb