Debian Jessie and Bluetooth

The bluetooth utils under Debian Jessie is different to previous releases. Most of the guides floating about no longer appear to apply - at least some of the key utils are no longer available. So here’s a simple guide to bluetooth on Debian Jessie. I will be using a Logitech mouse as the target device and will be pairing it with a laptop.

Oh! This is all going to be via the commandline (naturally).

Install some Packages and Start some Services

We just need one package as far a I am aware…

  1. The main bluetooth CLI package

    $ apt-get install bluez
    
  2. Start up the bluetooth daemon

    $ /etc/init.d/bluetooth start
    
  3. Set the bluetooth service to start at boot

    $ update-rc.d bluetooth enable
    

Find your bluetooth

Next we go and find our devices.

  1. Enter the bluetoothctl shell, as root

    $ bluetoothctl
    [bluetooth]# help
    Available commands:
      list                       List available controllers
      show [ctrl]                Controller information
      select <ctrl>              Select default controller
      devices                    List available devices
      paired-devices             List paired devices
      power <on/off>             Set controller power
      pairable <on/off>          Set controller pairable mode
      discoverable <on/off>      Set controller discoverable mode
      agent <on/off/capability>  Enable/disable agent with given capability
      default-agent              Set agent as the default one
      scan <on/off>              Scan for devices
      info <dev>                 Device information
      pair <dev>                 Pair with device
      trust <dev>                Trust device
      untrust <dev>              Untrust device
      block <dev>                Block device
      unblock <dev>              Unblock device
      remove <dev>               Remove device
      connect <dev>              Connect device
      disconnect <dev>           Disconnect device
      version                    Display version
      quit                       Quit program
    
  2. Make sure you actually have a visible bluetooth controllor, the below is for my laptop

    [bluetooth]# list
    Controller 20:16:D8:98:67:38 MYLAPTOP-0 [default]
    
  3. Start scanning for available devices to pair with. You may or may not see multiple devices depending on people nearby. Not the MAC address which is used to identify your device, which in this case is 00:1F:20:D4:DF:58 You may need to press some magic buttons on your target device to get it to actually broadcast itself out so we can see it. My mouse has a CONNECT button on the bottom that does just that.

    [bluetooth]# scan on
    Discovery started
    [CHG] Controller 20:16:D8:98:67:38 Discovering: yes
    ...
    [NEW] Device 00:1F:20:D4:DF:58 00-1F-20-D4-DF-58
    [CHG] Device 00:1F:20:D4:DF:58 LegacyPairing: no
    [CHG] Device 00:1F:20:D4:DF:58 Name: Bluetooth Mouse M558
    [CHG] Device 00:1F:20:D4:DF:58 Alias: Bluetooth Mouse M558
    
  4. So 00:1F:20:D4:DF:58 appears to be my mouse, lets trust it!

    [bluetooth]# trust 00:1F:20:D4:DF:58
    [CHG] Device 00:1F:20:D4:DF:58 Trusted: yes
    Changing 00:1F:20:D4:DF:58 trust succeeded
    [CHG] Device 00:1F:20:D4:DF:58 LegacyPairing: yes
    [CHG] Device 00:1F:20:D4:DF:58 RSSI: -69
    
  5. Lets pair the mouse with my laptop

    [bluetooth]# pair 00:1F:20:D4:DF:58
    Attempting to pair with 00:1F:20:D4:DF:58
    [CHG] Device 00:1F:20:D4:DF:58 Connected: yes
    [CHG] Device 00:1F:20:D4:DF:58 Modalias: usb:v046DpB011d1010
    [CHG] Device 00:1F:20:D4:DF:58 UUIDs:
            00001000-0000-1000-8000-00805f9b34fb
            00001124-0000-1000-8000-00805f9b34fb
            00001200-0000-1000-8000-00805f9b34fb
    [CHG] Device 00:1F:20:D4:DF:58 Paired: yes
    Pairing successful
    [CHG] Device 00:1F:20:D4:DF:58 Connected: no
    
  6. At this point wiggling the mouse didn’t do much. Still more to do - we apparently need to connect it next (hints as much above)

    [bluetooth]# connect 00:1F:20:D4:DF:58
    Attempting to connect to 00:1F:20:D4:DF:58
    [CHG] Device 00:1F:20:D4:DF:58 Connected: yes
    Connection successful
    
  7. Success! Mouse wiggle causes cursor to move. Quit and enjoy!

    [bluetooth]# quit