bluez5: Não é possível conectar-se a um dispositivo bluetooth emparelhado no Ubuntu 17.10

4

Estou usando o bluez v5.46 no Ubuntu 17.10 e não consigo me conectar a um dispositivo bluetooth emparelhado.

Aqui está a saída do comando bluetoothctl :

$ bluetoothctl 
[NEW] Controller 6C:0B:84:27:43:66 tensorFlowPHY [default]
Agent registered
[bluetooth]# scan on
Discovery started
[CHG] Controller 6C:0B:84:27:43:66 Discovering: yes
[NEW] Device FC:58:FA:A1:C2:70 OE-P51
[bluetooth]# trust FC:58:FA:A1:C2:70
[CHG] Device FC:58:FA:A1:C2:70 Trusted: yes
Changing FC:58:FA:A1:C2:70 trust succeeded
[bluetooth]# pair FC:58:FA:A1:C2:70 
Attempting to pair with FC:58:FA:A1:C2:70
[CHG] Device FC:58:FA:A1:C2:70 Connected: yes
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 00001101-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 00001108-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 ServicesResolved: yes
[CHG] Device FC:58:FA:A1:C2:70 Paired: yes
Pairing successful
[CHG] Device FC:58:FA:A1:C2:70 ServicesResolved: no
[CHG] Device FC:58:FA:A1:C2:70 Connected: no
[CHG] Controller 6C:0B:84:27:43:66 Discoverable: no
[bluetooth]# connect FC:58:FA:A1:C2:70 
Attempting to connect to FC:58:FA:A1:C2:70
Failed to connect: org.bluez.Error.Failed

Aqui está um pouco mais de informação:

$ journalctl -u bluetooth | tail
Mar 29 12:06:01 tensorFlowPHY systemd[1]: Started Bluetooth service.
Mar 29 12:06:01 tensorFlowPHY bluetoothd[1136]: Starting SDP server
Mar 29 12:06:01 tensorFlowPHY bluetoothd[1136]: Bluetooth management interface 1.14 initialized
Mar 29 14:36:12 tensorFlowPHY bluetoothd[1136]: a2dp-sink profile connect failed for FC:58:FA:A1:C2:70: Protocol not available
Mar 29 14:36:59 tensorFlowPHY bluetoothd[1136]: a2dp-sink profile connect failed for FC:58:FA:A1:C2:70: Protocol not available

E systemctl diz:

$ systemctl status bluetooth
● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2018-03-30 16:30:15 CEST; 21s ago
     Docs: man:bluetoothd(8)
 Main PID: 1492 (bluetoothd)
   Status: "Running"
    Tasks: 1 (limit: 4915)
   Memory: 1.5M
      CPU: 42ms
   CGroup: /system.slice/bluetooth.service
           └─1492 /usr/lib/bluetooth/bluetoothd

Mar 30 16:30:15 tensorFlowPHY systemd[1]: Starting Bluetooth service...
Mar 30 16:30:15 tensorFlowPHY bluetoothd[1492]: Bluetooth daemon 5.46
Mar 30 16:30:15 tensorFlowPHY systemd[1]: Started Bluetooth service.
Mar 30 16:30:15 tensorFlowPHY bluetoothd[1492]: Starting SDP server
Mar 30 16:30:15 tensorFlowPHY bluetoothd[1492]: Bluetooth management interface 1.14 initialized
Mar 30 16:30:20 tensorFlowPHY bluetoothd[1492]: a2dp-sink profile connect failed for FC:58:FA:A1:C2:70: Protocol not available
Mar 30 16:30:31 tensorFlowPHY bluetoothd[1492]: a2dp-sink profile connect failed for FC:58:FA:A1:C2:70: Protocol not available

EDIT 1: Eu instalei um pacote do Ubuntu que estava faltando: pulseaudio-module-bluetooth e reiniciei o pulseaudio com o comando: pulseaudio -k

Agora, a saída do registro bluetooth após o teste de conexão é:

Mar 30 16:36:59 tensorFlowPHY bluetoothd[1492]: Unable to get connect data for Headset Voice gateway: getpeername: Transport endpoint is not connected (107)
Mar 30 16:37:00 tensorFlowPHY bluetoothd[1492]: connect error: Connection refused (111)
Mar 30 16:37:02 tensorFlowPHY bluetoothd[1492]: connect error: Connection refused (111)

Alguma ideia do porquê?

EDIT 2: Acabei de reiniciar o Ubuntu como alguém pediu para fazer. Ainda tem o mesmo pb.

EDIT 3: Eu já tenho os dois módulos carregados em /etc/pulse/default.pa :

$ egrep "(policy|discover)" /etc/pulse/default.pa
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover

Mas não consigo encontrá-los no disco rígido, preciso instalar outra coisa?

EDIT 4: Meu erro, eu usei o comando locate . Depois de um sudo updatedb , o comando locate pode agora encontrar esses 2 arquivos.

EDIT 5: Aqui está a saída pactl :

$ pactl list modules | grep "Name:"
    Name: module-device-restore
    Name: module-stream-restore
    Name: module-card-restore
    Name: module-augment-properties
    Name: module-switch-on-port-available
    Name: module-udev-detect
    Name: module-alsa-card
    Name: module-alsa-card
    Name: module-bluetooth-policy
    Name: module-bluetooth-discover
    Name: module-bluez5-discover
    Name: module-native-protocol-unix
    Name: module-default-device-restore
    Name: module-rescue-streams
    Name: module-always-sink
    Name: module-intended-roles
    Name: module-suspend-on-idle
    Name: module-console-kit
    Name: module-systemd-login
    Name: module-position-event-sounds
    Name: module-role-cork
    Name: module-filter-heuristics
    Name: module-filter-apply
    Name: module-switch-on-connect
    Name: module-x11-publish
    Name: module-x11-cork-request
    Name: module-x11-xsmp

e a dpkg -l output:

$ dpkg -l | grep blue
ii  bluefish                                  2.2.9-1                                                    amd64        advanced Gtk+ text editor for web and software development
ii  bluefish-data                             2.2.9-1                                                    all          advanced Gtk+ text editor (data)
ii  bluefish-plugins                          2.2.9-1                                                    amd64        advanced Gtk+ text editor (plugins)
ii  blueman                                   2.0.4-1ubuntu3                                             amd64        Graphical bluetooth manager
ii  bluez                                     5.46-0ubuntu3                                              amd64        Bluetooth tools and daemons
ii  bluez-cups                                5.46-0ubuntu3                                              amd64        Bluetooth printer driver for CUPS
ii  bluez-obexd                               5.46-0ubuntu3                                              amd64        bluez obex daemon
ii  bluez-tools                               0.2.0~20140808-5build1                                     amd64        Set of tools to manage Bluetooth devices for linux
ii  gnome-bluetooth                           3.26.1-1                                                   amd64        GNOME Bluetooth tools
ii  indicator-bluetooth                       0.0.6+17.10.20170605-0ubuntu3                              amd64        System bluetooth indicator.
ii  libbluetooth3:amd64                       5.46-0ubuntu3                                              amd64        Library to use the BlueZ Linux Bluetooth stack
ii  libgnome-bluetooth13:amd64                3.26.1-1                                                   amd64        GNOME Bluetooth tools - support library
ii  pulseaudio-module-bluetooth               1:10.0-2ubuntu3.1                                          amd64        Bluetooth module for PulseAudio sound server

EDIT 6: Sua solução funcionou! Então, para resumir:

$ bluetoothctl
[bluetooth]# remove FC:58:FA:A1:C2:70
[DEL] Device FC:58:FA:A1:C2:70 OE-P51
Device has been removed
[bluetooth]# exit
Agent unregistered
[DEL] Controller 6C:0B:84:27:43:66 tensorFlowPHY [default]
$ sudo service bluetooth restart

e finalmente:

$ bluetoothctl
[NEW] Controller 6C:0B:84:27:43:66 tensorFlowPHY [default]
Agent registered
[bluetooth]# scan on
Discovery started
[CHG] Controller 6C:0B:84:27:43:66 Discovering: yes
[NEW] Device FC:58:FA:A1:C2:70 OE-P51
[bluetooth]# trust FC:58:FA:A1:C2:70 
[CHG] Device FC:58:FA:A1:C2:70 Trusted: yes
Changing FC:58:FA:A1:C2:70 trust succeeded
[bluetooth]# pair FC:58:FA:A1:C2:70 
Attempting to pair with FC:58:FA:A1:C2:70
[CHG] Device FC:58:FA:A1:C2:70 Connected: yes
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 00001101-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 00001108-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 ServicesResolved: yes
[CHG] Device FC:58:FA:A1:C2:70 Paired: yes
Pairing successful
[CHG] Device FC:58:FA:A1:C2:70 ServicesResolved: no
[CHG] Device FC:58:FA:A1:C2:70 Connected: no
[bluetooth]# connect FC:58:FA:A1:C2:70 
Attempting to connect to FC:58:FA:A1:C2:70
[CHG] Device FC:58:FA:A1:C2:70 Connected: yes
Connection successful
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 00001101-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 00001108-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 ServicesResolved: yes
[OE-P51]#
    
por SebMa 29.03.2018 / 14:48

1 resposta

3

De Arch wiki , o emparelhamento funciona, mas a conexão não seção:

This may be due to the pulseaudio-bluetooth package not being installed. Install it if it missing, then restart pulseaudio.

Mas pulseaudio-bluetooth nome do pacote é pulseaudio-module-bluetooth no Ubuntu.

Portanto, seu problema deve ser resolvido após a instalação:

sudo apt install pulseaudio-module-bluetooth

E depois de instalar este pacote reinicie o seu sistema para carregar alguns módulos de áudio de pulso como module-bluetooth-policy e module-bluetooth-discover .

Atualização:

Mas, se ainda assim, você receberá uma mensagem abaixo após a reinicialização:

connect error: Connection refused (111)

De acordo com esta resposta, você deve adicionar essas linhas ao arquivo /etc/pulse/default.pa . (Se não existir):

load-module module-bluetooth-policy
load-module module-bluetooth-discover

Mas essas linhas devem existir por padrão e depois de reiniciar o sistema, esses módulos devem ser carregados.

Update2:

De acordo com este artigo no wiki do Arch:

This may be because you have already paired the device with another operating system using the same bluetooth adapter (e.g., dual-booting). Some devices can't handle multiple pairings associated with the same MAC address (i.e., bluetooth adapter). You can fix this by re-pairing the device

Por favor, re-emparelhe seu dispositivo com estes comandos (ou você pode usar o método GUI):

Primeira execução:

bluetoothctl

Em seguida, use esses comandos para mostrar dispositivos pareados:

devices

E isso deve ter alguma saída como esta:

Device XX:XX:XX:XX:XX:XX Device Name

Em seguida, remova dispositivos emparelhados com este comando:

remove XX:XX:XX:XX:XX:XX

E reinicie o serviço Bluetooth:

sudo service bluetooth restart

Em seguida, tente emparelhar o dispositivo novamente.

    
por Ali Razmdideh 30.03.2018 / 16:42