3.9. Debugging Affix

Affix uses system log for printing debug messages and notifying for errors and warnings. To read messages give the following command as a root:

tail -f /var/log/syslog

The granularity of debug messages can be set with btctl command. The format is following:

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

Use plus sign to turn messages for specified module on. Special name "all" allows all messages to be shown. This results typically flood of messages and should be used carefully.

Table 3-25. List of possible modules and details

DBHCIDBL2CAPDBALLMOD
DBAFHCIDBAFL2CAPDBCTRL
DBHCIMGRDBRFCOMMDBPARSE
DBHCISCHEDDBAFRFCOMMDBCHARDUMP
DBHCIDBBTYDBHEXDUMP
DBAFHCIDBRFCOMMDBFNAME
DBHCIMGRDBAFRFCOMMDBFUNC
DBHCISCHEDDBBTYDBALLDETAIL
DBL2CAPDBPAN 
DBAFL2CAPDBDRV 

3.9.1. Capturing Traffic

You can also capture network packets transmitted through a Bluetooth device. This allows you to debug data transmitted over the Bluetooth line. Using this method is fairly simple. First all the traffic is captured to a file you specify. Use the following command to start capturing:

btctl capture file_name

When enough data is transmitted stop capturing pressing ctrl-c. Now you can use nice ethereal tool to make analyzing the traffic easier. Give command:

ethereal capture_file

3.9.2. Kernel Variables

Affix has several kernel variables in /proc/net/affix and /proc/sys/net/affix directories. Use these to get information of the state of Affix and your Bluetooth devices. You can also use some variables to control Affix functioning.

Affix 3.1.0 adds support for L2CAP 1.2. Support includes two new protocols L2CAP in retransmission and flow control modes. These protocols are also controlled using kernel variables. Six new variables were introduced. Those are located under /proc/sys/net/affix.

Table 3-26. L2CAP 1.2 retransmission and flow control kernel variables

VariableUsage
l2cap_max_transmitSets the maximum number of times that a packet can be retransmitted. (Range from 1 to 255).
l2cap_mon_timeoutSets the monitor timeout time (in milliseconds) (Range 100 - 65535)
l2cap_mpsSets the Maximum payload size (max size of packet that l2cap can deal with) (Range MTU - 65535). (MTU is the Maximum transmission unit)
l2cap_ret_timeoutSets the retransmission timeout time (in milliseconds) (Range 400 - 65535)
l2cap_supported_modesThis variable sets the value of the extended features supported by Affix. (Default: 7) The values are 4 bit value. Where: bit 0: Flow control mode (set 1 if feature is supported), bit 1: Retransmission mode (set 1 if feature is supported), bit 2: QoS (set 1 if feature is supported), bits 3-31 are set 0.
l2cap_txwindowSets the size of the transmission window for flow control and retransmission mode. (Range 1 - 32)

The status of each HID device can be read from /proc/net/affix/hidp. Each line contains two tab-delimited fields where the first field is a Bluetooth device address and the second field represents the status of the HID device (connected/not connected).