PulseAudio가 카드 프로파일을 ‘a2dp_sink’로 설정하지 못했습니다. 로그를보고 무엇이 잘못되었는지 어떻게 알 수 있습니까? = “/org/bluez/hci0/dev_50_C9_71_97_A1_86”

나는 현재 ubuntu 16.04를 설치했으며 a2dp는 새로 설치하는 데 사용되었으며 마지막 옵션으로 남겨두기를 선호합니다. 페어링이 블루투스 설정에서 지워지고 다시 페어링되면 때로는 a2dp 프로파일에있을 수 있지만 헤드셋의 연결이 끊어졌다가 다시 연결되면 a2dp 프로파일이 더 이상 작동하지 않습니다 (a2dp에 있음). HSP / HSF로 전환 한 후 a2dp에서 설정할 수 없습니다.

나는 노력했다 :

 pacmd set-card-profile <index> a2dp_sink

그러나 다음과 같은 오류가 발생합니다.

"Failed to set card profile to 'a2dp_sink'"

Linux에서 경험이 부족하여 로그를 얻는 방법이나 찾을 내용을 모르겠지만 pacmd list-cards에서 얻었습니다.

작동 할 때 :

name: <bluez_card.50_C9_71_97_A1_86>
driver: <module-bluez5-device.c>
owner module: 27
properties:
    device.description = "Jabra REVO a4.0.0"
    device.string = "50:C9:71:97:A1:86"
    device.api = "bluez"
    device.class = "sound"
    device.bus = "bluetooth"
    device.form_factor = "headset"
    bluez.path = "/org/bluez/hci0/dev_50_C9_71_97_A1_86"
    bluez.class = "0x240404"
    bluez.alias = "Jabra REVO a4.0.0"
    device.icon_name = "audio-headset-bluetooth"
    device.intended_roles = "phone"
profiles:
    headset_head_unit: Headset Head Unit (HSP/HFP) (priority 20, available: unknown)
    a2dp_sink: High Fidelity Playback (A2DP Sink) (priority 10, available: unknown)
    off: Off (priority 0, available: yes)
active profile: <a2dp_sink>
sinks:
    bluez_sink.50_C9_71_97_A1_86/#6: Jabra REVO a4.0.0
sources:
    bluez_sink.50_C9_71_97_A1_86.monitor/#10: Monitor of Jabra REVO a4.0.0
ports:
    headset-output: Headset (priority 0, latency offset 0 usec, available: unknown)
        properties:

    headset-input: Headset (priority 0, latency offset 0 usec, available: unknown)
        properties:

그렇지 않은 경우 :

name: <bluez_card.50_C9_71_97_A1_86>
driver: <module-bluez5-device.c>
owner module: 25
properties:
    device.description = "Jabra REVO a4.0.0"
    device.string = "50:C9:71:97:A1:86"
    device.api = "bluez"
    device.class = "sound"
    device.bus = "bluetooth"
    device.form_factor = "headset"
    bluez.path = "/org/bluez/hci0/dev_50_C9_71_97_A1_86"
    bluez.class = "0x240404"
    bluez.alias = "Jabra REVO a4.0.0"
    device.icon_name = "audio-headset-bluetooth"
    device.intended_roles = "phone"
profiles:
    headset_head_unit: Headset Head Unit (HSP/HFP) (priority 20, available: unknown)
    a2dp_sink: High Fidelity Playback (A2DP Sink) (priority 10, available: yes)
    off: Off (priority 0, available: yes)
active profile: <off>
ports:
    headset-output: Headset (priority 0, latency offset 0 usec, available: yes)
        properties:

    headset-input: Headset (priority 0, latency offset 0 usec, available: unknown)
        properties:

소유 모듈은 다음과 같습니다.

name: <module-bluez5-device>
argument: <path=/org/bluez/hci0/dev_50_C9_71_97_A1_86>
used: 0
load once: no
properties:
    module.author = "João Paulo Rechi Vita"
    module.description = "BlueZ 5 Bluetooth audio sink and source"
    module.version = "8.0"

이미 /etc/bluetooth/audio.conf를 수정하고 blueman을 설치하려고 시도했지만 작동하지 않았습니다. 또한 bluez 및 pulseaudio를 다시 설치하려고 시도했지만 아무것도 변경되지 않았습니다.

무엇이 잘못되었는지 알고 고칠 수있는 방법이 있습니까?



답변

“활성 프로파일 : <off>”라인을 기준으로 사운드 프로파일이 활성화되지 않았습니다.

프로파일을 변경하는 데 사용하기 쉬운 프로그램은 pavucontrol입니다. 로 설치할 수 있습니다 sudo apt install pavucontrol -y. 그런 다음 명령 줄에서 pavucontrol을 실행하거나 Kubuntu에 있고 pavucontrol을 입력 한 경우 Alt + F2를 실행하십시오.

구성 탭을 선택한 다음 헤드폰의 프로필을 변경하고 업데이트가 있는지 확인하십시오. 리눅스에서 블루투스 a2dp에 버그가있는 것으로 보이며 16.04 설치 중 두 가지에 영향을 미칩니다. A2DP가 이미 OFF로 변경했다면 블루투스 애플릿에서 장치를 분리했다가 다시 연결하십시오. 그런 다음 마지막으로 프로파일을 A2DP로 다시 변경하면 제대로 작동합니다.

명령 행에서 다음을 시도해 볼 수 있으며 대부분의 탭을 완성해야합니다. 아래의 두 pacmd 명령 모두에 대해 숫자 2를 현재 색인 번호로 바꾸십시오.

pacmd set-card-profile 2 off
bluetoothctl
disconnect 50:C9:71:97:A1:86
connect 50:C9:71:97:A1:86
pacmd set-card-profile 2 a2dp_sink

프로파일을 껐다가 다시 a2dp로 순환하지만 블루투스 장치의 연결을 끊지 않고 연결하는 것과 같은 일을하는보다 복잡하지만 자동화 된 방법

index=`pacmd list-cards | grep bluez_card -B1 | grep index | awk '{print $2}'`;pacmd set-card-profile $index off; pacmd set-card-profile $index a2dp_sink

나는 또한 작동하지만 부주의 한 스크립트를 만들어 같은 일을하지만 블루투스 헤드폰을 분리했다가 다시 연결해야했습니다. 장치의 연결을 끊었다가 다시 연결할 때마다 색인이 변경되므로 프로파일 색인을 가져옵니다. 위에 나열된 헤드셋의 장치 ID로 하드 코드되어 있습니다.

pacmd set-card-profile `pacmd list-cards | grep bluez_card -B1 | grep index | awk '{print $2}'` off; sleep 2 ; echo -e "disconnect 50:C9:71:97:A1:86\n quit"|bluetoothctl;sleep 5; echo -e "connect 50:C9:71:97:A1:86\n quit"|bluetoothctl; sleep 5; pacmd set-card-profile `pacmd list-cards | grep bluez_card -B1 | grep index | awk '{print $2}'` a2dp_sink

테스트 중에 장치가 아직 오디오 프로파일을 변경할 준비가되지 않았기 때문에 3 대신 5 초 동안 절전 모드로 전환되었습니다. 결과는 몇 초 +/- 5 초 정도 다를 수 있습니다. 잠재적 인 함정에 관한 편집. 작동하기 전에 더 큰 스크립트를 두 번 실행해야하는 경우가 있음을 알게되었습니다. 수면 시간을 늘리면 테스트하지 않은 것이 도움이 될지 확실하지 않습니다. 그러나 나는 동일한 브랜드의 BT 헤드폰을 가진 두 대의 컴퓨터에서 그것을 사용했으며 헤드폰에서 사운드가 작동하도록 프로세스를 자동화하기 위해해야 ​​할 일을하고 있습니다.

결국이 문제는 블루투스 패키지에 패치 될 예정이지만 새로운 버전의 우분투와 다른 Linux 버전에서는 계속해서 돌아 오는 것 같습니다. 그러나 어쨌든 당신에게 도움이되기를 바랍니다.


답변

시스템이 A2DP 싱크로 감지되도록하려면 (예 : 컴퓨터 스피커를 통해 휴대 전화에서 음악을 재생하는 경우) Enable=Source,Sink,Media,Socket아래 [General]에를 추가하십시오 /etc/bluetooth/audio.conf.

이 작업을 수행 한 후 블루투스 데몬을 다시 시작하십시오.

systemctl restart bluetooth

헤드폰 장치 연결

bluetoothctl
connect <MAC>

카드 확인 및 프로필 설정

pacmd list-cards
pacmd set-card-profile <index> <profile>


답변

Ubuntu 16.04.1 LTS 에서이 문제가 발생했으며 https://wiki.debian.org/BluetoothUser/a2dp에 있는 GDM 해결 방법을 적용하면 해결되었습니다.

구체적으로, 다음 /var/lib/gdm3/.config/pulse/client.conf과 같이 읽고 편집하십시오 :

autospawn = no
daemon-binary = /bin/true

그때

sudo chown gdm:gdm /var/lib/gdm3/.config/pulse/client.conf

나는 또한 추가했다 /etc/pulse/default.pa

load-module module-switch-on-connect

꼭 필요한 것은 아니지만

재부팅 후 블루투스 관리자를 통해 연결된 오디오 프로필을으로 성공적으로 전환 할 수있었습니다 a2dp_sink.


답변

lagerismiJamie S의 답변따라 런치 패드에 스크립트를 게시했습니다 .

  • 스크립트 내의 변수에서 장치 MAC 주소를 변경하십시오! ( bluetoothctl-> 장치 에서 찾을 수 있습니다 )

  • 스크립트를 실행 가능하게 만들기 chmod a-x bluetooth_headphone_reactivation.sh

시작시 자동 실행 (헤드셋이 이미 켜져있는 경우에만 작동) :

  • KDE 제어판의 시작 / 종료 스크립트에 스크립트 추가

빠른 수동 실행 :

  • 애플리케이션 스타터에 항목을 추가하십시오 ( “CTRL + ALT + H”와 같은 키보드 단축키를 설정하거나이 스타터를 창 표시 줄에 고정 할 수도 있습니다)

스크립트 :

#!/bin/sh
device_mac='<your-devices-mac-address-here>'
pacmd set-card-profile `pacmd list-cards | grep bluez_card -B1 | grep index | awk '{print $2}'` off
sleep 2
echo "disconnect $device_mac\n quit"|bluetoothctl
sleep 5
echo "connect $device_mac\n quit"|bluetoothctl
sleep 5
pacmd set-card-profile `pacmd list-cards | grep bluez_card -B1 | grep index | awk '{print $2}'` a2dp_sink


답변

Xubuntu 16.04.2에서
blueman-manager를 사용하십시오 :

  1. 연결-> 프로파일 끄기
  2. 다시 연결-> 프로파일 a2dp 설정
  3. 이제 헤드셋이 정상입니다!

내 JBL bash 스크립트

#!/bin/bash
#headset mac
mac="00:1D:DF:67:0A:29"
profile="a2dp"
# Special Bluetooth controller, default is empty
btMac=""
#connect|disconnect wait time
waitTime=5

macId="${mac//:/_}"
deviceId="bluez_card.$macId"

declare -A profiles
profiles['a2dp']='a2dp_sink'
profiles['hsp']='headset_head_unit'
profiles['off']='off'

function btCmd() {
    cmd="$1\nquit"
    [ ! -z "$btMac" ] && cmd="select $btMac\n$cmd"
    echo -e "$cmd" | bluetoothctl
}
function setProfile() {
    cmd="pactl set-card-profile $deviceId ${profiles[$1]}"
    echo $cmd
    $cmd
}
function btWaitConnect() {
    conState=$1
    for ((i=1;i<=$waitTime;++i)); do
        tmp="`btCmd "info $mac"|grep 'Connected: '`"
        [ ! -z "`echo "$tmp"|grep $conState`" ] && echo "$tmp" && return 0
        sleep 1s
    done
    echo "$tmp"
    return 1
}
function btConnect() {
    tmp="`btCmd "trust $mac\nconnect $mac" | grep -v 'NEW\|DEL\| quit'`"
    echo "$tmp"

    tmp="`btWaitConnect yes`"
    echo $tmp
    [ -z "`echo "$tmp" | grep yes`" ] && echo -e "Device $mac:\n\tConnected: fail." && return 1
    sleep 2s
    return 0
}
function btDisConnect() {
    tmp="`btCmd "disconnect $mac" | grep -v 'NEW\|DEL\| quit'`"
    echo "$tmp"

    tmp="`btWaitConnect no`"
    echo $tmp
    [ -z "`echo "$tmp" | grep no`" ] && echo -e "Device $mac:\n\tdisconnected: fail." && return 1
    sleep 1s
    return 0
}


# controller
echo ""
btCtls="`btCmd list | grep '^Controller' | grep " $btMac"`"
echo -e "controller:\n$btCtls"
[ -z "$btCtls" -o ! -z "`echo "$btCtls" | grep "not available"`" ] && exit 1


# connect -> set off
echo ""
tmp="`btCmd paired-devices | grep '^Device' | grep " $mac"`"
echo -e "paired-devices:\n$tmp"
[ `echo "$tmp" | wc -l` != 1 ] && echo "Please pair the Bluetooth headset first: $mac" && exit 1
btConnect || exit $?
setProfile off

# reconnect -> set profile
btDisConnect || exit $?
btConnect || exit $?
setProfile $profile


답변

따라서 데비안을 사용하는 경우 다음을 수행 할 수 있습니다. 프로파일을 a2dp_sink로 전환하기 위해 거부 됨 : 연결되지 않음

문제

Bluetooth 헤드셋이 연결되어 있지만 ALSA / PulseAudio가 연결된 장치를 픽업하지 못하거나 선택할 장치가 없습니다. 이는 GDM이 접근성을 위해 gdm 세션에서 펄스 오디오를 필요로하기 때문에 GDM이 세션 시작시 A2DP 싱크를 캡처하기 때문에 발생합니다. 예를 들어 스크린 리더에 필요합니다.

해결책

세션 시작시 GDM이 A2DP 싱크를 캡처하지 못하게하려면 편집 /var/lib/gdm3/.config/pulse/client.conf(또는 존재하지 않는 경우 작성)하십시오.

autospawn = no
daemon-binary = /bin/true

그런 다음이 파일에 대한 액세스 권한을 Debian-gdm 사용자에게 부여해야합니다.

chown Debian-gdm:Debian-gdm /var/lib/gdm3/.config/pulse/client.conf

pulseaudio 시작을 비활성화해야합니다.

rm /var/lib/gdm3/.config/systemd/user/sockets.target.wants/pulseaudio.socket

일부 장치의 a2dp를 자동 연결하려면 다음을 추가하십시오 /etc/pulse/default.pa.

load-module module-switch-on-connect

재부팅하십시오.


답변

이전 답변이 실제로 문제의 근본 원인을 해결하려고합니다. 그러나 나는 그들 중 누구도 일할 수 없었습니다. 나는 OP와 똑같은 문제가 있었지만 Linux Mint 17/18에서. 블루투스를 안정적으로 연결하고 a2dp를 사용하기 위해이 스크립트 를 작성 했습니다 .

후손을 위해 복사 / 붙여 넣었지만 문제는 UI에서 OP (및 I) 가해 야 할 일을 정확하게 복제한다는 것입니다.

Dominik의 스크립트는 모든 것을 설정하기 위해 한 번만 시도하기 때문에 안정적으로 작동하지 않습니다 . 작동하려면 여러 번 실행해야합니다. 이것은 내가 결국 끝내고 매번 작동합니다.

#!/bin/bash

MAC=$1
CARD=$(echo "${MAC}" | sed -e 's/:/_/g')
CARD="bluez_card.${CARD}"

$(pactl list | grep -qi 'Active Profile: a2dp_sink')
a2dpUsed=$?

# this loops until a2dp is _actually used_ on the given MAC.
while [ ${a2dpUsed} -ne 0 ];
do
    #
    echo "Restarting bluetooth."
    rfkill unblock bluetooth
    sudo service bluetooth restart
    sudo hciconfig hci0 up

    # reconnect
    echo -e "power on\nconnect ${MAC}" | bluetoothctl

    #
    echo "Waiting for headset to be connected..."
    btConnected=1

    while [ ${btConnected} -gt 0 ];
    do

        sleep .1
        $(bluetoothctl <<< "info ${MAC}" | grep -qi "Connected: yes")
        btConnected=$?
    done

    #
    echo "Bluetooth connected, waiting for profiles to register"

    cardFound=1
    while [ ${cardFound} -ne 0 ];
    do
        $(pactl list | grep -qi "${CARD}")
        cardFound=$?
    done

    #
    echo "Setting bluetooth a2dp profile"
    pactl set-card-profile ${CARD} a2dp_sink
    $(pactl list | grep -qi 'Active Profile: a2dp_sink')
    a2dpUsed=$?
done

echo "a2dp is working."