Audio on bluetooth with virtual_oss

TLoe

Member


Messages: 39

I had some driver issues, but got past that.. now I am able to connect to my speaker and it makes the connection sound and then I get a DISCOVER FAILED message and it makes the disconnection sound and it runs in a loop until I force quit it.. its the same for both my BT speaker (UE boom3) and my BT headset (RHA ma650)

Code:
➜  ~ sudo virtual_oss -C 2 -c 2 -r 22050 -b 16 -s 768 -R /dev/null -P /dev/bluetooth/boom3 -d dsp
hw.snd.basename_clone: 0 -> 0
backend_bt: PSM=0x19
backend_bt: DISCOVER FAILED
backend_bt: PSM=0x19
backend_bt: DISCOVER FAILED
^C
➜  ~ sudo virtual_oss -C 2 -c 2 -r 22050 -b 16 -s 768 -R /dev/null -P /dev/bluetooth/rha -d dsp
hw.snd.basename_clone: 0 -> 0
backend_bt: PSM=0x19
backend_bt: DISCOVER FAILED
backend_bt: PSM=0x19
backend_bt: DISCOVER FAILED
I can connect to both of them with hccontrol. Here I'm connecting to the headset:

Code:
➜  ~ hccontrol -n ubt0hci inquiry
Inquiry result, num_responses=1
Inquiry result #0
    BD_ADDR: RHA
    Page Scan Rep. Mode: 0x1
    Page Scan Period Mode: 00
    Page Scan Mode: 00
    Class: 24:04:04
    Clock offset: 0x4b86
Inquiry complete. Status: No error [00]
➜  ~ sudo hccontrol -n ubt0hci create_connection RHA  
Password:
Status: Page timeout [0x4]
➜  ~ sudo hccontrol -n ubt0hci create_connection RHA
BD_ADDR: RHA
Connection handle: 256
Encryption mode: Disabled [0]
➜  ~ hccontrol -n ubt0hci read_connection_list
Remote BD_ADDR    Handle Type Mode Role Encrypt Pending Queue State
RHA                  256  ACL    0 MAST    NONE       0     0 OPEN
➜  ~
 

hselasky@

Member
Developer

Reaction score: 21
Messages: 81

Hi,

I think you need to enable the encryption mode before it will work.

write_encryption_mode mode(0|1|2)

--HPS
 
OP
T

TLoe

Member


Messages: 39

Tried with 0 (default) and 1 with the same result. When I tried to set 2 I got "Status: Unsupported feature or parameter value [0x11]"
 
OP
T

TLoe

Member


Messages: 39

Busy days so slow reply

Yes I followed the advice there.

I have both SDPD and HCSECD running.. I've tried configuring both manualy and with the bluetooth-config scrip and end up with the same result.
 

hselasky@

Member
Developer

Reaction score: 21
Messages: 81

Did you try to build and start the virtual_bt_speaker utility . See separate port option for virtual_oss. Some BT audio devices connect back before they work. Else you might start to look at hcidump in ports, which can trace all BT traffic, and the resulting trace file can be opened by wireshark.
 
OP
T

TLoe

Member


Messages: 39

No I didn't try that actually.

How do I know what /dev/dspXXX to use?
 
OP
T

TLoe

Member


Messages: 39

Tried with all of them, but getting:

Starting to listen
Registering service via SDP
SDP failed to register: Input/output error
Failed to register in SDP

 

hselasky@

Member
Developer

Reaction score: 21
Messages: 81

Is your sdpd running and up-to-date with the latest available in your -stable branch?
 
OP
T

TLoe

Member


Messages: 39

Yes sdpd is running.

There is no available updates with freebsd-update fetch and I just ran a pkg upgrade.
 
OP
T

TLoe

Member


Messages: 39

Jan 2 14:17:45 T sdpd[1475]: Could not process SDP request from control socket, pdu->pid=129, pdu->tid=1, pdu->len=14, len=19, error=3
 

hselasky@

Member
Developer

Reaction score: 21
Messages: 81

What version of FreeBSD is this? Maybe you need to compile SDPD from stable-source.
 
OP
T

TLoe

Member


Messages: 39


➜ ~ uname -a
FreeBSD T 12.1-RELEASE-p1 FreeBSD 12.1-RELEASE-p1 GENERIC amd64
 

hselasky@

Member
Developer

Reaction score: 21
Messages: 81

It looks like you have all the right patches. You should have the following definitions:

Code:
grep -r audio_sink /usr/include/
/usr/include/sdp.h:struct sdp_audio_sink_profile
/usr/include/sdp.h:typedef struct sdp_audio_sink_profile    sdp_audio_sink_profile_t;
/usr/include/sdp.h:typedef struct sdp_audio_sink_profile    *sdp_audio_sink_profile_p;
Have you tried another USB bluetooth dongle?
 
OP
T

TLoe

Member


Messages: 39

Hmm.. that returns nothing here..

I don't build the system myself though..

Don't have another usb dongle.. This is the internal in a dell XPS 13
 
OP
T

TLoe

Member


Messages: 39

Hum.. Think I have the latest? freebsd-update fetch and install says there is nothing to update?

And I am on 12.1 as the uname -a shows above?

Isn't this in 12.1-RELEASE-p1?
 

hselasky@

Member
Developer

Reaction score: 21
Messages: 81

There were some recent changes made to SDPD and sdp.h which you need.
Among the patches you need is this one r344144 (Feb 15 2019) and 12.1 was branched in September. Maybe you didn't opt for updating the header files and sources?
 

hselasky@

Member
Developer

Reaction score: 21
Messages: 81

If it doesn't work and you are sure you have the latest binary and sources, then you need to analyze the hcidump in wireshark to figure out where the protocol goes wrong.
 
OP
T

TLoe

Member


Messages: 39

Sorry.. realized wireshark would take some time to get into and didn't have the time..

Got the hcidump loaded in wireshark now.. not sure, but it seems like the speaker is trying to send a connection request for AVCTP-control and that the system does not support it?
 

hselasky@

Member
Developer

Reaction score: 21
Messages: 81

Sorry.. realized wireshark would take some time to get into and didn't have the time..

Got the hcidump loaded in wireshark now.. not sure, but it seems like the speaker is trying to send a connection request for AVCTP-control and that the system does not support it?
AVCTP-control is not supported, but you could implement it if you know how.

--HPS
 
OP
T

TLoe

Member


Messages: 39

Hmm.. right, but is that what makes it fail? Should it be able to playback without it?

Realized the link I posted to expired after 10 minutes. Zip seems to work though :)

The first file is for virtual_oss dump and the second is for when I run virtual_bt_speaker.. that seems to get a connection, but the audio isn't comming from the speaker..
 

Attachments

hselasky@

Member
Developer

Reaction score: 21
Messages: 81

I don't know. Maybe the firmware of your audio devices has certain expectations about the BT host it connects to. Maybe all you need is to ACK a few AVCTP-control commands and it will work ... The specifications you'll find on the internet and also in the Linux kernel.
 
OP
T

TLoe

Member


Messages: 39

Hmm right.. might look into it later if I get time. Where can I find the code for this?
 
Top