|
|
|
Accessing a mobile phone's memory via Bluetooth A nice easy one to get files to and from your Bluetooth enabled mobile phone (cellphone). Really useful for transfering games/photos/ringtones. Make sure you have konqueror and openobex installed. Start up your bluetooth daemon and run `hcitool scan` to get you phone's MAC address. Fire up konqueror and go to channel 7 of your phone's MAC address, for example... obex://[00:0e:07:8e:53:7a]:7/, or you can download one of the many OBEX clients (links on the openobex site). Setting up a bluetooth network. A little while ago I decided to setup a small bluetooth network at home. Why bluetooth over 802.11x? Well why not? It doesnt need a lot of bandwidth since the other box was only being used for occasional web / email access. I managed to pick up 2 bluetooth USB dongles for about £30 (www.usbtech.co.uk) that also came in handy when connecting my PC up to my mobile phone. After a bit of googling I found a few HOWTOs for setting up a Bluetooth PAN (Personal Area Network) but most were either obsolete or were for quite different versions of Linux (mainly Debian). My Bluetooth PAN server was Fedora Core 3 (Kernel 2.6.9-1.667) which has the bluetooth stack compiled into the kernel as standard. The only extra package I installed was bridge-utils that is used to bridge 2 network interfaces into 1. How to do it: Plug your USB Blueooth dongle in, have a look at /var/log/messages. You should see some entries like... Apr 11 18:11:45 troll kernel: usb 4-1: new full speed USB device using address 2 Apr 11 18:11:46 troll udevsend[16842]: starting udevd daemon Apr 11 18:11:46 troll udevsend[16843]: starting udevd daemon Apr 11 18:11:46 troll udevsend[16844]: starting udevd daemon Apr 11 18:11:47 troll kernel: Bluetooth: Core ver 2.6 Apr 11 18:11:47 troll kernel: NET: Registered protocol family 31 Apr 11 18:11:47 troll kernel: Bluetooth: HCI device and connection manager initialized Apr 11 18:11:47 troll kernel: Bluetooth: HCI socket layer initialized Apr 11 18:11:47 troll kernel: Bluetooth: HCI USB driver ver 2.7 Apr 11 18:11:47 troll kernel: usbcore: registered new driver hci_usbYou can also see what USB devices are detected by running 'lsusb', my card is shown as... Bus 002 Device 007: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth DongleRight, time to fiddle with the config files, take a look in /etc/bluetooth/, here's a copy of my hcid.conf
#
# HCI daemon configuration file.
#
# $Id: hcid.conf,v 1.4 2004/04/29 20:14:21 holtmann Exp $
#
# 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 /usr/bin/bluepin;
# D-Bus PIN helper
#dbus_pin_helper;
}
# Default settings for HCI devices
device {
# Local device name
# %d - device id
# %h - host name
name "potchin";
# Local device class
class 0x120104;
# 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 rswitch,hold,sniff,park;
# Authentication and Encryption
#auth enable;
#encrypt enable;
}
You also need to setup a PIN number for pairing with the client, stick your PIN in /etc/bluetooth/pin. You'll need to enter this on the client device later.As an added security measure I've created a script that sends a message to my Windows box whenever a client connects to the Bluetooth network. Its in /etc/bluetooth/pan/dev-up #!/bin/sh echo "Bluetooth PAN client connected on $1" | smbclient -M 192.168.0.2; Fire up the Bluetooth services and make sure hcid and sdpd are running... [root@troll ~]# service bluetooth status hcid (pid 3487) is running... sdpd (pid 3491) is running... hidd is stoppedYou also need to start the PAN daemon at this time... pand --listen --role=NAPNOTE: NAP is Network Access Point and is the same thing as a PAN Almost done, the only thing left to do is to setup a bridged network interface so the Bluetooth client can connect to the internet. My ethernet connection on the server to the rest of the network is eth0, the bluetooth interface will be bnep0. The new interface will br br0. To set this up make sure you have bridge-utils installed. Everything is configured in /etc/sysconfig/network-scripts. You will need to alter ifcfg-bnep0, ifcfg-eth0 and ifcfg-br0. Here's the contents of my config files... ifcfg-bnep0... DEVICE=bnep0 BRIDGE=br0 ONBOOT=no ifcfg-eth0... DEVICE=eth0 TYPE=ETHER BRIDGE=br0 ONBOOT=yes ifcfg-br0... DEVICE=br0 TYPE=Bridge IPADDR=192.168.0.3 NETMASK=255.255.255.0 ONBOOT=yesEverytime the bnep0 interface is brought online it will become part of the br0 interface along with eth0. The routing sorts itself out. That's it! Get your client to connect to the PAN and it will have internet access. My PAN client is Windows XP (SP2) and the only problem I've run into is a "feature" whereby it wont automatically connect to the PAN on boot. Good old Windows! Here's the sites I used when setting this up for the first time: http://bluez.sourceforge.net/contrib/HOWTO-PAN http://www.stolk.org/debian/bluetooth.html http://fdp.bg-freebsd.org/build/network-bluetooth.html |
| potchin [v]: To alter excessively or needlessly |
|
| Server up 79 days 5 hrs 59 mins. |