In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to connect the Bluetooth headset to Raspberry Pi 3, which has a certain reference value. Interested friends can refer to it. I hope you can learn a lot after reading this article.
Step 1: PulseAudio
One of the problems mentioned everywhere is the withdrawal of ALSA support for Bluetooth technology. The only way now is PulseAudio.
The minimum version required for HSP (including A2DP) is: Bluez 5 / PulseAudio 6
I suggest starting with the new Raspbian Jessie image: https:
/ / www.raspberrypi.org/downloads/raspbian/
Update and upgrade it:
Sudo apt-get update
Sudo apt-get upgrade
Sudo apt-get autoremove
Sudo reboot
Check the version of the package:
Dpkg-l bluez
Version 5. 23-2 + rpi2
Dpkg-l pulseaudio
Version: 5. 0-13
Warning: PulseAudio 5 that the Raspbian library is still using
Clear the pre-installed PulseAudio:
Sudo apt-get purge pulseaudio
There are two ways to manually install PulseAudio 6 or later, both of which are fine.
Method 1: install PulseAudio from Debian Backports
Edit the source list:
Sudo nano / etc/apt/sources.list
Add a row:
Deb http://ftp.debian.org/debian jessie-backports main
Add the PGP key to your Raspberry Pi:
Gpg-keyserver pgpkeys.mit.edu-recv-key 8B48AD6246925553
Gpg-keyserver pgpkeys.mit.edu-recv-key 7638D0442B90D010
Gpg-a-- export 8B48AD6246925553 | sudo apt-key add--
Gpg-a-- export 7638D0442B90D010 | sudo apt-key add--
Update the package list:
Sudo apt-get update
Install PulseAudio and its Bluetooth module:
Sudo apt-get-t jessie-backports install pulseaudio pulseaudio-module-bluetooth
Check version 6 or later:
Dpkg-l pulseaudio pulseaudio-module-bluetooth
Ii pulseaudio 7.1-2~bpo8 + 1
Ii pulseaudio-module-blue 7.1-2~bpo8 + 1
You can skip directly to step 2.
Method 2: use PulseAudio sources
Download the source code from Freedesktop.org:
Wget https://freedesktop.org/software/pulseaudio/releases/pulseaudio-6.0.tar.xz
Extract and go to the directory:
Tar xvf pulseaudio-6.0.tar.xz
Cd pulseaudio-6.0
Run the boot script:
. / bootstrap.sh
Here I will summarize all the errors I have encountered (in case people search by copy / paste):
. / bootstrap.sh: line 46: intltoolize: command not found
Configure: error: Unable to find libltdl version 2. Makes sure you have libtool 2.4 or later installed.
Configure: error: * * sys/capability.h not found. Use-without-caps to disable capabilities support
No package 'json-c' found
No package 'sndfile' found
So install all the above libraries:
Sudo apt-get install intltool libtool libcap-dev libjson0-dev libsndfile1-dev
The script should now end correctly, and on the command line, you can see the table of the completed configuration, as well as the enabled / disabled sections. By my side: udev,bluez5,ofono,native-headset,alsa,X11,systemd,... None was enabled, so I installed additional libraries:
Sudo apt-get install libudev-dev libsbc-dev libbluetooth-dev libx11-xcb-dev libasound2-dev libsystemd-dev libsamplerate0-dev
Re-execute the. / bootstrap program, now the missing part is enabled.
Then, make and install PulseAudio (which takes some time to have a cup of coffee).
Sudo make
Sudo make install
Sudo ldconfig
The last command to avoid errors in shared libraries was not found.
Step 2: Bluetooth hardware
To turn off the built-in Bluetooth controller (BCM43438), blacklist it:
Sudo nano / etc/modprobe.d/raspi-blacklist.conf
Add a row:
Blacklist btbcm
Blacklist hci_uart
CTRL + X, then Y, then Enter
Restart:
Sudo reboot
Now connect your Bluetooth USB encryption dog, mine is Asustek BT400.
(at this step, the results may be different. Maybe your USB dongle has been supported by Raspbian.)
For the Asustek BT-400, I have to install the firmware manually.
To know if your hardware is called correctly, check here:
Dmesg | grep-I bluetooth
In my case, I see an error:
[155.924366] Direct firmware load of bluetooth hci0:brcm / BCM20702A1-0b05-17cb.hcd failed with error-2
I need to explain something here. The chipset in USB dongle comes from Broadcom (BCM)
Broadcom firmware is proprietary, which means they are not shared as open source and sometimes not even shared in Linux repositories.
So to use it, you must find the appropriate .hcd file and store it in the / lib / firmware folder.
The easy way is to download the Asustek driver online:
Wget http://dlcdnet.asus.com/pub/ASUS/wireless/USB-BT400/UT_USB_BT400_6516000.zip-P / home/pi/Downloads/
Unzip it:
Sudo apt-get install zip
Cd / home/pi/Downloads/
Unzip UT_USB_BT400_6516000.zip
Open the .inf file of the driver and find Asustek
Cd BTW6.5.1.6000_Win7_USB_ASUS/Win32/
Cat bcbtums-win7x86-brcm.inf
Search for drivers that support your hardware. For Asustek BT400, I found the corresponding file:
BCM20702A1_001.002.014.1315.1347.hex
No, it's .hex, so I need to convert it to .hcd, and I'll use the hex2hcd tool:
Cd / home/pi/Desktop
Sudo apt-get install git
Git clone https://github.com/jessesung/hex2hcd.git
Cd hex2hcd
Make
Here, I encountered an error due to the raspberry pie configuration
Gcc-O2-march = native hex2hcd.c-o hex2hcd
* error in `gcc': double free or corrupt (top): 0x015fdc58 * *
Target recipe 'hex2hcd' failed
Make:*** [hex2hcd] abort
So I modified Makefile:
Sudo nano Makefile
Replace the row:
CFLAGS =-O2-march = native
Pass through
CFLAGS =-mcpu = cortex-a53-mfpu = neon-vfpv4
Source: https://www.raspberrypi.org/forums/viewtopic.php? F = 280t = 139091roomp = 922980)
Redo the make command, and now you have the executable file hex2hcd:
Cp / home/pi/Downloads/BTW6.5.1.6000_Win7_USB_ASUS/Win32/BCM20702A1_001.002.014.1315.1347.hex / home/pi/Desktop/hex2hcd/
. / hex2hcd BCM20702A1_001.002.014.1315.1347.hex BCM20702A1-0b05-17cb.hcd
Note here the name of the .hcd file, which is the same dmesg as the error above | grep-I bluetooth
Copy it to the firmware folder, reboot and check for Bluetooth startup:
Sudo cp BCM20702A1-0b05-17cb.hcd / lib/firmware/brcm/
Sudo reboot
Dmesg | grep-I bluetooth
The firmware should be invoked correctly now!
Now we will connect the Bluetooth headset (same as the steps that only support A2DP)
Start the Bluetoothctl tool and start everything:
Bluetoothctl
Power on
Agent on
Default-agent
Turn on the headphones and press and hold the button for me until I see the white flashing LED.
Start scanning:
Scan on
After a few seconds, you will see the headset name and MAC address (xx:xx)
Pair, trust and connect it:
Pair xx:xx:xx:xx:xx:xx
Trust xx:xx:xx:xx:xx:xx
Connect xx:xx:xx:xx:xx:xx
The headset is now properly connected to the Raspberry Pi.
Otherwise, it should be a PulseAudio daemon, which is not yet running.
Open a new console and start it:
Pulseaudio-start
Return to the other console and reconnect the headset:
Connect xx:xx:xx:xx:xx:xx
Now the headphones are connected!
Check the cards in PulseAudio:
Pactl list cards
You can see the Bluetooth card, as well as the available profiles A2DP and HSP.
For me, the default profile is headset_head_unit, and if it doesn't work for you, force it:
Pacmd set-card-profile 1 headset_head_unit
Tell PulseAudio to use headphones as the default "signal source" and "signal source":
Pacmd set-default-sink bluez_sink.xx_xx_xx_xx_xx_xx
Pacmd set-default-source bluez_source.xx_xx_xx_xx_xx_xx
Record yourself with a microphone:
Parecord-v voice.wav
CTRL + C ends it.
Playback:
Paplay-v voice.wav
Are you listening to your voice?
Finally, check to see if A2DP is working, and activate it: that's your voice.
Pacmd set-card-profile 1 a2dp_sink
Paplay-v voice.wav
Thank you for reading this article carefully. I hope the article "how to connect a Bluetooth headset to Raspberry Pi 3" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 218
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
Record the CDH5.13.0 installed in VM
© 2024 shulou.com SLNews company. All rights reserved.