ophub / amlogic-s9xxx-armbian

Support for Armbian in Amlogic, Rockchip and Allwinner boxes. Support a311d, s922x, s905x3, s905x2, s912, s905d, s905x, s905w, s905, s905l, rk3588, rk3568, rk3399, rk3328, h6, etc.
GNU General Public License v2.0
6.16k stars 1.97k forks source link

蓝牙配置文件名预设错误? #1539

Closed buzhuiwen closed 1 year ago

buzhuiwen commented 1 year ago

Device Information | 设备信息

Armbian Version | 系统版本

Describe the bug | 问题描述

按照仓库内文档安装蓝牙支持后,蓝牙并不能正常驱动 发现#1513 有同样问题,并且无法运行rtk_hciattach程序,提示 -bash: /usr/bin/rtk_hciattach: No such file or directory 接着

root@armbian:~# file /usr/bin/rtk_hciattach 
/usr/bin/rtk_hciattach: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=cd4b77500233e9a17c422c673c8984451b72e99b, not stripped

发现是个32位程序,然后到lib目录看,没有/lib/ld-linux-armhf.so.3这个文件 然后apt-get install libc6-armhf-cross, 安装后的文件默认就在/usr/arm-linux-gnueaibhf/lib,该文件夹内有ld-linux-armhf.so.3 在lib目录下将其软链接 root@armbian:/lib# ln -s /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 /lib/ld-linux-armhf.so.3 再次运行 root@armbian:/lib# /usr/bin/rtk_hciattach /usr/bin/rtk_hciattach: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory 提示缺少libc.so.6,刚好系统的lib目录里没有这个,但是/usr/arm-linux-gnueaibhf/lib这有,并且这个文件也是个链接 通过ls -l libc.so.6,发现该文件夹内的libc.so.6是链接到libc-2.31.so

root@armbian:/usr/arm-linux-gnueabihf/lib# ls -l libc.so.6 
lrwxrwxrwx 1 root root 12 Mar  3  2021 libc.so.6 -> libc-2.31.so

因此可以 ln -s /usr/arm-linux-gnueabihf/lib/libc.so.6 /lib/libc.so.6或者 ln -s /usr/arm-linux-gnueabihf/lib/libc-2.31.so /lib/libc.so.6

经过如此操作,rtk_hciattach可以运行了.

命令行运行/usr/bin/rtk_hciattach -n -s 115200 ttyAML1 rtk_h5 &

root@armbian:~# /usr/bin/rtk_hciattach -n -s 115200 ttyAML1 rtk_h5 &
[1] 2179
root@armbian:~# Realtek Bluetooth init uart with init speed:115200, final_speed:115200, type:HCI UART H5
Realtek Bluetooth :Realtek hciattach version 3.1 

Realtek Bluetooth :3-wire sync pattern resend : 1, len: 8

Realtek Bluetooth :3-wire sync pattern resend : 2, len: 8

Realtek Bluetooth :Get SYNC Resp Pkt

Realtek Bluetooth :3-wire config pattern resend : 1 , len: 10
Realtek Bluetooth :Get SYNC pkt-active mode

Realtek Bluetooth :Get SYNC pkt-active mode

Realtek Bluetooth :Get CONFG pkt-active mode

Realtek Bluetooth :Received reliable seqno 0 from card
Realtek Bluetooth :H5_CONFIG receive event

Realtek Bluetooth :3-wire config pattern resend : 2 , len: 9
Realtek Bluetooth :Get CONFG resp pkt-active mode

Realtek Bluetooth :H5 init finished

Realtek Bluetooth :RTK send HCI_VENDOR_READ_RTK_ROM_VERISION_Command

Realtek Bluetooth :Received reliable seqno 1 from card
Realtek Bluetooth :receive hci command complete event with command:1001

Realtek Bluetooth :Read Local Version Information with Status:0
Realtek Bluetooth :HCI Version 0x0a
Realtek Bluetooth :HCI Revision 0x000b
Realtek Bluetooth :LMP Subversion 0x8761
Realtek Bluetooth :RTK send HCI_VENDOR_READ_RTK_ROM_VERISION_Command

Realtek Bluetooth :Received reliable seqno 2 from card
Realtek Bluetooth :receive hci command complete event with command:fc6d

Realtek Bluetooth :Read RTK rom version with Status:0
Realtek Bluetooth :LMP Subversion 0x8761
Realtek Bluetooth :EVersion 1
Realtek Bluetooth :IC: RTL8761ATV

Realtek Bluetooth :Firmware/config: rtl8761a_fw, rtl8761a_config

Realtek Bluetooth ERROR: can't access bt config file:/lib/firmware/rtlbt/rtl8761a_config, errno:2

Realtek Bluetooth ERROR: Get Config file error, just use efuse settings
Realtek Bluetooth ERROR: Can't access firmware /lib/firmware/rtlbt/rtl8761a_fw, No such file or directory
Realtek Bluetooth ERROR: Get BT firmware error
Can't initialize device: No such file or directory

最后几行提示找不到/lib/firmware/rtlbt/rtl8761a_config/lib/firmware/rtlbt/rtl8761a_fw 我直接把/lib/firmware/rtlbt/目录下文件名进行修改。 rtl8761b_config改成rtl8761a_config,rtl8761b_fw改成rtl8761a_fw 结果就tm的驱动了,hciconfig也有输出

我不知道是是哪个文件设定了使用rtl8761a_fwrtl8761a_config,大佬能否改回之前的?或者固件里面用rtl8761a这个名字? 可以将相应的解释器ld-linux-armhf.so.3libc.so.6内置在固件

viphanf commented 1 year ago

安装在usr/arm-linux-gnueaibhf/lib,文件夹内有ld-linux-armhf.so.3 小白一个,请问这个如何操作?

buzhuiwen commented 1 year ago

安装在usr/arm-linux-gnueaibhf/lib,文件夹内有ld-linux-armhf.so.3 小白一个,请问这个如何操作?

默认就在这个文件夹里面,不需要操作什么。继续后续的软链接操作就行

ophub commented 1 year ago

上面文章链接里写的名字是rtl8761b_config,所以我在 https://github.com/ophub/firmware/commit/352e08648d3bdd39feaaba68064cf7629986b847 里添加了一样的名字。你测试叫a,可以是芯片不同但可以共用一个驱动,那就再加一个a吧,这样ab两个都兼顾了。

viphanf commented 1 year ago

嗯嗯,一番操作后,有蓝牙了

buzhuiwen commented 1 year ago

上面文章链接里写的名字是rtl8761b_config,所以我在 ophub/firmware@352e086 里添加了一样的名字。你测试叫a,可以是芯片不同但可以共用一个驱动,那就再加一个a吧,这样ab两个都兼顾了。

说来也奇怪,同样的盒子,在之前版本的固件中(大概半年内吧),按照网上一些论坛上传的b驱动,传上去确实是可以用的,我还用了好久的homeassistant蓝牙连接设备。这两天重刷新版就发现不对劲

xcray commented 1 year ago

建议用这种方式: https://github.com/ophub/amlogic-s9xxx-armbian/discussions/1546