Using Bluetooth from the command line


The daemon responsible for Personal Area Networks. Example:

Set infrastructure mode: node1-1 as the master and node1-2 as the slave:

node1-1:~# pand --listen -role NAP --master --autozap

wait for at least 10 seconds for the interface to configure

node1-2:~# pand --connect 00:0A:3A:53:D4:82 --service NAP --autozap

Again, wait for at least 10 seconds to establish the link. Then set IP addreses:

node1-1:~# ifconfig bnep0
node1-2:~# ifconfig bnep0
node1-2:~# ping
PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=64 time=74.9 ms
64 bytes from icmp_seq=1 ttl=64 time=39.6 ms

hciconfig and hcitool

hciconfig returns current status of the device or configures it:

root@node1-1:~# hciconfig hci0
hci0:   Type: USB
        BD Address: 00:0A:3A:59:9A:34 ACL MTU: 192:8 SCO MTU: 64:8
        RX bytes:409 acl:0 sco:0 events:18 errors:0
        TX bytes:316 acl:0 sco:0 commands:17 errors:0

hcitool configures Bluetooth connections. For instance, to test link quality, RSSI, and transmit power used by the device 00:0A:3A:59:9A:34 on node1-1:

root@node1-2:~# hcitool lq 00:0A:3A:59:9A:34
Link quality: 255
root@node1-2:~# hcitool rssi 00:0A:3A:59:9A:34
RSSI return value: 5
root@node1-2:~# hcitool tpl 00:0A:3A:59:9A:34
Current transmit power level: -12

Interface settings are described in file:



The device is treated as a serial port and this utility enables to connect devices, i.e. stuff like

  • set channel
  • bind to a particular MAC address

Affects file:



The device on node1-2 has MAC address 00:0A:3A:53:D4:CD

node1-2:~# rfcomm -i hci0 listen 0 1 
Waiting for connection on channel 1
Connection from 00:0A:3A:53:D4:82 to /dev/rfcomm0
Press CTRL-C for hangup
node1-1:~# rfcomm -i hci0 connect 0 00:0A:3A:53:D4:CD 1
Connected /dev/rfcomm0 to 00:0A:3A:53:D4:CD on channel 1
Press CTRL-C for hangup

sdpd and sdptool

To Do.

Last modified 13 years ago Last modified on Sep 23, 2007, 5:06:17 AM
Note: See TracWiki for help on using the wiki.