代码之家  ›  专栏  ›  技术社区  ›  Besi

Bluez在与我的BLE遥控器配对后崩溃

  •  0
  • Besi  · 技术社区  · 5 年前

    我有一个以前在另一个系统上使用过的蓝牙遥控器,现在运行4.52 BLUEZ时出现了一个错误 bluetoothctl 一旦我与遥控器配对。

    连接到蓝牙ctl

    pi@marcophone:~$ sudo bluetoothctl
     Agent registered
    [CHG] Controller B8:27:EB:1B:C4:00 Pairable: yes
    [CHG] Device 20:C3:8F:BD:93:40 Connected: yes
    [Remote RC]# trust
     Changing 20:C3:8F:BD:93:40 trust succeeded
    

    在这里,我成功连接到了遥控器

    [RC]# pair
     Attempting to pair with 20:C3:8F:BD:93:40
    [CHG] Device 20:C3:8F:BD:93:40 Paired: yes
    Pairing successful
    

    就在这之后 蓝牙CTL 断开连接

    [DEL] Descriptor (Handle 0x2ec8)
        /org/bluez/hci0/dev_20_C3_8F_BD_93_40/service0008/char0009/desc000b
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
    [DEL] Characteristic (Handle 0x4cf0)
        /org/bluez/hci0/dev_20_C3_8F_BD_93_40/service0008/char0009
        00002a05-0000-1000-8000-00805f9b34fb
        Service Changed
    [DEL] Primary Service (Handle 0x0073)
        /org/bluez/hci0/dev_20_C3_8F_BD_93_40/service0008
        00001801-0000-1000-8000-00805f9b34fb
        Generic Attribute Profile
    [DEL] Characteristic (Handle 0x4cf0)
        /org/bluez/hci0/dev_20_C3_8F_BD_93_40/service000c/char000d
        00002a50-0000-1000-8000-00805f9b34fb
        PnP ID
    [DEL] Primary Service (Handle 0x0073)
        /org/bluez/hci0/dev_20_C3_8F_BD_93_40/service000c
        0000180a-0000-1000-8000-00805f9b34fb
        Device Information
    Agent unregistered
    [DEL] Controller B8:27:EB:1B:C4:00 marcophone [default]
    Waiting to connect to bluetoothd...con
    

    日志:

    pi@marcophone:~$ cat /var/log/syslog | grep bluetooth -a
    Jan 27 18:39:40 marcophone bluetoothd[1048]: Bluetooth daemon 5.52
    Jan 27 18:39:40 marcophone bluetoothd[1048]: Starting SDP server
    Jan 27 18:39:40 marcophone systemd[1]: Started Raspberry Pi bluetooth helper.
    Jan 27 18:39:40 marcophone bluetoothd[1048]: Bluetooth management interface 1.14 initialized
    Jan 27 18:39:40 marcophone bluetoothd[1048]: Endpoint registered: sender=:1.21 path=/A2DP/SBC/Source/1
    Jan 27 18:39:40 marcophone bluetoothd[1048]: Failed to set privacy: Rejected (0x0b)
    Jan 27 18:41:07 marcophone bluetoothd[1048]: No cache for 20:C3:8F:BD:93:40
    Jan 27 18:41:12 marcophone bluetoothd[1048]: Protocol Mode characteristic read failed: Request attribute has encountered an unlikely error
    Jan 27 18:41:13 marcophone bluetoothd[1048]: Report Map read failed: Request attribute has encountered an unlikely error
    Jan 27 18:41:13 marcophone bluetoothd[1048]: Read External Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:41:13 marcophone bluetoothd[1048]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:41:13 marcophone bluetoothd[1048]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:41:13 marcophone bluetoothd[1048]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:41:13 marcophone bluetoothd[1048]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:41:13 marcophone bluetoothd[1048]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:41:13 marcophone bluetoothd[1048]: HID Information read failed: Request attribute has encountered an unlikely error
    Jan 27 18:41:24 marcophone bluetoothd[1048]: Protocol Mode characteristic read failed: Request attribute has encountered an unlikely error
    Jan 27 18:41:24 marcophone bluetoothd[1048]: Report Map read failed: Request attribute has encountered an unlikely error
    Jan 27 18:41:24 marcophone bluetoothd[1048]: Read External Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:41:24 marcophone bluetoothd[1048]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:41:24 marcophone bluetoothd[1048]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:41:24 marcophone bluetoothd[1048]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:41:24 marcophone bluetoothd[1048]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:41:24 marcophone bluetoothd[1048]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:41:24 marcophone bluetoothd[1048]: Error storing included service - can't find it
    Jan 27 18:41:24 marcophone systemd[1]: bluetooth.service: Main process exited, code=killed, status=11/SEGV
    Jan 27 18:41:24 marcophone systemd[1]: bluetooth.service: Unit entered failed state.
    Jan 27 18:41:24 marcophone systemd[1]: bluetooth.service: Failed with result 'signal'.
    Jan 27 18:43:07 marcophone bluetoothd[356]: Bluetooth daemon 5.52
    Jan 27 18:43:07 marcophone bluetoothd[356]: Starting SDP server
    Jan 27 18:43:08 marcophone systemd[1]: Started Raspberry Pi bluetooth helper.
    Jan 27 18:43:08 marcophone bluetoothd[356]: Bluetooth management interface 1.14 initialized
    Jan 27 18:43:08 marcophone bluetoothd[356]: Endpoint registered: sender=:1.5 path=/A2DP/SBC/Source/1
    Jan 27 18:43:08 marcophone bluetoothd[356]: Failed to set privacy: Rejected (0x0b)
    Jan 27 18:45:11 marcophone bluetoothd[356]: No cache for 20:C3:8F:BD:93:40
    Jan 27 18:45:11 marcophone bluetoothd[356]: BATT attribute not found
    Jan 27 18:45:11 marcophone bluetoothd[356]: batt-profile profile accept failed for 20:C3:8F:BD:93:40
    Jan 27 18:45:11 marcophone bluetoothd[356]: GAP attribute not found
    Jan 27 18:45:11 marcophone bluetoothd[356]: gap-profile profile accept failed for 20:C3:8F:BD:93:40
    Jan 27 18:45:11 marcophone bluetoothd[356]: input-hog profile accept failed for 20:C3:8F:BD:93:40
    Jan 27 18:45:14 marcophone bluetoothd[356]: HID Information read failed: Request attribute has encountered an unlikely error
    Jan 27 18:45:14 marcophone bluetoothd[356]: Protocol Mode characteristic read failed: Request attribute has encountered an unlikely error
    Jan 27 18:45:14 marcophone bluetoothd[356]: Report Map read failed: Request attribute has encountered an unlikely error
    Jan 27 18:45:14 marcophone bluetoothd[356]: Read External Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:45:14 marcophone bluetoothd[356]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:45:14 marcophone bluetoothd[356]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:45:14 marcophone bluetoothd[356]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:45:14 marcophone bluetoothd[356]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:45:14 marcophone bluetoothd[356]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:45:17 marcophone bluetoothd[356]: HID Information read failed: Request attribute has encountered an unlikely error
    Jan 27 18:45:17 marcophone bluetoothd[356]: Protocol Mode characteristic read failed: Request attribute has encountered an unlikely error
    Jan 27 18:45:17 marcophone bluetoothd[356]: Report Map read failed: Request attribute has encountered an unlikely error
    Jan 27 18:45:17 marcophone bluetoothd[356]: Read External Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:45:17 marcophone bluetoothd[356]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:45:18 marcophone bluetoothd[356]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:45:18 marcophone bluetoothd[356]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:45:18 marcophone bluetoothd[356]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:45:18 marcophone bluetoothd[356]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:45:18 marcophone bluetoothd[356]: Error storing included service - can't find it
    Jan 27 18:45:18 marcophone systemd[1]: bluetooth.service: Main process exited, code=killed, status=11/SEGV
    Jan 27 18:45:18 marcophone systemd[1]: bluetooth.service: Unit entered failed state.
    Jan 27 18:45:18 marcophone systemd[1]: bluetooth.service: Failed with result 'signal'.
    Jan 27 18:54:00 marcophone bluetoothd[358]: Bluetooth daemon 5.52
    Jan 27 18:54:00 marcophone bluetoothd[358]: Starting SDP server
    Jan 27 18:54:00 marcophone systemd[1]: Started Raspberry Pi bluetooth helper.
    Jan 27 18:54:00 marcophone bluetoothd[358]: Bluetooth management interface 1.14 initialized
    Jan 27 18:54:01 marcophone bluetoothd[358]: Endpoint registered: sender=:1.5 path=/A2DP/SBC/Source/1
    Jan 27 18:54:01 marcophone bluetoothd[358]: Failed to set privacy: Rejected (0x0b)
    Jan 27 18:55:30 marcophone bluetoothd[358]: No cache for 20:C3:8F:BD:93:40
    Jan 27 18:55:30 marcophone bluetoothd[358]: BATT attribute not found
    Jan 27 18:55:30 marcophone bluetoothd[358]: batt-profile profile accept failed for 20:C3:8F:BD:93:40
    Jan 27 18:55:30 marcophone bluetoothd[358]: GAP attribute not found
    Jan 27 18:55:31 marcophone bluetoothd[358]: gap-profile profile accept failed for 20:C3:8F:BD:93:40
    Jan 27 18:55:31 marcophone bluetoothd[358]: input-hog profile accept failed for 20:C3:8F:BD:93:40
    Jan 27 18:55:36 marcophone bluetoothd[358]: Protocol Mode characteristic read failed: Request attribute has encountered an unlikely error
    Jan 27 18:55:36 marcophone bluetoothd[358]: Report Map read failed: Request attribute has encountered an unlikely error
    Jan 27 18:55:36 marcophone bluetoothd[358]: Read External Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:55:36 marcophone bluetoothd[358]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:55:36 marcophone bluetoothd[358]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:55:36 marcophone bluetoothd[358]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:55:36 marcophone bluetoothd[358]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:55:36 marcophone bluetoothd[358]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:55:36 marcophone bluetoothd[358]: HID Information read failed: Request attribute has encountered an unlikely error
    Jan 27 18:55:47 marcophone bluetoothd[358]: Protocol Mode characteristic read failed: Request attribute has encountered an unlikely error
    Jan 27 18:55:47 marcophone bluetoothd[358]: Report Map read failed: Request attribute has encountered an unlikely error
    Jan 27 18:55:47 marcophone bluetoothd[358]: Read External Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:55:47 marcophone bluetoothd[358]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:55:47 marcophone bluetoothd[358]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:55:47 marcophone bluetoothd[358]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:55:47 marcophone bluetoothd[358]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:55:47 marcophone bluetoothd[358]: Read Report Reference descriptor failed: Request attribute has encountered an unlikely error
    Jan 27 18:55:48 marcophone bluetoothd[358]: Error storing included service - can't find it
    Jan 27 18:55:48 marcophone systemd[1]: bluetooth.service: Main process exited, code=killed, status=11/SEGV
    Jan 27 18:55:48 marcophone systemd[1]: bluetooth.service: Unit entered failed state.
    Jan 27 18:55:48 marcophone systemd[1]: bluetooth.service: Failed with result 'signal'.
    

    Hciconfig

    pi@marcophone:~$ hciconfig -a
    hci0:   Type: Primary  Bus: UART
        BD Address: B8:27:EB:1B:C4:00  ACL MTU: 1021:8  SCO MTU: 64:1
        UP RUNNING 
        RX bytes:2850 acl:94 sco:0 events:117 errors:0
        TX bytes:3820 acl:92 sco:0 commands:62 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: 'marcophone'
        Class: 0x480000
        Service Classes: Capturing, Telephony
        Device Class: Miscellaneous, 
        HCI Version: 4.1 (0x7)  Revision: 0x168
        LMP Version: 4.1 (0x7)  Subversion: 0x2209
        Manufacturer: Broadcom Corporation (15)
    

    版本:

    pi@marcophone:~$ sudo bluetoothctl -v
    sudo: Hostname marcophone kann nicht aufgelöst werden
    bluetoothctl: 5.52
    pi@marcophone:~$ 
    

    我也应该在这里看到一个条目: /dev/input/event* 但只有 /dev/input/mice .

    我知道我用bluez 5.50做了这个,所以在bluez 5.52中可能会出现问题。

    在进行研究时,我确实在我的研究中添加了以下三个选项 /lib/systemd/system/bluetooth.service :

    ExecStart=/usr/libexec/bluetooth/bluetoothd --compat --noplugin=sap -E 
    
    0 回复  |  直到 5 年前
        1
  •  2
  •   Besi    5 年前

    我在另一台机器上做了这个。然而,该机器运行的是raspbian buster(4.19.97+#1294星期四1月30日13:10:54 GMT 2020 armv6l GNU/Linux)。

    我在连接和配对遥控器时遇到了一些问题,所以我做了以下操作,最终使其正常工作:

    更新系统

    sudo apt update && sudo apt upgrade
    

    更新到最新的bluez堆栈

    sudo apt-get remove bluez
    date && sudo apt-get update && sudo apt-get install libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev -y && 
    
    date && wget www.kernel.org/pub/linux/bluetooth/bluez-5.52.tar.xz &&  tar xvf bluez-5.52.tar.xz && 
    
    date && cd bluez-5.52 && ./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var --enable-experimental && make -j4 && sudo make install && date && sudo reboot
    

    现在更新 ExecStart 服务的一部分 /lib/systemd/system/bluetooth.service 如下:

    ExecStart=/usr/lib/bluetooth/bluetoothd --compat --noplugin=sap -E 
    

    同时更新 /etc/bluetooth/main.conf 并设置 Privacy = off 在里面 [General] 部分。

        2
  •  0
  •   am70    4 年前

    要升级到较新的bluez堆栈,我宁愿使用软件包,如下所示

    sudo apt install debhelper autotools-dev dh-autoreconf \
        flex  bison libdbus-glib-1-dev  libglib2.0-dev \
        libcap-ng-dev    udev   libudev-dev   libreadline-dev \
        libical-dev  check   dh-systemd     libebook1.2-dev
    mkdir bluez
    cd bluez
    wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/bluez/5.55-0ubuntu1.1/bluez_5.55-0ubuntu1.1.dsc 
    wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/bluez/5.55-0ubuntu1.1/bluez_5.55.orig.tar.xz 
    wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/bluez/5.55-0ubuntu1.1/bluez_5.55-0ubuntu1.1.debian.tar.xz 
    dpkg-source -x bluez_5.55-0ubuntu1.1.dsc 
    cd bluez-5.55
    dpkg-buildpackage -b
    cd ..
    sudo dpkg -i *deb
    

    使用软件包的优点是,您可以安装此软件的其他版本