Bluetooth and Linux

This topic was published by and viewed 1343 times since "". The last page revision was "".

Viewing 1 post (of 1 total)
  • Author
    Posts
  • DevynCJohnson
    DevynCJohnson
    Keymaster
    • Topics - 444
    • @devyncjohnson

    Bluetooth (IEEE 802.15.1) is a popular short-range wireless connection. Bluetooth networks are known as Personal Area Networks (PANs). Bluetooth is used to connect computers and mobile devices to various input and output devices like headphones, keyboards, mice, printers, etc. Even two computers or mobile devices can connect to each other via Bluetooth.

    A piconet is an ad-hoc Bluetooth network that contains a master device connected to no more than seven devices. Typically, Bluetooth is used for computer accessories, although Bluetooth networks are becoming popular. The main difference between Bluetooth and WiFi is hardware, range, and protocols.

    NOTE: USB3.0 devices produce a frequency that interferes with Bluetooth. Be careful when using USB3.0 in close proximity with Bluetooth.

    Some devices have Bluetooth cards built-in. If not, users can obtain USB Bluetooth dongles. Then (after proper software configuration), the device can use Bluetooth.

    The Bluetooth protocol contains many kinds of "profiles" as listed below. A "profile" is a sub-protocol or a protocol within the Bluetooth protocol.

    • Advanced Audio Distribution Profile (A2DP)
    • Attribute Profile (ATT)
    • Audio/Video Remote Control Profile (AVRCP)
    • Basic Imaging Profile (BIP)
    • Basic Printing Profile (BPP)
    • Common ISDN Access Profile (CIP)
    • Cordless Telephony Profile (CTP)
    • Device ID Profile (DIP)
    • Dial-up Networking Profile (DUN)
    • Fax Profile (FAX)
    • File Transfer Profile (FTP)
    • Generic Audio/Video Distribution Profile (GAVDP)
    • Generic Access Profile (GAP)
    • Generic Attribute Profile (GATT)
    • Generic Object Exchange Profile (GOEP)
    • Hard Copy Cable Replacement Profile (HCRP)
    • Health Device Profile (HDP)
    • Hands-Free Profile (HFP)
    • Human Interface Device Profile (HID)
    • Headset Profile (HSP)
    • Intercom Profile (ICP)
    • LAN Access Profile (LAP)
    • Message Access Profile (MAP)
    • OBject EXchange (OBEX)
    • Object Push Profile (OPP)
    • Personal Area Networking Profile (PAN)
    • Phone Book Access Profile (PBAP, PBA)
    • Proximity Profile (PXP)
    • Serial Port Profile (SPP)
    • Service Discovery Application Profile (SDAP)
    • SIM Access Profile (SAP, SIM, rSAP)
    • Synchronization Profile (SYNCH)
    • Synchronisation Mark-up Language Profile (SyncML)
    • Video Distribution Profile (VDP)
    • Wireless Application Protocol Bearer (WAPB)

    Linux supports Bluetooth via the BlueZ Bluetooth stack. Android uses "BlueDroid" instead of BlueZ. A Bluetooth stack is any type of software that provides Bluetooth protocols.

    NOTE: BlueZ does not support the HSP or HFP Bluetooth profiles.

    Various graphical frontends are available for Linux to configure Bluetooth. "BlueDevil" is commonly used in KDE while "GNOME Bluetooth" is used by GNOME. "Blueman" is another alternative.

    ObexFS is a FUSE filesystem used to mount mobile devices (such as phones) as if they are a memory card. This allows users to access the phone's filesystem on the Linux system via Bluetooth. To mount ObexFS, type obexfs -b DEVICE-MAC-ADDRESS /mountpoint/ in a command-line. Unmount the device by typing fusermount -u /mountpoint.

    The generic Bluetooth driver used in Linux is called "btusb". So, modprobe can be used to load the driver/module in the command-line by typing "modprobe btusb".

    The daemon that provides the Bluetooth services is "bluetooth" or "bluetoothd". To start Bluetooth via the systemd service, type "systemctl start bluetooth". To make Bluetooth start at boot-time, type "systemctl enable bluetooth". The daemon's configuration file is /etc/bluetooth/main.conf. A sample of this configuration file's contents are seen below.

    [General]
    # List of plugins that should not be loaded on bluetoothd startup
    #DisablePlugins = network,input
    # Default adaper name
    # %h - substituted for hostname
    # %d - substituted for adapter id
    Name = %h-%d
    # Default device class. Only the major and minor device class bits are
    # considered.
    Class = 0x000100
    # How long to stay in discoverable mode before going back to non-discoverable
    # The value is in seconds. Default is 180, i.e. 3 minutes.
    # 0 = disable timer, i.e. stay discoverable forever
    DiscoverableTimeout = 0
    # How long to stay in pairable mode before going back to non-discoverable
    # The value is in seconds. Default is 0.
    # 0 = disable timer, i.e. stay pairable forever
    PairableTimeout = 0
    # Use some other page timeout than the controller default one
    # which is 16384 (10 seconds).
    PageTimeout = 8192
    # Automatic connection for bonded devices driven by platform/user events.
    # If a platform plugin uses this mechanism, automatic connections will be
    # enabled during the interval defined below. Initially, this feature
    # intends to be used to establish connections to ATT channels.
    AutoConnectTimeout = 60
    # What value should be assumed for the adapter Powered property when
    # SetProperty(Powered, ...) hasn't been called yet. Defaults to true
    InitiallyPowered = true
    # Remember the previously stored Powered state when initializing adapters
    RememberPowered = true
    # Use vendor id source (assigner), vendor, product and version information for
    # DID profile support. The values are separated by ":" and assigner, VID, PID
    # and version.
    # Possible vendor id source values: bluetooth, usb (defaults to usb)
    #DeviceID = bluetooth:1234:5678:abcd
    # Do reverse service discovery for previously unknown devices that connect to
    # us. This option is really only needed for qualification since the BITE tester
    # doesn't like us doing reverse SDP for some test cases (though there could in
    # theory be other useful purposes for this too). Defaults to true.
    ReverseServiceDiscovery = true
    # Enable name resolving after inquiry. Set it to 'false' if you don't need
    # remote devices name and want shorter discovery cycle. Defaults to 'true'.
    NameResolving = true
    # Enable runtime persistency of debug link keys. Default is false which
    # makes debug link keys valid only for the duration of the connection
    # that they were created for.
    DebugKeys = false
    # Enable the GATT functionality. Default is false
    EnableGatt = false

    If there appears to be problems with a Bluetooth connection, ensure there is no interference. Also, ensure that the Bluetooth service is running by executing "systemctl status bluetooth" if the Linux distro uses systemd. Also remember that some Bluetooth devices are integrated with the WiFi card, so if the WiFi is turned off (via a hardware switch) turn the WiFi card on.

    Further Reading

Viewing 1 post (of 1 total)