You are not logged in.

#1 2024-03-03 14:18:44

toljaga
Member
Registered: 2021-10-30
Posts: 10

[SOLVED] Filter certain Bluetooth services for certain MACs?

Hi,
I'm trying to stream audio via Bluetooth from my PS Vita to my PC running Arch.
I'm using KDE and Wayland and I would like to continue using them. (I'm also using KDE's Bluetooth tool bluedevil)
I'm able to pair, connect and resolve service UUIDs with the Vita normally using bluetoothctl.
The Vita is capable of standard A2DP (with SBC) and AVRCP.

Here is my problem: When I just connect them like this, The Vita is setup as an A2DP sink, and my computer is the A2DP source. Not only does this not work (The Vita shows up as an output device, but plays no audio through it when selected), but I am trying to achieve the inverse configuration. My idea is to somehow make my PC not resolve being an A2DP source with the Vita.
According to KDE, there is also a PAN setup (which I don't think is supported on the Vita, so I would like it disabled as well).

I'm not very well-versed in the bluetoothctl terms (or in Bluetooth in general) - I'm not sure what exactly are endpoints, transports, services and applications in this context, so I'm having a hard time achieving this.

I was, however, able to achieve a proof-of-concept of this using my laptop without a desktop environment or display manager. I ran

# bluealsa -p a2dp-sink

and, while that was running,

# bluealsa-aplay 00:00:00:00:00:00

and it worked perfectly. When running with both the sink and source profiles, the same issue would occur. I can't use this because whatever is running my bluetooth in the background decides to resolve every service, so it defaults to the undesired configuration described above.

To reiterate, I'm looking for a way to not resolve this configuration so it defaults to the one I want, or simply somehow resolve the desired one by default.


Thanks in advance.

Last edited by toljaga (2024-03-19 18:59:19)

Offline

#2 2024-03-19 18:57:51

toljaga
Member
Registered: 2021-10-30
Posts: 10

Re: [SOLVED] Filter certain Bluetooth services for certain MACs?

I was able to solve this by configuring WirePlumber (the PipeWire session manager I'm using) to not register as an a2dp source. If anyone ever somehow comes across this, you need to edit a config file, located in

/usr/share/wireplumber/bluetooth.lua.d/50-bluez-config.lua

Copy this file to your user config directory (~/.config/wireplumber) or the global one (/etc/wireplumber) and uncomment this line, and edit so that it does not contain a2dp_source. For me this was line 17. This is what my line looks like:

["bluez5.roles"] = "[ a2dp_sink hsp_hs hsp_ag hfp_ag hfp_hf]",

After this, just reboot (or reload the necessary services). Note that this disables your computer acting as a a2dp source altogether, which will make it not work with Bluetooth headphones. WirePlumber's config files are written in lua so you can probably just write lua code to check for MACs and register services accordingly, but I do not need this functionality and I can't be bothered. Also, I'm not familiar with lua. Refer to the wiki entry for WirePlumber and WirePlumber's docs for this.

Last edited by toljaga (2024-03-19 19:02:29)

Offline

Board footer

Powered by FluxBB