Linux Development :  Bluewater Systems Support Forum
Covers issues with Linux development, such as tool chains, packages, kernel issues etc... 
bluetooth pairing problem
Posted by: Henry ()
Date: October 21, 2009 06:00PM

Hi,

All the configuration of Bluetooth on snapper has been set properly, however, pairing is always failed when any other bluetooth devices request a pin from snapper. The snapper can't response to any request at all.

i think the problem can be seen from "/etc/bluetooth/main.conf" and D-bus as shown below, but I don't know how to fix it

root@snapper:$ hcid -n
hcid[702]: Bluetooth HCI daemon
hcid[702]: Parsing /etc/bluetooth/main.conf failed: No such file or directory
hcid[702]: Unable to get on D-Bus

And this is my /etc/bluetooth/hcid.conf file, which I can't see any problem

root@snapper:~$ cat /etc/bluetooth/hcid.conf
#
# 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 user;

# 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 "1234";
}

# Default settings for HCI devices
device {
# Local device name
# %d - device id
# %h - host name
name "%h (%d)";

# Local device class
class 0x120112;

# 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;

# 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;

}

And this is the /etc/init.d/bluetooth file, which I think may be of some problem

root@snapper:~$ cat /etc/init.d/bluetooth
#!/bin/sh
#
# Start/stop the Bluetooth daemons
#

set -e

PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=bluetooth
DESC="Bluetooth subsystem"

DAEMON_NAME=hcid
HID2HCI_NAME=hid2hci

DAEMON_EXEC="`which $DAEMON_NAME || true`"
HID2HCI_EXEC="`which $HID2HCI_NAME || true`"

DAEMON_ENABLE=true
HID2HCI_ENABLE=false

DAEMON_CONFIG="/etc/bluetooth/hcid.conf"

[ -e /etc/default/bluetooth ] && . /etc/default/bluetooth

case "$1" in
start)
echo -n "Starting $DESC:"
if $DAEMON_ENABLE && [ -x "$DAEMON_EXEC" ] && [ -f "$DAEMON_CONFIG" ] ; then
$DAEMON_EXEC -s -f $DAEMON_CONFIG
echo -n " $DAEMON_NAME"
fi
if $HID2HCI_ENABLE && [ -x "$HID2HCI_EXEC" ] ; then
$HID2HCI_EXEC --tohci > /dev/null 2>&1 || true
echo -n " $HID2HCI_NAME"
fi
echo "."
;;
stop)
echo -n "Stopping $DESC:"
killall $DAEMON_NAME > /dev/null 2>&1 || true
echo -n " $DAEMON_NAME"
echo "."
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop}" >&2
exit 1
;;
esac

exit 0

Thanks

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: andre ()
Date: October 21, 2009 06:23PM

Henry,
I've managed to transfer from the Snapper device to my host PC using the following commands. You will need to install the obexftp package from our repository.

Start up the hci session
hciattach /dev/ttyS2 csr 115200 noflow
hciconfig hci0 down
hciconfig hci0 up

Make a note of the hci MAC address (use hciconfig to get it)

Added in the messagebus user to /etc/passwd
messagebus::1:1:messagebus:/:/bin/sh

Start up d-bus
/etc/init.d/dbus-1 start

Start up hcid
/etc/init.d/bluetooth start

Run the obexftp daemon in bluetooth mode
obexftpd -b

On the host PC, download a file, put in the mac address of the bluetooth dongle on your Snapper setup.
obexftp -b 00:A0:96:13:BBgrinning smileyA -g /test.ppm

At this stage, the file should be transferred from your Snapper to your host PC.
Unfortunately the obexftpd software seems to be very verbose.

Regards,
Andre

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: henry ()
Date: October 21, 2009 06:45PM

Andre

Can you provide more detailed information how to change the /etc/passwd file? The following is my /etc/passwd and BT's MAC is 00:A0:96:13:BB:83

root@snapper:/home$ cat /etc/passwd
root::0:0:root:/:/bin/sh
messagebus:x:1:1:Linux User,,,:/var/run/dbus:/bin/sh


Thanks

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: andre ()
Date: October 21, 2009 06:51PM

That should be fine - if the messagebus user is already present in /etc/passwd, then you are fine.

Andre

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: henry ()
Date: October 21, 2009 07:01PM

Andre

I've done all the procedure described above, however, when I used the command

obexftp -b MAC-of-my-PC -p /path/to/file

my PC popped up a window and asked for a PIN, and as usual, the BT on snapper can't response to any PIN request.

Thanks

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: andre ()
Date: October 21, 2009 07:04PM

Try using the following /etc/bluetooth/hcid.conf. I notice that you have security set to user, try setting it to auto.

Regards,
Andre

#
# 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";
}

# Default settings for HCI devices
device {
        # Local device name
        #   %d - device id
        #   %h - host name
        name "BlueZ (%d)";

        # Local device class
        class 0x120112;

        # 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;

        # 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;
}

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: henry ()
Date: October 21, 2009 07:15PM

I've tried every option in the hcid.conf file, but all failed. I noticed that the following problem still exsits

root@snapper:/etc$ hcid -n
hcid[405]: Bluetooth HCI daemon
hcid[405]: Parsing /etc/bluetooth/main.conf failed: No such file or directory
hcid[405]: Unable to get on D-Bus

Let's forget Obexftp transfer and I'm just want to pair with a BT device. For example, my PC detects snapper and wanna pair with it. But all pairing requests got no response.

Thanks

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: andre ()
Date: October 21, 2009 07:23PM

Are you sure you're running the latest root filesystem from [www.bluewatersys.com]? I have just done a clean install, and if you install the following packages:
ipkg-cl update
ipkg-cl install bluez-utils
ipkg-cl install bluez-utils-compat
ipkg-cl install obexftp

and then follow the instructions above, it should all work.

Regards,
Andre

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: henry ()
Date: October 21, 2009 07:36PM

Yes, they all up to date.

Can you explain why there is no /etc/bluetooth/main.conf and D-bus no available?

root@snapper:/etc$ hcid -n
hcid[405]: Bluetooth HCI daemon
hcid[405]: Parsing /etc/bluetooth/main.conf failed: No such file or directory
hcid[405]: Unable to get on D-Bus

Thanks

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: andre ()
Date: October 21, 2009 07:39PM

Have you started DBUS first (via /etc/init.d/dbus-1 start). You should be starting hcid via the /etc/init.d/bluetooth script, rather than directly.

Andre

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: henry ()
Date: October 21, 2009 07:48PM

Yes, once I login to snapper, I start using the command below

snapper login: root
login[371]: root login on 'ttyAM0'
root@snapper:~$ /etc/init.d/dbus-1 restart
Stopping system message bus: no process in pidfile '/var/run/dbus/pid' found; none killed
dbus.
Starting system message bus: dbus.
root@snapper:~$ /etc/init.d/bluetooth stop
Stopping Bluetooth subsystem: hcid.
root@snapper:~$ /etc/init.d/bluetooth start
Starting Bluetooth subsystem: hcid hid2hci.
root@snapper:~$ cd home/
root@snapper:/home$ ./bluetooth_start
CSR build ID 0x07-0x7B
Scanning ...
00:24:7D:02:16:4A Henry
00:1E:52:E4:52:94 Wenyu Zhang’s MacBook
00:24:03:91:63:62 WendyZ
00:16:41:88:B6:6B COMPACT
00:21:86:92:71:AD HENRY-PC

Thanks

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: andre ()
Date: October 21, 2009 07:52PM

Can I confirm that it works now that you are starting it correctly?

Thanks,
Andre

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: henry ()
Date: October 21, 2009 08:07PM

Still can't work. Always failed to response to the requesting from other BT deveice

Thanks

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: andre ()
Date: October 21, 2009 08:11PM

Can you try starting the bluetooth device up prior to starting up /etc/init.d/bluetooth? Ie: Run your ./bluetooth_start script first?

Andre

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: henry ()
Date: October 21, 2009 08:16PM

Still not working. Please see the staring process below

snapper login: root
login[371]: root login on 'ttyAM0'
root@snapper:~$ cd home/
root@snapper:/home$ ./bluetooth_start
CSR build ID 0x07-0x7B
Scanning ...
00:24:7D:02:16:4A Henry
00:21:86:92:71:AD HENRY-PC
00:1E:52:E4:52:94 Wenyu Zhang’s MacBook
00:24:03:91:63:62 WendyZ
00:16:41:88:B6:6B COMPACT
root@snapper:/home$ /etc/init.d/dbus-1 start
Removing stale PID file /var/run/dbus/pid.
Starting system message bus: dbus.
root@snapper:/home$ /etc/init.d/bluetooth start
Starting Bluetooth subsystem: hcid hid2hci.
root@snapper:/home$

Thanks

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: andre ()
Date: October 21, 2009 08:21PM

I am not familiar with pairing between two Linux boxes - normally that is used to pair from a Linux box to a 'slave' device, such as a keyboard/mouse/audio headset. Can you explain to me what the final operation you are trying to achieve is?

Regards,
Andre

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: henry ()
Date: October 21, 2009 08:31PM

I am trying to send a file from Snapper to my PC via bluetooth, using the command

obexftp -b MAC-of-my-PC -p /path/to/file

When this command was typed in, my PC (VIsta) will pop up a window to verify the PIN for pairing these two device. However, when I typed "1234" in the window, it said the pairing is failed. On snapper, something like this

root@snapper:/home$ obexftp -b 00:21:86:92:71:AD -p bluetooth_start
Browsing 00:21:86:92:71:AD ...
Connecting...failed: connect
Interupted/bad reception or the device moved out of range: Operation now in progress
Still trying to connect
Connecting...failed: connect
The user may have rejected the transfer: Connection refused

Thanks

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: andre ()
Date: October 21, 2009 08:37PM

The obexftp command will not work from the snapper, unless you have explicitly enabled bluetooth filesharing from your PC.

Also, have you tried the 'BlueZ' passcode - this is the one that is in the default hcid.conf.

Andre

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: henry ()
Date: October 21, 2009 08:46PM

Although I've changed the passkey to "BlueZ", it still doesn't work.

And I uses the hcitool command to make a connection, but failed as shown below

root@snapper:~$ hcitool cc 00:21:86:92:71:AD
root@snapper:~$ hcitool con
Connections:
root@snapper:~$

Thanks

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: andre ()
Date: October 21, 2009 09:05PM

Try using the hcitool auth command instead of the cc command. This should cause your PC to prompt for a passkey, which should be 'BlueZ' as specified in the config file.

root@snapper:~$ hcitool auth 00:09grinning smileyD:50:08:28

Regards,
Andre

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: henry ()
Date: October 21, 2009 09:09PM

the information popped up then

root@snapper:~$ hcitool auth 00:21:86:92:71:AD
Not connected.
root@snapper:~$

thanks

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: henry ()
Date: October 22, 2009 10:52AM

Andre

I've tried every method online to solve the pairing problem, however,all invail.

The information "hcid[394]: Unable to get on D-Bus" always exists and i believe this is the problem, but i can't solve it.

Can you try to solve it?

Looking forward to hear from you.

Henry

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: andre ()
Date: October 22, 2009 11:42AM

From your previous mails, it would appear that that doesn't happen if you start the dbus-1 service before the bluetooth service.

Regards,
Andre

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: Henry ()
Date: October 22, 2009 03:48PM

I will first run my bluetooth_start script to start the attach bluetooth device, and then run the

"/etc/init.d/dbus-l start" to start the dbus, and last run "/etc/init.d/bluetooth start". But no help at all.

Options: ReplyQuote
Re: bluetooth pairing problem
Posted by: andre ()
Date: October 22, 2009 04:28PM

Henry,
I'm sorry, I really cannot see what the problem is here. From my testing, I am confident that the Snapper software is working correctly, I believe this is probably to do with the host side software.

Apart from retrying the instructions that we've previously discussed, I don't think I can add much more. Unfortunately, we can't provide any support for the host side portion of this.

Regards,
Andre

Options: ReplyQuote


Your Name: 
Your Email: 
Subject: 
Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
This is a moderated forum. Your message will remain hidden until it has been approved by a moderator or administrator
This forum powered by Phorum.

Applications

rs1

rs_2

rs_3

rs_4