NIT Bluetooth DUN

From GrinningMonkey

Contents

SETUP

The setup on the PC side has to be done once. The setup on the NIT requires no hacking and no extra packages installed.

PC side

On my Debian etch PC, I had to change the following files (NOTE: for the sake of space I'll include only the relevant lines):

In /etc/default/bluetooth:

DUND_ENABLED=1
DUND_OPTIONS="--auth --encrypt --secure --dialup call dun"


In /etc/bluetooth/hcid.conf

        autoinit yes;
        security user;
        pairing multi;

        name "Foobar";
        class 0x020108;
        iscan enable; pscan enable;
        lm accept;
        lp rswitch,hold,sniff,park;


Create new file /etc/ppp/peers/dun

460800
crtscts
debug
local
noipdefault
passive
connect "/etc/ppp/peers/at-command.pl -v"
noauth
nodefaultroute
noipx
noaccomp
nobsdcomp
nodeflate
192.168.42.1:192.168.42.5
ms-dns your.dns.ip.addr


MULTIPLE NITs

If you plan on allowing more than one Internet Tablet to connect, replace:

  • 192.168.42.1:192.168.42.5 with
  • 192.168.42.1:

Using this method, you will have to supply an appropriate IP address and DNS server using the Advanced option under Connectivity. See note below, in the NIT setup instructions.


Create new file /etc/ppp/peers/at-command.pl -v"

#!/usr/bin/perl
#
# Copyright (c) 2004 Henk Vergonet
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

#
# This script simulates an 'AT' modem command interface.
# Some dial-up-networking clients (pocketPC 2003 ...) will insist on sending
# AT command strings before connecting via PPP.
#
# Example ppp/peers/dun script for connecting my MDA to the network.
#  115200
#  local
#  noipdefault
#  connect "/etc/ppp/at-cmd.pl -v"
#  noauth
#  nodefaultroute
#  noipx
#  10.10.10.10:10.10.10.11
#  ms-dns 10.10.10.1
#
use strict;
use Getopt::Std;
use Sys::Syslog;
use POSIX qw(strftime);

my %opt;
getopts('hv', \%opt);

die "Fake at command parser\n\nusage:\n\t-v\tDebug messages in syslog\n"
        if $opt{h};

openlog($0, 'cons,pid', 'user') or die "openlog $!";
END {
        closelog();
}

$/ = "\r";
while(<STDIN>)
{
        syslog('debug', "got: $_") if defined $opt{v};
        $_ = uc;
        if(/^ATD/) {
                print "CONNECT\r\n";
                syslog('debug', "send: CONNECT\r") if defined $opt{v};
                exit(0);
        } elsif(/^AT/) {
                print "OK\r\n";
                syslog('debug', "send: OK\r") if defined $opt{v};
        }
}

The latter bit of code listens for the NIT to make various AT commands, and when it does the ATD command to dial, then initiates the connection.


NOTES

  • The original used \r line terminators, which I changed to \r\n
  • I issue a hciconfig hci0 auth encrypt after I insert the adapter.
  • The "iscan enable" in /etc/bluetooth/hcid.conf does not make the PC discoverable (I believe it just makes it so that you can enter discoverable mode).
    • You need to issue the command hciconfig hci0 piscan to enter discoverable mode (or use your GUI tools...).
    • You must make the PC discoverable in order to pair up with the Nokia (see below)


NIT side

Do these once:

N770

  1. Make your PC discoverable
  2. Menu → Tools → Control Panel → Phone → New
    1. You should see your PC, pair up with it. I recommend using a 10-digit or greater pairing code
    2. You will get a warning that you can only use the phone for Dial-Up Networking, not transferring files. I will see about how to make the PC browseable later.
  3. (Control Panel) → Connectivity → Connections → New
    1. Choose 'Packet Data'
    2. 'Access point name' is irrelevant, leave it at default value of 'internet'
    3. Dial-up number is irrelevant, leave it at default value of '*99#
    4. No username / password
    5. IF you chose the MULTIPLE NITs method above, THEN:
      1. Select AdvancedIP Addresses and fill in an appropriate IP address and DNS server


N800

  1. Make your PC discoverable
  2. Menu → Tools → Control Panel → Bluetooth → Devices → New
    1. You should see your PC, pair up with it. I recommend using a 10-digit or greater pairing code
    2. I've set mine as a "Trusted Device"... I haven't tried it the other way yet
  3. (Control Panel) → Connectivity → Connections → New
    1. Choose GPRS
    2. 'Access point name' is irrelevant, leave it at default value of 'internet'
    3. Dial-up number is irrelevant, leave it at default value of '*99#
    4. No username / password
    5. IF you chose the MULTIPLE NITs method above, THEN:
      1. Select AdvancedIP Addresses and fill in an appropriate IP address and DNS server
  4. (Control Panel) → Phone
    1. Choose your PC from the dropdown (it is now 'selected'... if you don't do this, it won't show up when you select the Connection Manager (globe))


N800 vs. N770 differences

  • In the N770, I can use the 'Phone' option in 'Control Panel' to discover/pair to my PC. On the N800, not so - it just would not find it (perhaps if I changed my PC's 'class'...). I *could* pair with the PC using the 'Devices' option. Once I did that, I had to go into 'Phone' and select the computer, which would now be in the dropdown.


Connecting

  1. Activate your PC's Bluetooth device (I like to do hciconfig hci0 auth encrypt after this)
  2. On your NIT, select 'Connections' from the Status Bar (the globe)
  3. Select your PC and it should connect


NOTES

  • Disconnecting my laptop's PCMCIA card before ending the connection from the NIT crashed my PC... hard. I haven't reproduced this with the TRENDNet adapter, yet.