btctl

Name

btctl -- Control the Bluetooth device attached to your computer and the Affix operation.

Synopsis

btctl [-i <name>] [-a] <command> [parameters..]

Description

Manage your bluetooth device and Affix. Affix is a Bluetooth protocol stack for Linux. Btctl consistsof several sub commands. They are grouped according to their purpose and listed here below.

-i The interface name which settings you want to manage. E.g. "bt0"

-v Verbose mode.

-V Print version number.

-m <map_file> Set the uart map file.

-r Set the uart rate

General Commands

Here belongs commands for device initialization, debuging and to get help.

help <command name>

Show quick help for this command

debug [+|-][<module>|<detail>|all]

Allow or disallow debugging information for a certain module. Affix prints Debug information to system log. To get debug messages you can give the following command as a root user.

tail -f /var/log/syslog

Alternatively you can read the messages from /var/log/kern.log

initdev

Resets the device back to the initial state. Basically the same as down command below.

up

Set the Bluetooth network interface up. Works like ifconfig command.

down

Bring the Bluetooth network interface down. Works like ifconfig command.

capture <file> | -

Capture all traffic to a file. All the network packets that propagates through Affix are stored to the file given as a parameter. Giving '-' captures to standard output. Press ctrl-c to stop capturing. See Affix technical documentation for further information.

Security Commands

Use these commands to set pin codes for devices, create pairings and set your security level.

security <mode>

Set the used security level. Mode is on of the following: open, link, service, pairable, auth, encrypt.

addpin [<address>|default] <pin>

Add a pin code to pin code database. The pin code is linked to certain Bluetooth device address. If default keyword is used instead of a device address the pin code is applied to all addresses that are not listed in the pin code database.

rmpin [<address>|default]

Deletes a pin code that linked to given device address. Giving "default" keyword the default pin code will be deleted.

unpair <address>

Remote pairing with a remote device. Remote device's address is given as a parameter.

pair <address>

Make pairing with a remote device. Depending on the security level you might need to set pin code first or you have to run btsrv which prompts you when the pin code is needed.

HCI Commands

Command's in this group are used to control the Bluetooth device. These command operates at low level and an ordinary end user probably do not need these.

bdaddr

Print device's Bluetooth address.

name [<name>]

Set the name for the device. This name is shown to others inquiring your device. If the name is not given as a parameter the current is printed.

scan [+|-][disc|conn]

Enables or disables scanning for connect or discovery attempt. If disabled this device cannot be connected or seen by remote devices. Enable discovery to allow others to see your device (disc) and to enable connecting (conn) to allow remote device establish a connection. Plus and minus signs in the front of keywords states enabled and disabled respectively.

remotename <bda>

Get the remote device's name.

role <allow|deny> <master|slave>

Set the devices initial role to master or slave. Master device establishes the Bluetooth connection. First parameter defines if a role switch is possible. If allowed then this device can change its role according to the situation.

class [<class>]

The class of device parameter is used to indicate the capabilities of the local device to other devices. Give the class in hex decimal in form 0x1234.

auth <address>

Try to authenticate the connected device with given address. This command is used to try to authenticate the remote device associated with the specified Connection Handle. On an authentication failure, the Controller or Link Manager shall not automatically detach the link. Instead you can issue a disconnect command to terminate the link if the action is appropriate.

pkt_type [<0xXXX> | <mnemonic>]

This command is used to change packet types can be used for a connection that is currently established. This allows current connections to be dynamically modified to support different types of user data. Multiple packet types may be specified for the command parameter by bitwise OR operation of the different packet types.

page_to [to]

This parameter defines the maximum time the local Link Manager will wait for a baseband page response from the remote device at a locally initiated connection attempt. If this time expires and the remote device has not responded to the page at baseband level, the connection attempt will be considered to have failed.

hdisc <handle | address>

Close an ACL connection.

hconnect <address>

Create an ACL connection to remote device.

hpkt <address> [pkt_type]

Specify what packet types are allowed to transmit over a connection.

readbroad

Prints how many times broadcast packets are sent.

writebroad

Broadcast packets are not acknowledged and are unreliable. The number of broadcast retransmissions parameter is used to increase the reliability of a broadcast message by retransmitting the broadcast message multiple times. This parameter defines the number of times the device will retransmit a broadcast data packet.

reset

Reset the device.

ping <bda> <size>

Ping a remote device which BDA was given as a parameter. The ping packet size is defined as the second parameter.

lq <bda>

Print the link quality value. It ranges from 0-255, which represents the quality of the link between two Bluetooth devices. The higher the value, the better the link quality is.

rssi <bda>

Read the value for the difference between the measured Received Signal Strength Indication (RSSI) and the limits of the Golden Receive Power Range for a connection handle to another Bluetooth device.

The RSSI measurement compares the received signal power with two threshold levels, which define the Golden Receive Power Range. The lower threshold level corresponds to a received power between -56 dBm and 6 dB above the actual sensitivity of the receiver. The upper threshold level is 20 dB above the lower threshold level to an accuracy of +/- 6 dB.

cpl <bda>

Print current transmit power level.

linkinfo <bda> [<interval>]

Print all the above three link information.

pinq_start <length> [<max_period_len> <min_period_len> <len>]

This performs an automatic inquiry. Max_Period_Length and Min_Period_Length define the time range between two consecutive inquiries, from the beginning of an inquiry until the start of the next inquiry. The Controller will use this range to determine a new random time between two consecutive inquiries for each inquiry. The len parameter specifies the total duration of the InquiryMode and, when time expires, Inquiry will be halted.

pinq_stop <length>

Stop automatic inquiry

UART Commands

Use these command to manage serial Bluetooth devices.

init_uart <name> <vendor> [speed] [flags]

Used internally. You should use open_uart instead.

open_uart <name> <vendor> [speed] [flags]

Attach a serial Bluetooth device (for example iPaq users). This command maps the Bluetooth device to /dev/bty0.

close_uart <name>

Detach serial Bluetooth device.

AUDIO Commands

Currently SCP profile is supported only by PCMCIA cards. There are some problems using audio devices with USB dongles. The bda argument for the following command can be replaced by cache entry number (btclt list).

path 0x00 | 0x01

This is Ericsson specific command that sets the SCO data path. Setting 0x00 means that audio data is transmitted as usual using HCI. 0x01 means that audio is sent for example through PCM plug. This command needs hardware that supports it and has become nowadays almost obsolete.

audio on|off [sync | async] [setting <SCO setting>]

Configure audio settings. Option 'on' enables audio support, the 'off' disables it. Option 'async' is used to enable the chip mechanism to signal affix to send packets to the chip. Option 'sync' is used to enable affix to send synchrnously SCO packets to the chip. Option 'setting' values can be found in section 6.12 page 387 in the BT Core V2.0 + EDR specification.

play <bda> [<file> | -]

Play a wav file. Audio data is in the given file sent to a Bluetooth headset. The alternative is to redirect standard input to headset. The following example directs raw audio data to a Bluetooth head phone.

Example 1. Audio play example

mpg123 -s <mp3_file_name> | sox -t raw -r 44100 -s -w -c 2 - -t raw -r 8000 -s -b -c 1 - | btctl play <bda> -

record <bda> [<file> | -]

Record voice data from a microphone that supports Bluetooth. For example headset used with mobile phones.