btctl — Manage Bluetooth devices
btctl name [devicenumber]
Set device name returned by discovery. When executed without argument shows current device name.
btctl class {deviceclass}
Set class of the device. Returned by inquiry or discovery command. Remote devices may search for devices (interested in) with certain class.
btctl scan {[+] | [-]} {[disc] | [conn]}
Makes device discoverable or connectable or visa-versa.
btctl auth {[on] | [off]}
Enable/disable authentication on connection.
btctl connectrole {[master] | [slave]}
Set role in a connection. Useful when some devices do not support role switch. In that case run:
$ btctl connectrole master
btctl inquiry [length]
Search for the devices in the proximity for length seconds.
btctl discovery [length]
In the user point of view does the same but returns also devices names.
In order to find services on the remote device you need to have Service Discovery Protocol (SDP) support in the Affix. Services are located in hierarchical form.
btctl browse {device}
Browse services on device starting from Root. device can be either an address or a number in a device list shown by discovery,inquiry or list commands.
btctl search {device}
Some broken hardware or wrong implementation of Bluetooth stack (like in MS Windows) do not support browse. Search command tries to find all known services instead.
When you first executed inquiry or discovery command btctl will save information about bluetooth devices in a cache. Next command handle this cache:
btctl list
List devices in the cache.
btctl flush
Flush the cache.
btctl connect {address} [{channel} | {service_type}]
Makes RFCOMM connections to the device. You can connect to different channels which can be referred to as channel number or service type. Service types available are: SERial, DUN, LAN, HEAdset (Serial if omitted). After connection have been established you get virtual serial line between your linux Bluetooth device and remote Bluetooth device. Ports /dev/bty[0..99] are available for use.
btctl disconnect {line}
Disconnect line number line.
btctl status
Show information about connected FRCOMM lines.
btctl addpin [{address} | {default}] {pin}
Adds PIN code to connect to the device which require authentication. For example:
$ btctl addpin 00:00:00:00:00:00 "1234"
Adds PIN "1234" to connect to the device with given address.
$ btctl addpin default "1234"
Set default PIN code. Used when no PIN code for the device is found.
btctl rmpin [{address} | {default}]
Remove PIN code for connection to the given device. When used without arguments removes all added PINs. For example:
$ btctl rmpin 00:00:00:00:00:00
open {address} [channel]
Open OBEX FTP connection to the device.
close
Close OBEX FTP connection.
ls [[address] [[channel]]]
List current folder on the remote device.
get [[address] [[channel]]] {file name}
Get file from the remote device.
put [[address] [[channel]]] {file name}
Put file to the remote device.
rm [[address] [[channel]]] {file name}
Remove file on the remote device.
cd [dir name]
Change directory on the remote device.
mkdir [dir name]
Make directory on the remote device.
push {address} [channel] {file name}
Transfer file to the remote device using OBEX Object Push Profile.
$ btctl push 1 nokia.gif
Push image to the bluetooth mobile phone.
Arguments {address} and {channel} are not used with commands: ls, get, put, rm in FTP (prompt) mode.