How to use bta2dpd(8) with Bluetooth headphone under NetBSD-current
When USB Bluetooth dongle (ubt(4)) is used, classic Bluetooth SCO Audio (btsco(4)) requires USB isochronous transfer and ehci(4) and xhci(4) of NetBSD-current does not support USB isochronous transfer mode, So I cannot use btsco(4) to play audio under NetBSD-current.
Some time ago, bta2dpd(8) was imported to NetBSD-current by nat@. I had not tested bta2dpd(8) and I should test bta2dp(8) with Jabra MOVE Wireless. As a result, I can play audio with ubt(4) and Javra MOVE Wireless.
Basic Bluetooth settings
How to pairing and selecting profile is as same as btsco(4). Please perform the following steps.
At first, run daemon/service for Bluetooth. Please perform the following steps.
If your Bluetooth connection is temporary, you can perform the following steps instead.
# vi /etc/rc.conf bluetooth=YES # /etc/rc.d/bluetooth start configuring Bluetooth controllers: ubt0. starting Bluetooth Link Key/PIN Code manager starting Bluetooth Service Discovery server
# /etc/rc.d/bluetooth onestart configuring Bluetooth controllers: ubt0. starting Bluetooth Link Key/PIN Code manager starting Bluetooth Service Discovery server
Next, turn your wireless headphone to pairing mode and perform the followings to get Bluetooth address.
For easier to identification, record this address in
$ btconfig ubt0 inquiry Device Discovery from device: ubt0 ... 1 response 1: bdaddr XX:YY:ZZ:XX:YY:ZZ : name "Jabra MOVE v2.5.0" : class [0x240404] Wearable Headset
# vi /etc/bluetooth/hosts XX:YY:ZZ:XX:YY:ZZ headset1
Next, set Bluetooth PIN.
Jabra MOVE Wireless assumes PIN as 0000.
$ btpin -d ubt0 -a headset1 -p 0000
Next, the device, set headset1 as headset (HSET).
# btdevctl -d ubt0 -a headset1 -s HSET -A
Above procedure is as same as btsco(4). I will use bta2dpd(8) as follows. Perform basic test.
You may want to play mp3 file or others. If you use mplayer with OSS, you can use pad(4).
$ file test.wav test.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz # bta2dpd -a headset1 test.wav
After this invocation, you can see as follows in your dmesg.
# bta2dpd -a headset1 /dev/pad
This messages show you that if you play audio to
pad0: outputs: 44100Hz, 16-bit, stereo audio2 at pad0: half duplex, playback, capture, mmap pad0: Virtual format configured - Format SLINEAR, precision 16, channels 2, frequency 44100 spkr3 at audio2: PC Speaker (synthesized) wsbell at spkr3 not configured
/dev/sound2, your audio stream will appear in
/dev/pad0. For example, the following command plays audio your Bluetooth headphone.
$ mplayer -ao oss:/dev/sound2 test.mp3
You can use Bluetooth audio with xhci(4) of NetBSD-current.