Here's a list of several tools dealing with Bluetooth that you can use to interact with a device.
hciconfig
hciconfig
- Gives info about the bluetooth hci on your pc
- Ensure the device is up and running and has required scan modes
- Running
hcitool dev
should also give some of this info
hcitool
hcitool inq
and hcitool scan
- Gives info about or rather identifies nearby bluetooth devices
hcitool info <BTAddr>
- Get info about remote bluetooth device
l2ping
l2ping <BTAddr>
- One way to see if we can communicate with a remote bluetooth device
sdptool
sdptool browse <BTAddr> or sdptool records <BTAddr>
- Gives info about the services provided by a remote bluetooth device
obexftp
obexftp –nopath –noconn –uuid none –bluetooth <BTAddr> –channel <OPUSHChann
elNo> –put <FileToPut>
- Allows one to send file without specifying the pin on the remote device side
- The OPush channel number for device is got from sdptool above
obexftp -b <BTAddr> -v -p <FileToPut>
- Allows one to put a file onto the specified BT device
- obexftp could also be used to get or list the files on the BT device
- also allows one to identify a nearby BT device by just giving -b option
passkey-agent
passkey-agent –default <Pin>
- Pin specified here is what the remote BT device should provide
or its user enter on that device when requested.
obexpushd
obexpushd
- Allows one to recieve files sent from a bluetooth device.
- Depending on who started it, the recieved files will be stored in the corresponding home directory
Pairing
You can following the directions from this site to pair a device with your Linux box via the command line. The aritcle is titled: How to pair a bluetooth device from command line on Linux.
Example
Find your bluetooth device mac address
$ hcitool scan
Scanning ...
11:22:33:44:55:66 device 1
12:34:56:78:90:12 device 2
Setup bluetooth-agent to pass the expected pairing code
$ bluetooth-agent 0000 &
Edit the rfcomm config file /etc/bluetooth/rfcomm.conf
, and put the MAC address from above, in it.
rfcomm0 {
# Automatically bind the device at startup
bind no;
# Bluetooth address of the device
device 11:22:33:44:55:66;
# RFCOMM channel for the connection
channel 3;
# Description of the connection
comment "This is Device 1's serial port.";
}
NOTE: An important caveat, if you configure your device to not bind at startup (bind no;) you are going to have to manually spin up rfcomm using this command before using the serial port (which also requires root permissions).
$ sudo rfcomm connect rfcomm0
References