LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 10-02-2009, 03:54 PM   #1
0rphu
Member
 
Registered: Sep 2009
Posts: 31

Rep: Reputation: 6
Slackware 13 bluetooth PAN


Hi all,

I've been tinkering with making the bluetooth pan working for about a week now, managed to get all sorts of outcomes, some of them I can't even reproduce anymore. I also got it running on one occasion with bluez 4.53, but that was only until I rebooted. I haven't been able to get it working again. I want to use my desktop as NAP or GN.

Tried with bluez 3.36, but couldn't even pair the other device (a windows xp notebook or a sony ericsson w902 mobile phone). And even if I could, the pand daemon doesn't work because the network plugin of bluez is blocking a socket for pand. And the network plugin doesn't seem to be working either as I've read.

I tried with bluez 4.53, installed gnome-bluetooth, bluez gnome, even blueman with all that horrifying dependencies like policykit which I don't even know what is for. I was able to pair the device, but only from computer to the phone and sometimes with strange outcomes. The network sharing from computer to phone (or my notebook) didn't work anyway. No bnep0 gets available, only that one time until I rebooted.

So is there a brave soul out there who got it working? I'd be very grateful for any howto, even one including black magic, I am pulling my hair here... It's not a problem for me to reinstall everything and start with a clean install, but I am avoiding KDE, so KDE free pointers are the ones I'd value the most, but this is not a condition.

I hope I am not asking too much, but at the moment my bluetooth dongle is rather useless apart from providing irritating blue light.

Thanks a lot in advance
 
Old 10-03-2009, 10:08 AM   #2
0rphu
Member
 
Registered: Sep 2009
Posts: 31

Original Poster
Rep: Reputation: 6
OK, I got it working. With a little help from a friend :)

If it weren't for cgorac, who probably just registered to the forum and was, like me in need of a bluez related help, I wouldn't manage it at all. Frankly I've just given up when suddenly... But let me give it to you as it should be given - in order.

I made a fresh install, so this should be easy to follow.

1. to make bluetooth services start on boot, you'll need to make /etc/rc.d/rc.bluetooth executable

Code:
chmod u+x /etc/rc.d/rc.bluetooth
2. set your default key (1234 or whatever you like)

Code:
echo -n "1234" >/etc/bluetooth/passkeys/default
3. change your /etc/dbus-1/system.d/bluetooth.conf to allow passkey agent access to dbus (add the red marked line)

Code:
<!-- This configuration file specifies the required security policies
     for Bluetooth core daemon to work. -->

<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>

  <!-- ../system.conf have denied everything, so we just punch some holes -->

  <policy user="root">
    <allow own="org.bluez"/>
    <allow send_destination="org.bluez"/>
    <allow send_interface="org.bluez.Agent"/>
    <allow send_interface="org.bluez.PasskeyAgent"/>
  </policy>

  <policy at_console="true">
    <allow send_destination="org.bluez"/>
  </policy>

  <policy context="default">
    <deny send_destination="org.bluez"/>
  </policy>

</busconfig>
4. reboot now to make sure the dbus configuration change is loaded

5. After reboot the bluetooth services should be running. To pair your device (desktop, laptop, phone...) provoke the bonding by initiating an obex connection form the computer to the device

5.1 First find out the MAC of the device

Code:
hcitool scan
you should obtain an address of the device

5.2 start the obex connection

Code:
obexftp -b <insert address of the device here> -l
you will be prompted to insert a passkey on you device, insert the one you've set in step 2.

5.3 You should be all good now! Your device is paired.

If you'd like to setup your computer as a NAP, read on.

Some time ago, BlueZ switched from dedicated daemons (like pand) to plugins (like network.so). The only problems are that they either don't work, or I just couldn't find a way how to make them work and even worse, they tend to make the old "legacy" deamons unusable by blocking a socket they use. So how can you solve this? Read on!

6. There are 2 ways to disable the "new" service plugins, like network.so. First is to recompile - this is a nice way, on the other hand, you might break something and lose some functionality by not specifing correct configure parameters or omitting some. Do that if you know exactly what you are doing. I on the other hand have already broken so many BlueZ installations that I don't dare anymore. I'll go the nasty way

6.1 switch to plugins directory
Code:
/usr/lib[64]/bluetooth/plugins/
and you'll see them there. Your arch enemy is network.so and network.la. Rename them. hcid will be very sad that he can't find them and load them and will probably rant about that, but that is his problem, not mine. And you will be able to use the good old pand daemon again.

7. make a "devup" executable file, this will bring your bnep0 interface up assign an IP to it and allow packet forwarding. You can create it wherever you like, just make it owned and executable by root and don't forget to use the whole path to it in step 8 below.

Code:
mkdir /etc/bluetooth/pan/
vi devup
my devup looks like this. Seen it on a gentoo page and works flawlessly for me. This requires some basic knowledge of networking. If you undrestand the code below, you should be able to change it to your liking

Code:
#!/bin/sh
echo 1 > /proc/sys/net/ipv4/ip_forward

ifconfig bnep0 192.168.0.2 up

iptables -F
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE
iptables -A FORWARD -i bnep0 -o eth0 -j ACCEPT
iptables -A FORWARD -o bnep0 -i eth0 -j ACCEPT
make it executable

Code:
chmod u+x /etc/bluetooth/pan/devup

8. enable pand in /etc/rc.d/rc.bluetooth.conf and set the command options. You'll find it just at the bottom of the config file. Mine look like this
Code:
# The PAN daemon is used to setup a Bluetooth network.
PAND_ENABLE=true
PAND_OPTIONS="--listen --role NAP --devup /etc/bluetooth/pan/devup --persist"
9. restart bluetooth services

Code:
/etc/rc.d/rc.bluetooth restart
10. You are done! Next time your device connects, a bnep0 interface with an assigned IP becomes available on your computer and will be able to forward packets to and from your device. Just make sure you configure your PANu side (another computer or phone) to have an IP from the same subnet as bnep0 and the same DNS server as yours in /etc/resolv.conf.

Last but not least I'd like to thank everyone who made this possible, it's too many of you, most of you are already forgotten names from various forums I've read in the past 2 weeks. If you see something you feel was your idea and would like some credit for it, let me know. Or just feel happy you've helped. I am not taking credit for any of this, I am just glad I got it working. I hope it will help others, too

Last edited by 0rphu; 10-03-2009 at 10:13 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why are bluetooth PAN latencies so high in linux fish199902 Linux - Hardware 0 06-12-2009 11:12 AM
Slackware and PAN/Piconet (Over bluetooth) ljones0 Slackware 5 03-02-2009 02:03 PM
bluetooth pan bridging problem ppr:kut Linux - Networking 1 08-29-2007 01:54 PM
How to use Bluetooth PAN to communicate in Fedora 3 chen8002004 Fedora 0 01-10-2006 08:25 PM
Bluetooth PAN Network HaPagan Linux - Networking 1 09-23-2005 01:55 PM


All times are GMT -5. The time now is 09:16 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration