I've been using this previously but I never made notes about it so on every new release of openwrt, I had to do it again. I decided to take some time to write some stuff down, so I hope this will help some people who tries to do the same.
My goal is to be able to use my local network to connect my Sony Ericsson K660i to the internet using bluetooth NAP. My bluetooth stick is on a Linksys NSLU with openwrt 10.03.
First I had to install the needed packages:
opkg install bluez-utils kmod-bluetooth kmod-usb-ohci dbus-utils
Second there are some changes which has to be made to hcid.conf. Mine currently looks like this:
#
# 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;
# Default PIN code for incoming connections
# passkey "BlueZ";
passkey "0000";
}
# Default settings for HCI devices
device {
# Local device name
# %d - device id
# %h - host name
name "%h";
# Local device class
class 0x020100;
# 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;
# Default link policy
# none - no specific policy
# rswitch - allow role switch
# hold - allow hold mode
# sniff - allow sniff mode
# park - allow park mode
lp rswitch,hold,sniff,park;
}
You need to enable dbus and bluetooth:
/etc/init.d/dbus enable
/etc/init.d/bluez-utils enable
I just add the new bnep interface to the br-lan. To do this I created /etc/hotplug.d/net/20-bt with the next context:
case "$INTERFACE" in
bnep*) ;;
*) return 0;;
esac
case "$ACTION" in
add|register)
ifconfig $INTERFACE up
brctl addif br-lan $INTERFACE
;;
remove|unregister)
brctl delif br-lan $INTERFACE
ifconfig $INTERFACE down
;;
esac
At this point, you should be able to connect your mobile phone. I used dbus and the info on http://wiki.bluez.org/wiki/FAQ was usefull:
dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez/hci0 org.bluez.Adapter.SetMode string:discoverable
dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez/hci0 org.bluez.Adapter.SetDiscoverableTimeout uint32:60
The first comment makes the NSLU discoverable, the next one sets the timeout to 60 seconds. If everything works as it should, you should now have a bnep0 added to your br-lan.
I hope this can help someone.
(Last edited by wimpunk on 10 May 2010, 15:32)