2024年11月24日星期日 上午10:00:49

bluetooth speaker is silent Checklist

2 年 前
#3703 引用
sudo systemctl status Bluetooth


root@raspberrypi:~# sudo systemctl status bluetooth
● bluetooth.service - Bluetooth service
     Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-03-28 04:07:18 CST; 1 day 3h ago
       Docs: man:bluetoothd(8)
   Main PID: 988 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 2200)
     Memory: 728.0K
        CPU: 322ms
     CGroup: /system.slice/bluetooth.service
             └─988 /usr/libexec/bluetooth/bluetoothd

3月 28 04:07:18 raspberrypi bluetoothd[988]: src/main.c:check_config() Unknown group Controller in /etc/bluetooth/main.conf
3月 28 04:07:18 raspberrypi systemd[1]: Started Bluetooth service.
3月 28 04:07:18 raspberrypi bluetoothd[988]: Starting SDP server
3月 28 04:07:18 raspberrypi bluetoothd[988]: Bluetooth management interface 1.14 initialized
3月 28 04:07:18 raspberrypi bluetoothd[988]: src/adapter.c:reset_adv_monitors_complete() Failed to reset Adv Monitors: Unknown Command (0x01)
3月 28 04:07:30 raspberrypi bluetoothd[988]: src/service.c:btd_service_connect() a2dp-sink profile connect failed for 9A:07:65:B4:21:EC: Protocol >
3月 28 04:07:35 raspberrypi bluetoothd[988]: src/service.c:btd_service_connect() a2dp-sink profile connect failed for 9A:07:65:B4:21:EC: Protocol >
3月 28 04:07:50 raspberrypi bluetoothd[988]: src/service.c:btd_service_connect() a2dp-sink profile connect failed for 9A:07:65:B4:21:EC: Protocol >
3月 28 04:23:13 raspberrypi bluetoothd[988]: Endpoint registered: sender=:1.24 path=/MediaEndpoint/A2DPSink/sbc
3月 28 04:23:13 raspberrypi bluetoothd[988]: Endpoint registered: sender=:1.24 path=/MediaEndpoint/A2DPSource/sbc


0
2 年 前
#3704 引用
Now turn on Bluetooth on the device you want to connect to your Arch Linux machine and make sure Discoverable or Visibility is turned on on that device.
0
2 年 前
#3705 引用



root@raspberrypi:~# hciconfig -a
hci0:  Type: Primary  Bus: UART
  BD Address: B8:27:EB:2A:96:FA  ACL MTU: 1021:8  SCO MTU: 64:1
  UP RUNNING PSCAN ISCAN
  RX bytes:70009 acl:98 sco:0 events:5907 errors:0
  TX bytes:6422954 acl:10123 sco:0 commands:409 errors:0
  Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87
  Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
  Link policy: RSWITCH SNIFF
  Link mode: SLAVE ACCEPT
  Name: 'raspberrypi'
  Class: 0x2c0000
  Service Classes: Rendering, Capturing, Audio
  Device Class: Miscellaneous,
  HCI Version: 4.1 (0x7)  Revision: 0x0
  LMP Version: 4.1 (0x7)  Subversion: 0x2209
  Manufacturer: Broadcom Corporation (15)


0
2 年 前
#3706 引用


hciconfig - HCI device configuration utility
hciconfig hciX
[up Open and initialize HCI device
|down Close HCI device
|reset Reset HCI device
|rstat] Reset stat conters
|auth Enable Authentication
|noauth Disable Authentication
|encrypt Enable Encryption
|noencrypt Disable Encryption
|piscan Set page scan and inquiry scan mode
|noscan Disable scan modes
|iscan Set inquiry scan mode only
|pscan Set page scan mode only
|inq [length] Inquiry of devices
|ptype [type] Set packet type
|lm [mode] Get/Set default link mode
|lp [policy] Get/Set default link policy
|conn Show active connections
|features Show features
|name [name] Get/Set local name
|class [class] Get/Set class of device
|version Display version information








hciconfig hci0 up  #启动蓝牙设备
hciconfig hci0 down #关闭蓝牙设备

hciconfig hci0 lm ACCEPT,MASTER


hcitool scan        #进行蓝牙扫描
hcitool lescan        #低功耗蓝牙扫描

sudo hciconfig hci0 iscan #配置蓝牙适配器使得能被其他设备搜索到:



l2ping -i hci0 -c 4 24:1F:A0:CE:50:69 # 测试蓝牙A2:CF:49:FD:99:AF是否连通




hcitool lescan扫描到Yeelight的灯泡

root@raspberrypi:~# hcitool lescan

output



root@raspberrypi:~# hcitool lescan
LE Scan ...

84:BA:20:53:E6:B7 (unknown)
84:BA:20:53:E6:B7 AQARA_E6B7
68:63:2A:9F:7F:E6 (unknown)
6F:2E:0B:D3:72:82 (unknown)
CC:B5:D1:AB:6C:D9 yeelink.light.mbulb3  米家蓝牙mesh led灯泡 (设备在线
CC:B5:D1:B7:76:3C (unknown)
CC:B5:D1:B7:76:3C yeelink.light.ml1
EC:4D:3E:8D:EF:51 (unknown)





== 米家蓝牙mesh led灯泡 (设备在线 ) ==
  Model: yeelink.light.mbulb3

Yeelight m2筒灯 (设备在线 ) ==
  Model: yeelink.light.ml1





0
2 年 前
#3707 引用




[bluetooth]# show
Controller B8:27:EB:2A:96:FA (public)
  Name: raspberrypi
  Alias: raspberrypi
  Class: 0x002c0000
  Powered: yes
  Discoverable: yes
  DiscoverableTimeout: 0x000000b4
  Pairable: yes
  UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
  UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
  UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
  UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
  UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
  UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
  UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
  UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
  UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
  UUID: Headset AG                (00001112-0000-1000-8000-00805f9b34fb)
  Modalias: usb:v1D6Bp0246d0540
  Discovering: no
  Roles: central
  Roles: peripheral
Advertising Features:
  ActiveInstances: 0x00 (0)
  SupportedInstances: 0x05 (5)
  SupportedIncludes: appearance
  SupportedIncludes: local-name


0
2 年 前
#3708 引用
busctl tree org.bluez

failure case:

1.


busctl tree org.bluez
└─/org



说明蓝牙模块根本没工作,查:
(1)系统检测到蓝牙硬件了吗?
(2)蓝牙硬件被禁用了吗?
(3)蓝牙模块电源打开了吗?


2.

root@raspberrypi:~# busctl tree org.bluez
└─/org
  └─/org/bluez
    └─/org/bluez/hci0
      ├─/org/bluez/hci0/dev_68_AB_BC_5D_A9_17
      └─/org/bluez/hci0/dev_AC_4D_16_65_54_F6


这种情况说明:
(1)蓝牙模块已正常工作,并且把已经扫描到的周围蓝牙设备显示在这根树上。
(2)这些设备不管有没有配对和连接,都会在这里显示。
从上面可以看到,没有蓝牙音箱的mac,说明系统根本没有扫描到我的蓝牙音箱。

上面的结论可以用下面的命令验证:

root@raspberrypi:~# bluetoothctl




[bluetooth]# info AC:4D:16:65:54:F6
Device AC:4D:16:65:54:F6 (public)
  Name: S6971df687649d654C
  Alias: S6971df687649d654C
  Paired: no
  Trusted: no
  Blocked: no
  Connected: no
  LegacyPairing: no
  UUID: Basic Printing            (00001122-0000-1000-8000-00805f9b34fb)
  ManufacturerData Key: 0x004c
  ManufacturerData Value:
  02 15 74 27 8b da b6 44 45 20 8f 0c 72 0e af 05  ..t'...DE ..r...
  99 35 01 00 35 5a c5                             .5..5Z.        
  RSSI: -93



Success case:


root@raspberrypi:~# busctl tree org.bluez
└─/org
  └─/org/bluez
    └─/org/bluez/hci0
      └─/org/bluez/hci0/dev_9A_07_65_B4_21_EC
        ├─/org/bluez/hci0/dev_9A_07_65_B4_21_EC/fd0
        ├─/org/bluez/hci0/dev_9A_07_65_B4_21_EC/sep1
        └─/org/bluez/hci0/dev_9A_07_65_B4_21_EC/sep2

0
2 年 前
#3709 引用
1
0
2 年 前
#3710 引用
pulseaudio



sudo apt-get install pulseaudio
sudo apt-get install pulseaudio-module-bluetooth


PulseAudio是一个sound server,是目前linux环境下的一个主流高级音频解决方案,,PulseAudio不与底层声卡直接打交道,他介于音频播放软件(如omxplayer, mplayer等)和ALSA之间,他的功能主要集中在与各种音频播放软件对接、多路音频混合、音频转发(到不同的声卡或者网卡)等,有了它我们就能轻松实现给不同的音频源设置不同的音量,音频流媒体等高级功能。

使用的pulseaudio、pactl、pacmd等命令都是PulseAudio提供的。
0
2 年 前
#3711 引用


bluez_card.9A_07_65_B4_21_EC  not exist

failure case


root@raspberrypi:~# pactl list cards
xcb_connection_has_error() 返回真
连接失败:拒绝连接
pa_context_connect() 失败:拒绝连接


reason

蓝牙没有被系统识别。因为蓝牙被识别出来的话,至少有3.5mm耳机和hdmi两个设备。





root@raspberrypi:~# pactl list cards
xcb_connection_has_error() 返回真
卡 #0
  名称:alsa_card.platform-soc_audio
  驱动:module-alsa-card.c
  拥有者模块:6
  属性:
    alsa.card = "0"
    alsa.card_name = "bcm2835 ALSA"
    alsa.long_card_name = "bcm2835 ALSA"
    alsa.driver_name = "snd_bcm2835"
    device.bus_path = "platform-soc:audio"
    sysfs.path = "/devices/platform/soc/soc:audio/sound/card0"
    device.form_factor = "internal"
    device.string = "0"
    device.description = "内置音频"
    module-udev-detect.discovered = "1"
    device.icon_name = "audio-card"
  配置文件:
    output:stereo-fallback: 立体声 输出 (信宿:1,信源:0,优先级:5100,可用性:是)
    output:mono-fallback: 单声道 输出 (信宿:1,信源:0,优先级:100,可用性:是)
    output:multichannel-output: 多声道 输出 (信宿:1,信源:0,优先级:100,可用性:是)
    off: 关 (信宿:0,信源:0,优先级:0,可用性:是)
  活动配置:output:stereo-fallback
  端口:
    analog-output: Analog Output (type: Analog, priority: 9900, latency offset: 0 usec, availability unknown)
      属于配置文件:output:stereo-fallback, output:mono-fallback






bluez_card.9A_07_65_B4_21_EC   exist



root@raspberrypi:~# pactl list cards
xcb_connection_has_error() 返回真
卡 #0
  名称:alsa_card.platform-soc_audio
  驱动:module-alsa-card.c
  拥有者模块:6
  属性:
    alsa.card = "0"
    alsa.card_name = "bcm2835 ALSA"
    alsa.long_card_name = "bcm2835 ALSA"
    alsa.driver_name = "snd_bcm2835"
    device.bus_path = "platform-soc:audio"
    sysfs.path = "/devices/platform/soc/soc:audio/sound/card0"
    device.form_factor = "internal"
    device.string = "0"
    device.description = "内置音频"
    module-udev-detect.discovered = "1"
    device.icon_name = "audio-card"
  配置文件:
    output:stereo-fallback: 立体声 输出 (信宿:1,信源:0,优先级:5100,可用性:是)
    output:mono-fallback: 单声道 输出 (信宿:1,信源:0,优先级:100,可用性:是)
    output:multichannel-output: 多声道 输出 (信宿:1,信源:0,优先级:100,可用性:是)
    off: 关 (信宿:0,信源:0,优先级:0,可用性:是)
  活动配置:output:stereo-fallback
  端口:
    analog-output: Analog Output (type: Analog, priority: 9900, latency offset: 0 usec, availability unknown)
      属于配置文件:output:stereo-fallback, output:mono-fallback

卡 #1
  名称:bluez_card.9A_07_65_B4_21_EC
  驱动:module-bluez5-device.c
  拥有者模块:21
  属性:
    device.description = "BT73"
    device.string = "9A:07:65:B4:21:EC"
    device.api = "bluez"
    device.class = "sound"
    device.bus = "bluetooth"
    device.form_factor = "headset"
    bluez.path = "/org/bluez/hci0/dev_9A_07_65_B4_21_EC"
    bluez.class = "0x240404"
    bluez.alias = "BT73"
    device.icon_name = "audio-headset-bluetooth"
    device.intended_roles = "phone"
  配置文件:
    a2dp_sink: 高保真回放 (A2DP 信宿) (信宿:1,信源:0,优先级:40,可用性:是)
    headset_head_unit: 头戴式耳机单元 (HSP/HFP) (信宿:1,信源:1,优先级:30,可用性:否)
    off: 关 (信宿:0,信源:0,优先级:0,可用性:是)
  活动配置:a2dp_sink
  端口:
    headset-output: 耳机 (type: 耳机, priority: 0, latency offset: 0 usec, availability unknown)
      属于配置文件:a2dp_sink, headset_head_unit
    headset-input: 耳机 (type: 耳机, priority: 0, latency offset: 0 usec, not available)
      属于配置文件:headset_head_unit







0
2 年 前
#3712 引用

paplay -d bluez_sink.9A_07_65_B4_21_EC /usr/share/sounds/alsa/Front_Center.wav

paplay -d  bluez_sink.9A_07_65_B4_21_EC.a2dp_sink test.wav
0