pmaports/temp/pulseaudio/0014-bluetooth-support-AT-CLIP.patch
Dylan Van Assche f9c7ffa9b6
temp/pulseaudio: fork for Bluetooth HFP/HSP support (MR 3080)
PulseAudio is used for handling all audio on postmarketOS.
This also involves Bluetooth audio such as A2DP, HSP and HFP audio.
In the case of HFP/HSP, the HF and AG can interact with each other
through AT commands defined in the Bluetooth HFP 1.8 spec.

This set of patches implements HFP support to allow Bluetooth devices
to accept/reject/hangup calls, dial numbers, DTMF tone generation,
query signal strength, roaming status, service status, AG battery level,
call status, etc.

More details in the upstream MR:
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/693

Available in edge for testing this merge request with a broader user
base. Not intended for backporting to stable branches.

[ci:skip-build]: already built successfully in CI
2022-06-16 09:33:35 +02:00

60 lines
2.2 KiB
Diff

From 07adf1b246ba1db7b4c5bb9555f1d392b856c049 Mon Sep 17 00:00:00 2001
From: Dylan Van Assche <me@dylanvanassche.be>
Date: Thu, 14 Apr 2022 20:52:36 +0200
Subject: [PATCH 14/26] bluetooth: support AT+CLIP
Enable or disable Call Line Indication reporting (+CLIP) when
a call is incoming to display the number that is calling on the HF's
screen.
---
src/modules/bluetooth/backend-native.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/modules/bluetooth/backend-native.c b/src/modules/bluetooth/backend-native.c
index fcbae5540..1eaa36b4a 100644
--- a/src/modules/bluetooth/backend-native.c
+++ b/src/modules/bluetooth/backend-native.c
@@ -62,6 +62,7 @@ struct pa_bluetooth_backend {
bool cmee_extended_error_reporting_enabled;
uint32_t cind_enabled_indicators;
pa_bluetooth_cops_t cops_format;
+ bool clip_call_line_reporting_enabled;
PA_LLIST_HEAD(pa_dbus_pending, pending);
};
@@ -751,6 +752,22 @@ static bool hfp_rfcomm_handle(int fd, pa_bluetooth_transport *t, const char *buf
rfcomm_write_response(fd, "+CNUM: ,\"%s\",%d,,4", number, type);
return true;
+ } else if (sscanf(buf, "AT+CLIP=%d", &val) == 1) {
+ switch(val) {
+ /* Disable call line reporting */
+ case 0:
+ discovery->native_backend->clip_call_line_reporting_enabled = false;
+ return true;
+ /* Enable call line reporting */
+ case 1:
+ discovery->native_backend->clip_call_line_reporting_enabled = true;
+ return true;
+ default:
+ pa_log_warn("Unknown AT+CLIP value: %d", val);
+ rfcomm_write_error(discovery->native_backend, fd, CMEE_AG_FAILURE);
+ return false;
+ }
+ pa_assert_not_reached();
}
/* first-time initialize selected codec to CVSD */
@@ -1553,6 +1570,9 @@ pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_d
/* CMEE is disabled by default */
backend->cmee_extended_error_reporting_enabled = false;
+ /* CLIP is disabled by default */
+ backend->clip_call_line_reporting_enabled = false;
+
return backend;
}
--
2.35.1