Bluetooth Bluez 5-从Bluez启动到iPhone的avrcp连接

Bluetooth Bluez 5-从Bluez启动到iPhone的avrcp连接,bluetooth,bluez,a2dp,avrcp,Bluetooth,Bluez,A2dp,Avrcp,布鲁兹5.28 目标-控制iOS跟踪跳过,并以编程方式从Bluez启动连接。我不想要a2dp 如果我从iPhone/iPad启动连接(进入BT设置,点击Pi设备),一切正常,我希望避免这样做,而不必去摆弄手机。(带Pi的车辆设置)。我有控制权、跟踪元数据等 在bluetoothctl中执行连接xx:xx:xx:xx:xx,将产生: a2dp-source profile connect failed for 6C:70:9F:7E:EF:A8: Protocol not available

布鲁兹5.28

目标-控制iOS跟踪跳过,并以编程方式从Bluez启动连接。我不想要a2dp

如果我从iPhone/iPad启动连接(进入BT设置,点击Pi设备),一切正常,我希望避免这样做,而不必去摆弄手机。(带Pi的车辆设置)。我有控制权、跟踪元数据等

在bluetoothctl中执行
连接xx:xx:xx:xx:xx
,将产生:

 a2dp-source profile connect failed for 6C:70:9F:7E:EF:A8: Protocol not available
嗯。它需要pulseaudio+模块。我安装了它,现在我可以从Bluez连接然而,它现在添加并自动选择Bluez作为音频输出设备。我不想这样,只好再摆弄电话。只需要控制。虽然我更喜欢这个,如果没有的话,因为我可以在操作系统的任何地方更改输出设备&不必去设置

好吧,让我一起禁用a2dp看看

/usr/libexec/bluetooth/bluetooth d-d-C-n--noplugin=a2dp

/usr/libexec/bluetooth/bluetooth d-d-C-n--plugin=avrcp

以上两种方法的结果相同

bluetoothd[14176]: src/device.c:connect_profiles() /org/bluez/hci0/dev_6C_70_9F_7E_EF_A8 (all), client :1.57
bluetoothd[14176]: src/device.c:connect_profiles() Resolving services for /org/bluez/hci0/dev_6C_70_9F_7E_EF_A8
bluetoothd[14176]: src/adapter.c:connected_callback() hci0 device 6C:70:9F:7E:EF:A8 connected eir_len 19
bluetoothd[14176]: src/device.c:search_cb() 6C:70:9F:7E:EF:A8: No service update
bluetoothd[14176]: src/device.c:device_svc_resolved() /org/bluez/hci0/dev_6C_70_9F_7E_EF_A8 err 0
bluetoothd[14176]: src/device.c:connect_profiles() /org/bluez/hci0/dev_6C_70_9F_7E_EF_A8 (all), client :1.57
bluetoothd[14176]: src/adapter.c:dev_disconnected() Device 6C:70:9F:7E:EF:A8 disconnected, reason 3
bluetoothd[14176]: src/adapter.c:adapter_remove_connection() 
bluetoothd[14176]: plugins/policy.c:disconnect_cb() reason 3
bluetoothd[14176]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr 6C:70:9F:7E:EF:A8 type 0 status 0xe
bluetoothd[14176]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e
bluetoothd[14176]: src/device.c:device_bonding_failed() status 14
bluetoothd[14176]: src/adapter.c:resume_discovery() 
同样,如果我进入蓝牙设置并点击iPhone上的设备,一切都会正常工作。问题是如何从Bluez连接

在我看来,iOS正在请求a2dp,我不知道如何让Bluez超越这一点,或者停止宣传它的可用性。我知道有一些越狱选项可以禁用配置文件,但要保持干净

我还尝试了HID设置,它可以发送击键信息,但它会隐藏屏幕上的键盘


谢谢

用源代码构建的5.28实现了我想要的功能,但不得不对其进行轻松编辑

不确定是否有副作用,但我的目标非常狭窄,所以我并不在乎

编辑
profiles/audio/avrcp.c

添加

.auto\u connect=true,

static struct btd_profile avrcp_target_profile={
@第3863行

static struct btd_profile avrcp_controller_profile={
@第3946行

make&&make-install

完整块

static struct btd_profile avrcp_controller_profile = {
        .name           = "avrcp-controller",
        .remote_uuid    = AVRCP_REMOTE_UUID,
        .device_probe   = avrcp_controller_probe,
        .device_remove  = avrcp_controller_remove,
        .auto_connect   = true,
        .connect        = avrcp_connect,
        .disconnect     = avrcp_disconnect,
        .adapter_probe  = avrcp_controller_server_probe,
        .adapter_remove = avrcp_controller_server_remove,
};

这与我想做的非常接近。您如何从BlueZ启动avrcp服务?假设这些是您必须安装的附加模块:
pulseaudio_6.0,pulseaudio模块蓝牙发现,pulseaudio模块蓝牙策略,pulseaudio-module-bluez5-device,pulseaudio-module-bluez5-discover
static struct btd_profile avrcp_controller_profile = {
        .name           = "avrcp-controller",
        .remote_uuid    = AVRCP_REMOTE_UUID,
        .device_probe   = avrcp_controller_probe,
        .device_remove  = avrcp_controller_remove,
        .auto_connect   = true,
        .connect        = avrcp_connect,
        .disconnect     = avrcp_disconnect,
        .adapter_probe  = avrcp_controller_server_probe,
        .adapter_remove = avrcp_controller_server_remove,
};