wiki:HowTo/Bluetooth/UsingCL

Version 1 (modified by harisk, 18 years ago) ( diff )

Using Bluetooth from the command line

hci, hciconfig, and hcitool

To Do

/etc/bluetooth/hcid.conf

rfcomm

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:

/etc/bluetooth/rfcomm.conf

Example:

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.

pand

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
node1-1:~# ifconfig bnep0 192.168.1.1
node1-1:~# ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2): 56 data bytes
64 bytes from 192.168.1.2: icmp_seq=0 ttl=64 time=53.0 ms
node1-2:~# pand --connect 00:0A:3A:53:D4:82 --service NAP --autozap
node1-2:~# ifconfig bnep0 192.168.1.2
node1-2:~# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: icmp_seq=0 ttl=64 time=74.9 ms
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=39.6 ms
Note: See TracWiki for help on using the wiki.