Hi fellow FreeBSD users and developers, I have a Sennheiser bluetooth headset. After some digging I haven't seen a topic mentioning A2DP on bugzilla. Here are some related links on the issue: - https://forums.pcbsd.org/thread-19754.html (PC-BSD - support for bluetooth headsets) - https://lists.freebsd.org/pipermail/freebsd-bluetooth/2013-June/001834.html (What is it going to take to get basic A2DP support into -HEAD?) From the above thread, NetBSD seems to be a candidate to port A2DP support from. As of very recently (September 15, 2015), they are experimenting with a new A2DP at https://mail-index.netbsd.org/netbsd-users/2015/09/14/msg016883.html. What is standing in our way if we want to port NetBSD's A2DP? Would A2DP handle the microphone portion also?
I recommend using libcuse for this making a daemon in userspace which handle everything emulating a DSP device. See: svn --username anonsvn --password anonsvn \ checkout svn://svn.turbocat.net/i4b Search for "virtual_oss*"
Shouldn't this issue be assigned to freebsd-bluetooth@?
Hi, Over the weekend I've imported Nathanial Sloss's A2DP code into my virtual OSS backend for FreeBSD. If someone wants to do recording support, would be great. How to connect: 0) Add your device to /etc/bluetooth/hcsecd.conf device { bdaddr xx:xx:xx:xx:xx:xx; name "BT audio device"; key nokey; pin "0000"; } 1) /etc/rc.d/hcsecd onestart 2) hccontrol -n ubt0hci write_authentication_enable 1 3) Now switch on pairing 4) hccontrol -n ubt0hci create_connection xx:xx:xx:xx:xx:xx 5) Install cuse4bsd-kmod from ports or set HAVE_CUSE=YES for 11-current. 6) kldload cuse4bsd or cuse 7) svn --username anonsvn --password anonsvn \ checkout svn://svn.turbocat.net/i4b/trunk/virtual_oss cd virtual_oss make HAVE_BLUETOOTH=YES all # Disable kernel's /dev/dsp sysctl hw.snd.basename_clone=0 # Create new /dev/dsp ./virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 1024 -R /dev/null -P /dev/bluetooth/xx:xx:xx:xx:xx:xx -d dsp Assuming you have sox installed: play test.wav Or use VLC and select OSS audio backend.
What's missing from recording support is simply the SBC audio decoder.
I tried your instructions with a Teufel Bamster bluetooth speaker. It all went fine until I start virtual_oss: # ./virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 1024 -R /dev/null -P /dev/bluetooth/a0:e9:db:00:32:0d -d dsp virtual_oss: AUTOCONFIG FAILED: No error: 0 virtual_oss: AUTOCONFIG FAILED: No error: 0 virtual_oss: AUTOCONFIG FAILED: No error: 0 virtual_oss: AUTOCONFIG FAILED: No error: 0 virtual_oss: AUTOCONFIG FAILED: No error: 0 The message is emitted every second and the speaker shortly beeps at the same time.
Fantastic news to brighten a tough day. Thank you Hans. Here is what I get. Is there anything I can do to give you better information? Same sennheiser Urbanite bluetooth headset. # freebsd-version; uname -a 11.0-CURRENT FreeBSD z600 11.0-CURRENT FreeBSD 11.0-CURRENT #5: Mon Oct 19 13:26:50 CDT 2015 root@z600:/usr/obj/usr/src/sys/GENERIC amd64 ➜ virtual_oss sudo hccontrol -n ubt0hci read_connection_list Remote BD_ADDR Handle Type Mode Role Encrypt Pending Queue State 00:16:94:14:13:ae 12 ACL 0 MAST NONE 0 0 OPEN ➜ virtual_oss ./virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 1024 -R /dev/null -P /dev/bluetooth/00:16:94:xx:xx:xx -d dsp virtual_oss: Could not connect to cuse module ➜ virtual_oss sudo ./virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 1024 -R /dev/null -P /dev/bluetooth/00:16:94:XX:XX:XX -d dsp Password: virtual_oss: Could not connect to HC: Input/output error virtual_oss: Could not connect to HC: Input/output error virtual_oss: Could not connect to HC: Input/output error virtual_oss: Could not connect to HC: Input/output error virtual_oss: Could not connect to HC: Input/output error ^C% ➜ virtual_oss sudo hccontrol -n ubt0hci read_connection_list Remote BD_ADDR Handle Type Mode Role Encrypt Pending Queue State 00:16:94:xx:xx:xx 12 ACL 0 MAST NONE 0 0 OPEN ➜ virtual_oss sudo ./virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 1024 -R /dev/null -P /dev/bluetooth/00:16:94:XX:XX:XX -d dsp virtual_oss: Could not open SDP: Host is down virtual_oss: PSM not found: Host is down virtual_oss: Could not open SDP: Permission denied virtual_oss: PSM not found: Permission denied virtual_oss: Could not open SDP: Permission denied virtual_oss: PSM not found: Permission denied virtual_oss: Could not open SDP: Permission denied virtual_oss: PSM not found: Permission denied
(In reply to Lars Engels from comment #5) Hi, Possibly 48000 is not supported. Try 44100. Or add debug prints in the "avdtpAutoConfig" function. --HPS
(In reply to Tony Narlock from comment #6) Hi, This error code, simply means the speaker and BT dongle are not properly paired. Try experimenting with /etc/bluetooth/hcsecd.conf and ensure the hcsecd daemon is started. virtual_oss: Could not connect to HC: Input/output error --HPS
BTW I used erdgeist's bluetooth-config script from https://reviews.freebsd.org/D3778 to pair with the speaker. Works pretty well!
(In reply to Lars Engels from comment #9) Lars, that script was excellent. Is there a bugzilla tracker ticket for that?
(In reply to Hans Petter Selasky from comment #7) Thank you. I'm getting the "AUTOCONFIG FAILED" error now. Trying with 44100 doesn't help. I am new to gdb, but tried giving that a go too. It seems that AutoConfig never gets passed avdtpGetCapabilities. avdtpCheckResponse ends up skipping `else if ((len % AVDTP_LEN_SUCCESS) 2, len - 2)` and returning response_invalid. (gdb) info args recvfd = <value optimized out> trans = <value optimized out> signalId = 1 pkt_type = (int *) 0xac2060d861b6f7f9 data = (uint8_t *) 0x7fffffffe0e0 " áÿÿ\005" datasize = (size_t *) 0x7fffffffe0d8 (gdb) info locals buffer = 0x7fffffffe040 "2\001\024\b\004\b" len = 6 data: 140737488347312 datasize: 140737488347296
(In reply to Tony Narlock from comment #11) Could you try to just fake a "return (0);" instead of "return (EINVAL);" for now and see if you get further?
(In reply to Hans Petter Selasky from comment #12) At least for me s/EINVAL/0/ doesn't change anything.
(In reply to Lars Engels from comment #13) Right. I'm not an SDP expert. What you could do is to dump that buffer in GDB like this: print /x buffer So that it shows in HEX instead of a string. Maybe someone here knows what's wrong. The SDP code was copied from the one provided by NetBSD.
(In reply to Hans Petter Selasky from comment #14) Like this? (lldb) frame v buffer -f hex (uint8_t [64]) buffer = { [0] = 0x40 [1] = 0x02 [2] = 0x14 [3] = 0x08 [4] = 0x04 [5] = 0x08 [6] = 0x00 [7] = 0x00 [8] = 0x2f [9] = 0x69 [10] = 0x6b [11] = 0x01 [12] = 0x08 [13] = 0x00 [14] = 0x00 [15] = 0x00 [16] = 0x1b [17] = 0x60 [18] = 0xdc [19] = 0x01 [20] = 0x08 [21] = 0x00 [22] = 0x00 [23] = 0x00 [24] = 0x07 [25] = 0x00 [26] = 0x00 [27] = 0x1e [28] = 0x00 [29] = 0x1b [30] = 0x00 [31] = 0x00 [32] = 0x48 [33] = 0xe1 [34] = 0xff [35] = 0xff [36] = 0xff [37] = 0x7f [38] = 0x00 [39] = 0x00 [40] = 0x07 [41] = 0x00 [42] = 0x00 [43] = 0x00 [44] = 0x00 [45] = 0x00 [46] = 0x00 [47] = 0x00 [48] = 0xa0 [49] = 0xe1 [50] = 0xff [51] = 0xff [52] = 0xff [53] = 0x7f [54] = 0x00 [55] = 0x00 [56] = 0xe9 [57] = 0x9a [58] = 0xe4 [59] = 0x00 [60] = 0x08 [61] = 0x00 [62] = 0x00 [63] = 0x00 }
Are either of you two on IRC? Lars to confirm, you're getting the same issue still? AUTOCONFIG FAILED: No error: 0
(In reply to Tony Narlock from comment #16) Yes, no news unfortunately.
(In reply to Tony Narlock from comment #15) Could you SVN up and recompile and try again? I've received a small patch from Nathanial Sloss.
(In reply to Hans Petter Selasky from comment #18) Interesting, with the new revision: I got the same results as before for a few attempts. I forgot to do the 'sysctl hw.snd.basename_clone=1' Then after switching it to 0, I now get this: ./virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 1024 -R /dev/null -P /dev/bluetooth/00:16:94:14:13:ae -d dsp virtual_oss: DSP: Could not create '/dev/dsp' Could I be forgetting something? # freebsd-version; uname -a 11.0-CURRENT FreeBSD z600 11.0-CURRENT FreeBSD 11.0-CURRENT #4: Sun Oct 25 08:00:14 CDT 2015 root@z600:/usr/obj/usr/src/sys/MYKERNEL amd64 Remote BD_ADDR Handle Type Mode Role Encrypt Pending Queue State urbanite 12 ACL 0 MAST NONE 0 0 OPEN
(In reply to Tony Narlock from comment #19) Hi, Ensure "sysctl hw.snd.basename_clone=0", or use another device name -d dsp.bt Also check that other instances of virtual_oss are killed. --HPS
(In reply to Hans Petter Selasky from comment #20) I tried again on revision 3644. Continue to get the AUTOCONFIG FAILED. I'm still pretty interested in getting this working. I'm going to dig a bit more into cuse and OSS myself. Does anyone know any good overviews on that part of the codebase?
Everything Bluetooth related is in backend_bt/*.[ch]
Forwarding message from Nathanial Sloss: > AFAICT the only reason as to why auto config would fail would be if the max > bitpool value that is calculated is smaller than the minimum bit pool value. > > This is possibile on some headphones/speakers bta2dpd has the -B switch so the > user can set the max bitpool value. Is there hci dump on freebsd as seeing > the output of getConfiguration will confirm this. Otherwize increasing > DEFAULT_MAXBITPOOL from 80 to say 160 in sbc_encode.h might work for his > headphones but I am at a loss as to whether this will effect others. The > problem stems from the fact that different manufacturers specify different > encoding ranges and I've made it use the highest possible value as this will > give the best quality but in some cases the headphones will report a bitpool > range of 2-253 but if you encode the audio at 253 you wont get any playback > and most android/linux will just use 36 and this wont work with some > headphones or sound bad. Tony: Could you try to change the definition of DEFAULT_MAXBITPOOL? --HPS
(In reply to Hans Petter Selasky from comment #23) Sorry for the late response. I tried 40, 160, 253 and 500. Unfortunately, same results.
Hi Tone, Can you SVN up and try the latest version of virtual_oss? I've tried to add support for MPEG-2 AAC-LC which some audio headsets use. Some RTP framing bits are missing, so at least mine doesn't produce sound, but does transfer the payload data. Maybe someone wants to help out? --HPS
Forgot to say: You'll need to install libsamplerate and libfaac . --HPS
A closer look reveals that the codec is called aac_latm and is supported by ffmpeg. Looks like lib faac won't produce the correct data. Will look more at this after x-mas. Feel free to send me patches.
Two problems: * it's choppy on atheros bluetooth with -s 1024, I need -s 4096 for it to not sound choppy. it sonuds like wifi beacons are interfering but it happens when I disable beacons/wifi! * I can't talk to a pair of B&W P5 headphones: root@gertrude:/home/adrian/svn/virtual_oss # ./run ubt0hci ec:66:d1:83:e5:22 hw.snd.basename_clone: 0 -> 1 hw.snd.basename_clone: 1 -> 0 backend_bt: 0x1 0x0 0x7 0x9 0x0 0xff backend_bt: 0x7 0x9 0x0 0xff 0x4f 0x0 backend_bt: 0x4 0x2 0x2 0x0 0x0 0x0 backend_bt: No frequency and mode match (avail=0x00 freqmode=0x12, freq=3, chmode=2 backend_bt: 0x1 0x0 0x7 0x9 0x0 0xff backend_bt: 0x7 0x9 0x0 0xff 0x4f 0x0 backend_bt: 0x4 0x2 0x2 0x0 0x0 0x0 backend_bt: No frequency and mode match (avail=0x00 freqmode=0x18, freq=3, chmode=0 backend_bt: AUTOCONFIG FAILED backend_bt: 0x1 0x0 0x7 0x9 0x0 0xff backend_bt: 0x7 0x9 0x0 0xff 0x4f 0x0 backend_bt: 0x4 0x2 0x2 0x0 0x0 0x0 backend_bt: No frequency and mode match (avail=0x00 freqmode=0x12, freq=3, chmode=2 backend_bt: 0x1 0x0 0x7 0x9 0x0 0xff backend_bt: 0x7 0x9 0x0 0xff 0x4f 0x0 backend_bt: 0x4 0x2 0x2 0x0 0x0 0x0 backend_bt: No frequency and mode match (avail=0x00 freqmode=0x18, freq=3, chmode=0 backend_bt: AUTOCONFIG FAILED ..
It's odd; it's decoding it as "codecType 0xff" and then "contentprotection", with no SBC codec. What's the story? I thought SBC was mandated.
I hacked on the negotiation bits after reading the spec. The spec mandates SBC, but the initial config fetch doesn't return SBC. It's returning some non-mandatory codec. I'm not sure if we have to ask it another way or not. I overrode some things, and it fails the set_configuration call, but the headset makes the "i'm ready!" noise. So something's happening. backend_bt: media: 0x4 backend_bt: No frequency and mode match (avail=0x00 freqmode=0x12, freq=3, chmode=2 backend_bt: sending config: freq=12, blk=15, supmin=23, supmax=23 backend_bt: OPEN FAILED backend_bt: info: len=19 backend_bt: i=2: 0x1 0x0 0x7 0x9 0x0 0xff backend_bt: media: 0x1 backend_bt: i=4: 0x7 0x9 0x0 0xff 0x4f 0x0 backend_bt: media: 0x7 backend_bt: codec : 0xff backend_bt: i=15: 0x4 0x2 0x2 0x0 0x0 0x0 backend_bt: media: 0x4 backend_bt: No frequency and mode match (avail=0x00 freqmode=0x12, freq=3, chmode=2 backend_bt: sending config: freq=12, blk=15, supmin=23, supmax=23 backend_bt: OPEN FAILED ^C I'll read the error values back from the call soon and see what's going on.
Some headsets use mpeg4. I need some help to support that. --HPS
(In reply to Hans Petter Selasky from comment #3) These instructions worked perfectly for my combination of FreeBSD 8.4 and Leme EB30A headphones. However, music playback has occasional hiccups despite unloaded CPU and that distance between devices was minimal and unobstructed; any ideas what might be causing them? (They do not occur when feeding sound from a smartphone AFAICT.) Another issue I had was with volume control. By default it is set to 128 (returned correctly by issuing SNDCTL_DSP_GETPLAYVOL ioctl() call), and looking at virtual-oss code it should support SNDCTL_DSP_SETPLAYVOL as well, but it didn't for me (volume always remains 128). Apart of that, great work Hans, thanks!
Hi, I've just updated virtual OSS and figured out why SBC was not selected for my MP4 headset. Patches are in my I4B SVN. Can you refresh the sources and try again. Also the volume control has not a maximum of 100 instead of 128. --HPS
Hi, virtual_oss is now in ports, see audio/virtual_oss . --HPS
I tried this on a Logitech UE Mobile Boombox and it works well. To make it coexist with other devices, I use dsp3 as the device name. The new device is not automatically detected by pulseaudio. To make it available for use in firefox, I run > pacmd load-module /usr/local/lib/pulse-9.0/modules/module-oss.so device=/dev/dsp3 The log message says: Dec 27 22:45:25 pepsi pulseaudio[62731]: [(null)] oss-util.c: device doesn't support 44100 Hz, changed to 48000 Hz. Dec 27 22:45:25 pepsi pulseaudio[62731]: [(null)] source.c: Default and alternate sample rates are the same. Dec 27 22:45:25 pepsi pulseaudio[62731]: [(null)] sink.c: Default and alternate sample rates are the same. Dec 27 22:45:25 pepsi pulseaudio[62731]: [(null)] oss-util.c: Failed to open mixer '/dev/dsp3': -^VM-^G件-^HM-^V-^[-^U-^M-^X-^\ Then I can use pavucontrol to switch firefox's output to /dev/dsp3, and now firefox uses it as sound output. Thank you for the great work!
This is great! With 11.0, A2DP is working perfectly with iwn wireless device and OontZ XL speaker. Thank you!
Hi, I tried to pair with Dell AD211 Bluetooth Speaker but I am not able to get the /dev/bluetooth/xx:xx:xx:xx:xx:xx device ... This is this speaker: https://downloads.dell.com/manuals/all-products/esuprt_electronics/esuprt_speakers/dell-ad211_user%27s%20guide_en-us.pdf This is 11.1-RELEASE with GENERIC kernel and userland. The Bluetooth device is on the ThinkPad T420s: # kldstat -v | grep ng_ubt 38 1 0xffffffff8296f000 4f08 ng_ubt.ko (/boot/kernel/ng_ubt.ko) 545 uhub/ng_ubt # grep ubt /var/run/dmesg.boot ubt0 on uhub3 ubt0: <Broadcom Corp Broadcom Bluetooth Device, class 224/1, rev 2.00/7.48, addr 4> on usbus0 Searching for device (finds the speaker): # hccontrol -n ubt0hci inquiry Inquiry result, num_responses=1 Inquiry result #0 BD_ADDR: 04:fe:a1:43:7b:9b Page Scan Rep. Mode: 0x1 Page Scan Period Mode: 00 Page Scan Mode: 00 Class: 24:04:04 Clock offset: 0x7b8b Inquiry complete. Status: No error [00] # hccontrol -n ubt0hci remote_name_request 04:fe:a1:43:7b:9b BD_ADDR: 04:fe:a1:43:7b:9b Name: Dell Portable # hccontrol -n ubt0hci read_connection_list Remote BD_ADDR Handle Type Mode Role Encrypt Pending Queue State # hccontrol -n ubt0hci create_connection 04:fe:a1:43:7b:9b BD_ADDR: 04:fe:a1:43:7b:9b Connection handle: 12 Encryption mode: Disabled [0] # hccontrol -n ubt0hci read_connection_list Remote BD_ADDR Handle Type Mode Role Encrypt Pending Queue State 04:fe:a1:43:7b:9b 12 ACL 0 MAST NONE 0 0 OPEN Connected? I can switch role from MASTER to SLAVE. # hccontrol -n ubt0hci Switch_Role 04:fe:a1:43:7b:9b 1 BD_ADDR: Dell_Portable Role: Slave [0x1] # hccontrol -n ubt0hci read_connection_list Remote BD_ADDR Handle Type Mode Role Encrypt Pending Queue State Dell_Portable 12 ACL 0 SLAV NONE 0 0 OPEN I also tried this script but the effect is the same: https://reviews.freebsd.org/file/data/zaaxr2kboxot76hf5dk4/PHID-FILE-twx4z2ngvki4pm7m6y4l/bluetooth-config This is the config: # cat /etc/bluetooth/hcsecd.conf device { bdaddr 04:fe:a1:43:7b:9b; name "Dell Portable"; key nokey; pin "0000"; } I also tried with "1234" an 'nopin' but no success. Am I doing something wrong?
FYI: The bluetooth-config script from https://reviews.freebsd.org/D3778 was now committed to HEAD and should land in 12.1.
Hi, I have been testing this but it can't get it to work. Tried the version in ports: # virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 1024 -f /dev/bluetooth/78:44:05:9b:51:aa -d dsp -T /dev/sndstat -t vdsp.ctl hw.snd.basename_clone: 0 -> 0 backend_bt: PSM not found backend_bt: PSM not found backend_bt: PSM not found And it repeats PSM not found forever. Also tried the current version from svn://svn.turbocat.net/i4b hw.snd.basename_clone: 0 -> 0 backend_bt: PSM=0xffffffff backend_bt: PSM not found backend_bt: PSM=0xffffffff backend_bt: PSM not found I have both a bluetooth speaker and a headset, same thing happens with both.
Try: virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 1024 -P /dev/bluetooth/78:44:05:9b:51:aa -R /dev/null -d dsp -T /dev/sndstat -t vdsp.ctl If your device doesn't support SBC recording it won't work with -f. --HPS
(In reply to Hans Petter Selasky from comment #40) > Try: > > virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 1024 -P > /dev/bluetooth/78:44:05:9b:51:aa -R /dev/null -d dsp -T /dev/sndstat -t > vdsp.ctl > > If your device doesn't support SBC recording it won't work with -f. > > --HPS Yes, thanks. That works for the speaker. The headset still refuses to work. I expected /dev/sndstat to change but it doesn't: # cat /dev/sndstat Installed devices: pcm0: <Realtek ALC283 (Analog 2.0+HP/2.0)> (play/rec) default pcm1: <Intel (0x2882) (HDMI/DP 8ch)> (play) No devices installed from userspace. Also it might be a good idea to restore hw.snd.basename_clone upon exit?
Yes, I might want to add an atexit() rule for that. Feel free to make a patch and submit it at github.com/hselasky . Some headsets use Bluetooth SCO for transport and need a bunch of AT commands before they work. This is currently not supported. --HPS
Hi, There has been some updates to sdpd in -current and virtual_oss has a new utility called virtual_bt_speaker, which can sink sound. https://github.com/hselasky/virtual_oss --HPS
Before trying the latest virtual_oss you need to rebuild: 1) libsdp 2) sdpd Does not work with iOS yet. If someone wants to work on that you can send me patches.
Hi all, I've been following bt support for FreeBSD for quite some time now, but only just found this bug report. Good job to those that got it all working! I've followed the instructions throughout this bug report, and in conjunction with ath3k-firmware (I've got an AR9565), finally got bluetooth at least activating, and pairing with my headphones. However, getting any audio playing through them hasn't been successful so far: http://paste.pr0.tips/A3 It seems as if the headphones are paired correctly, before and after attempting to use virtual_oss. Any tips would be helpful! Cheers
Hi, Did you try: hccontrol -n ubt0hci write_authentication_enable 1 Before connecting? BTW: Virtual OSS in ports now has all the latest BT support. If you want BT server you need to build from source. --HPS
(In reply to Hans Petter Selasky from comment #46) >hccontrol -n ubt0hci write_authentication_enable 1 Trying that and then trying to connect, I get the error message: $ sudo hccontrol -n ubt0hci create_connection 50:1a:xx:xx:xx:xx Status: Pairing not allowed [0x18]
What pin-code did you set? Try 1234 or 0000 explicitly. --HPS
Getting a bit further now. $ sudo ./virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 1024 -P /dev/bluetooth/50:1a:xx:xx:xx:xx -R /dev/null -d dsp hw.snd.basename_clone: 0 -> 0 backend_bt: PSM=0x19 Alarm clock But no audio. Thanks for all the help!
Can you compile virtual_oss with debug support and try again? My guess is the device doesn't respond to one of the A2DP commands. --HPS
Minor success: my speaker works completely! However, my headphones are the issue at the moment. Using /usr/ports/audio/virtual_oss, compiling in debug mode gives no different result. Using virtual_oss.debug from your github doesn't work at all: bash: ./virtual_oss.debug: cannot execute binary file: Exec format error
HI, You might want to single step and backtrace from GDB the following line of code: backend_bt/avdtp.c: alarm(8); /* set timeout */ To figure out which command fails. You can also try to install and run: virtual_bt_speaker -d /dev/dspXXX Some A2DP devices try to connect back. There is also hcidump in ports, which gives you a .pcap file suitable for opening with wireshark. This will reveal where the protocol stops. --HPS
From wireshark: It seems that it's an issue with PSM ( https://i.imgur.com/5uL2eq7.png ): 42 0.870566 localhost () GnNetcom_96:9d:39 () L2CAP 21 Sent Connection Response - Refused - PSM not supported (SCID: 0x0980) A full pcap file can be downloaded here: https://pcap.honeynet.org.my/v1/submission/view.php?id=1602.php I can't install gdb at the moment, and virtual_bt_speaker errors while compiling: http://paste.pr0.tips/Io Given that it talks about PSM, I would guess that indeed it is trying to connect back. I guess it makes sense, since this pair of headphones integrates with Google Assistant.
Same PSM issues here. I'm on FreeBSD xxxx 12.0-RELEASE-p4 FreeBSD 12.0-RELEASE-p4 GENERIC amd64. My Headset is a YAMAY BH-M20. The user manual says it was capable of A2DP and AVRCP. Aug 31 17:12:33 xxxx kernel: ubt0: <Broadcom Corp BCM20702A0, rev 2.00/1.12, addr 5> on usbus0 I can't connect hccontrol-wise but also get the PSM errors mentioned above when trying virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 1024 -f /dev/bluetooth/00:6a:8e:17:3d:d4 -d dsp.bt regards Tom
(In reply to xbs from comment #54) Sorry, type mismatch: I CAN connect hccontrol-wise but also get the PSM errors mentioned above when trying virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 1024 -f /dev/bluetooth/00:6a:8e:17:3d:d4 -d dsp.bt
Hi I also have similar issue with error like: backend_bt: PSM=<hexadecimal number> backend_bt: PSM not found while trying to create vurtual_oss speaker with JBL Flik 4 and with Fioo uBTR devices. Any chances to resolve that issue? I am running FreeBSD 12.1 RELEASE BR Jacek
(In reply to Jacek from comment #56) I assume you mean "FiiO uBTR" devices? I have them working with the suggestion in comment #40: use "-R /dev/null -P /dev/bluetooth/<device>" instead of "-f /dev/bluetooth/<device>".
Just wanted to share another success story with Liberfeel-Y7 minispeaker on Lenovo L470 laptop with internal BT adapter (0x0a2b). First had to install the firmware as described at https://www.davidschlachter.com/misc/freebsd-intel-8265-bluetooth and restarted the Bluetooth service twice (sic), then followed instructions in comment #3 (except that `audio/virtual_oss' is in the ports now) and voila.
Created attachment 229901 [details] AVDTP discovery timeout with Bose QC35 headphones For what it's worth, I haven't yet been able to get virtual_oss to work with a pair of Bose QC35 headphones. I can establish a connection with hccontrol but virtual_oss never gets a response to its ADVTP_DISCOVER message. I have no idea why. I attached an hcidump capture in case anyone is able to provide a hint.
It sometimes also helps to have virtual_bt_speaker running.
(In reply to Hans Petter Selasky from comment #60) Thanks! That gets me a little further. Now the setup fails after sending GET_CAPABILITIES: when reading the response we get zero bytes back, so I guess the connection is dropped. Will dig a bit further.
(In reply to Mark Johnston from comment #61) This was PEBKAC, it works now! Thanks again. I had to start virtual_oss and then immediately run virtual_bt_speaker. It works but is a bit tedious to set up. I wonder why virtual_bt_speaker is a separate program, and whether it could be combined with virtual_oss. If that seems reasonable I could try to implement it, it'd make configuration via rc.d simpler. I also had to change the sample rate to 44100, unlike most of the examples in this thread, for what it's worth.
(In reply to Mark Johnston from comment #62) > I wonder why virtual_bt_speaker is a separate program, and whether it > could be combined with virtual_oss. I fully agree, this is quite confusing, it would be nice to have just one program that DTRT. > I also had to change the sample rate to 44100, unlike most of the > examples in this thread, for what it's worth. I have to do the same for flac123 to play my *.flac files, otherwise it complains: ao_oss ERROR: cannot set rate to 44100 Error opening ao device 0 MPlayer handles it better as it's able to detect the output sample rate: Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders AUDIO: 48000 Hz, 2 ch, floatle, 154.4 kbit/5.03% (ratio: 19305->384000) ... Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio)) ========================================================================== AO: [oss] 48000Hz 2ch s16le (2 bytes per sample) or, if virtual_oss(8) started with -r 44100: AO: [oss] 44100Hz 2ch s16le (2 bytes per sample) (In reply to Hans Petter Selasky from comment #33) > Also the volume control has not a maximum of 100 instead of 128. Hans, I still cannot figure out how to control volume of a BT speaker. I've started virtual_oss(8) with -T /dev/sndstat but cat'ing it still reports "No devices installed from userspace." and mixer ``mixer -a'' lists only snd_hda(4)-based devices (two ALC298 and Intel's HDMI/DP). What am I missing?
Hi Mark, You need to create the control device, then open that using virtual_oss_ctl (QT5 GUI) from ports. virtual_oss_ctl -h usage: virtual_oss_ctl -f /dev/vdsp.ctl Then you can change the volume and do some other stuff as needed. Virtual OSS also supports the volume IOCTLs on the dsp devices, but these must be invoked from the application itself. --HPS
(In reply to Hans Petter Selasky from comment #64) > usage: virtual_oss_ctl -f /dev/vdsp.ctl > > Then you can change the volume and do some other stuff as needed. Thanks, that helped indeed! It's a tad inconvenient that there's no one big master volume knob, one can only adjust Ch0 and Ch1 separately. But with that tool I can finally start using a BT speaker without hardware volume buttons and not waking up all neighbors. :-) > Virtual OSS also supports the volume IOCTLs on the dsp devices, but these > must be invoked from the application itself. Interesting: I can adjust volume in mpg123, but not in MPlayer for some reason. Need to check which IOCTLs exactly both are using.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=8e3cfe23a82ebd60c44b2d1855076ba0738ba9b8 commit 8e3cfe23a82ebd60c44b2d1855076ba0738ba9b8 Author: Christos Margiolis <christos@FreeBSD.org> AuthorDate: 2024-08-20 14:35:21 +0000 Commit: Christos Margiolis <christos@FreeBSD.org> CommitDate: 2024-08-20 14:35:21 +0000 audio/virtual_oss: Enable BT_SPEAKER by default There is no good reason not to have this option disabled by default. Most people nowadays want bluetooth support as well so it's good to have it enabled. PR: 203745 Requested by: Zahemszky Gábor <gabor@zahemszky.hu> Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: lwhsu, emaste Differential Revision: https://reviews.freebsd.org/D46376 audio/virtual_oss/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)