Thursday, June 3, 2010

Command line working with bluetooth

 

Passing the key using a configuration is not likely to work with gnome.

This is the given procedure:

1) Create a config file at /etc/bluetooth/ called hcid.conf (I think it can be

any name but in the given directory) which will include:

 

options {

autoinit yes;

security user;

pairing multi;

#passkey "1234";

pin_helper /opt/pin_helper.sh;

}

 

2) /opt/pin_helper.sh code will just echo PIN:

 

#!/bin/bash

echo "PIN:1234"

 

3) Some people have used passkey option to pass the PIN

 

4) If bluetoothd is running (/etc/init.d/bluetooth [start|stop] ) it will

bring up the hardware when it plugged. else use:

 

hciconfig hci0 up ( like in ifconfig, check the device with hcitool dev)

 

5) then scan for the visible bluetooth hosts:

hcitool scan

 

6) Now using obexftp, files can be transfered (obexftpd should be running at

the other end: obexftpd -b -c /tmp/)

eg:

obexftp -b 00:16:20:60:7C:36 -c / -l

obexftp -b 00:16:20:60:7C:36 -c /Pictures -g picture1.jpg

obexftp -b 00:16:20:60:7C:36 -c /Pictures -p file.jpg

 

6) If obexftp require PIN and if you are running bluetoothd and bluetooth-

applet, applet will prompt for the key to be enterd.

 

7) If any one or all of bluetoothd and bluetooth-applet are not running we

have to start an agent manually:

bluetooth-agent

8) Then the obexftp can be used

 

Appendix:useful commands

Find services and related channels provided by the other end:

sdptool browse 2C:81:58:C1:CD:19

 

Ping the device(check for the link quality):

l2ping 2C:81:58:C1:CD:19

 

Create a connection for other purposes(audio,printing,modem...) instead of

file transfer:

rfcomm connect 0 00:1B:59:1F:93:7D 6

rfcomm connect /dev/rfcomm0)>

hidd --connect 00:1B:59:1F:93:7D

hcitool cc 00:1B:59:1F:93:7D

 

No comments:

Post a Comment