rfcomm
Manage RFCOMM (Bluetooth serial port) connections
SYNOPSIS
rfcomm [options] command [arguments]
Common commands:
rfcomm [-i hciX] bind <dev> <bdaddr> <channel>
rfcomm [-i hciX] connect <dev> <bdaddr> <channel> [timeout]
rfcomm [-i hciX] [options] listen <dev> <channel> [timeout]
rfcomm [-i hciX] release <dev>
rfcomm [-i hciX] show <dev>
PARAMETERS
-h, --help
Displays help information and exits.
-v, --version
Shows the version number and exits.
-i <hciX>, --hci-device <hciX>
Specifies the HCI (Host Controller Interface) device to use, e.g., hci0.
-r, --raw
Uses raw device operations, bypassing the kernel RFCOMM layer.
-P, --persist
Makes the device persistent, automatically reconnecting upon connection loss.
-S, --server
Operates in server mode, listening for incoming connections.
-C, --client
Operates in client mode, initiating outgoing connections.
-E, --etr
Enables ETR (Enhanced Retransmission mode) for data reliability.
-T, --tmf
Enables TMF (Test Mode Feature) mode.
-A, --auth
Requires Bluetooth authentication for the connection.
-D, --encrypt
Requires Bluetooth encryption for the connection.
-M, --master
Sets the local device as the Bluetooth master in the connection.
-L, --local
Configures local loopback mode.
-W <timeout>, --wait <timeout>
Sets a timeout (in seconds) for connection establishment.
-B <bdaddr>, --bdaddr <bdaddr>
Specifies the Bluetooth address (BD_ADDR) of the remote device.
-s <channel>, --channel <channel>
Specifies the RFCOMM channel to use.
-N, --no-tty
Prevents allocation of a TTY device.
-X, --xoff
Enables XOFF (Software Flow Control) for the serial port.
-R, --rtscts
Enables RTS/CTS (Hardware Flow Control) for the serial port.
-K, --loopback
Enables local loopback for testing.
-p <port>, --port <port>
Specifies the local port (for listen or connect commands).
-V, --verbose
Enables verbose output for detailed information.
DESCRIPTION
rfcomm is a Linux command-line utility for configuring, displaying, and managing RFCOMM (Radio Frequency Communication) connections. RFCOMM is a protocol, part of the Bluetooth specification, that provides emulation of serial ports over the Bluetooth baseband. This allows Bluetooth devices to communicate as if they were connected via a traditional serial cable.
Common applications include Bluetooth modems, GPS receivers, headsets, and other devices requiring serial data transfer. The rfcomm utility enables users to bind Bluetooth devices to local RFCOMM TTY devices (e.g., /dev/rfcomm0), establish outgoing connections, listen for incoming connections, and monitor device status. It is an essential tool for setting up and debugging Bluetooth Serial Port Profile (SPP) connections on Linux systems, providing granular control over various RFCOMM parameters such as flow control, authentication, and encryption.
CAVEATS
RFCOMM connections require a functioning Bluetooth adapter and the bluetooth service to be running.
Proper Bluetooth pairing and trust relationships might be necessary before establishing RFCOMM connections, especially with authentication or encryption enabled.
Channel numbers vary depending on the service being offered by the remote device (e.g., Serial Port Profile (SPP) usually uses channel 1, but this can differ).
Managing multiple RFCOMM devices (e.g., /dev/rfcomm0, /dev/rfcomm1) requires careful attention to avoid conflicts.
RFCOMM CHANNELS
RFCOMM uses specific channels (similar to TCP/UDP ports) to distinguish between different services offered by a Bluetooth device. The channel number must be known for both client and server to establish a connection. Standard services like Serial Port Profile (SPP) often default to channel 1, but this can vary depending on the device or service being offered.
TTY DEVICE EMULATION
When an RFCOMM connection is established (e.g., via rfcomm bind or rfcomm connect), it typically creates a virtual TTY device (e.g., /dev/rfcomm0). This allows standard serial communication applications (like minicom or custom scripts) to interact with the Bluetooth device as if it were a physical serial port, simplifying application development and usage.
HISTORY
rfcomm is an integral part of the BlueZ project, the official Linux Bluetooth protocol stack. BlueZ has been under continuous development since 2001, providing core Bluetooth functionalities, including RFCOMM support, for the Linux kernel and userspace utilities. The rfcomm command specifically has been a long-standing component, crucial for enabling Serial Port Profile (SPP) communication, which was one of the earliest and most widely adopted Bluetooth profiles for data transfer. Its role has remained consistent in allowing Linux systems to act as both client and server for RFCOMM connections.
SEE ALSO
bluetoothd(8), hcitool(1), hciconfig(8), sdptool(1), l2ping(1), gatttool(1), bluez(7)