diff options
author | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2022-02-23 17:39:44 +0100 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2022-02-23 18:11:33 +0100 |
commit | af3a9c29040e12a6518d6c9ebfc33e5c84c96cd9 (patch) | |
tree | 2d089ac1e173cedacb755317126bd7b9930e36e6 | |
parent | 001c859880de24af0c5219a2638fff3100ee5cd2 (diff) | |
download | hardware_replicant_libsamsung-ril-af3a9c29040e12a6518d6c9ebfc33e5c84c96cd9.tar.gz hardware_replicant_libsamsung-ril-af3a9c29040e12a6518d6c9ebfc33e5c84c96cd9.tar.bz2 hardware_replicant_libsamsung-ril-af3a9c29040e12a6518d6c9ebfc33e5c84c96cd9.zip |
[WIP] calls: handle caller ID in Replicant 6.0caller-id
In Replicant 6.0, if we launch the dialer application and select the
menu (the icon with 3 dots) and go in Settings -> Calls -> Additional
settings, we have a popup with the following content:
Call settings error
Network or SIM card error.
[OK]
and in the background we can see:
Caller ID
Loading settings...
___________________________________________
Call waiting
During a call, notify me of incoming calls
___________________________________________
My phone number
S[unreadable text as it's below the popup]
___________________________________________
And the following appears in the logcat radio logs:
D RILJ : [4359]> GET_CLIR [SUB0]
D RIL : 1 RIL request in the queue (1 pending, 0 handled, 0 unhandled)
D RIL : Unhandled RIL request: 31
D RIL : 0 RIL request in the queue (0 pending, 0 handled, 0 unhandled)
D RilRequest: [4359]< GET_CLIR error: com.android.internal.telephony.CommandException: REQUEST_NOT_SUPPORTED ret=
D RILJ : [4360]> QUERY_CALL_WAITING 0 [SUB0]
D RIL : 1 RIL request in the queue (1 pending, 0 handled, 0 unhandled)
D RIL : Unhandled RIL request: 35
D RIL : 0 RIL request in the queue (0 pending, 0 handled, 0 unhandled)
D RilRequest: [4360]< QUERY_CALL_WAITING error: com.android.internal.telephony.CommandException: REQUEST_NOT_SUPPORTED ret=
So we need to handle RIL_REQUEST_GET_CLIR / RIL_REQUEST_SET_CLIR to be
able to handle the caller ID settings.
+------+
| TODO |
+------+
- Test with Replicant 4.2
- Test with Replicant 6.0
- Test with Replicant 11
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r-- | call.c | 28 | ||||
-rw-r--r-- | samsung-ril.c | 8 | ||||
-rw-r--r-- | samsung-ril.h | 3 |
3 files changed, 37 insertions, 2 deletions
@@ -79,7 +79,7 @@ int ril_request_dial(void *data, size_t size, RIL_Token token) unsigned char prefix; int rc; - if (data == NULL || size < sizeof(RIL_Dial)) + if (data == NULL || size < sizeof(RIL_Dial) || ril_data == NULL) goto error; rc = ril_radio_has_reached_state(RADIO_STATE_ON); @@ -91,7 +91,7 @@ int ril_request_dial(void *data, size_t size, RIL_Token token) if (dial->address == NULL) goto error; - identity = ril2ipc_call_identity(dial->clir); + identity = ril2ipc_call_identity(ril_data->identity); prefix = dial->address[0] == '+' ? IPC_CALL_PREFIX_INTL : IPC_CALL_PREFIX_NONE; @@ -739,3 +739,27 @@ int ril_request_dtmf_stop(__attribute__((unused)) void *data, return RIL_REQUEST_HANDLED; } + +int ril_request_get_clir(void *data, size_t size, RIL_Token token) +{ + if (data == NULL || size < sizeof(char) || ril_data == NULL) { + ril_request_complete(token, RIL_E_GENERIC_FAILURE, NULL, 0); + return RIL_REQUEST_COMPLETED; + } + + *(int*)data = ril_data->identity; + + return RIL_REQUEST_HANDLED; +} + +int ril_request_set_clir(void *data, size_t size, RIL_Token token) +{ + if (data == NULL || size < sizeof(char) || ril_data == NULL) { + ril_request_complete(token, RIL_E_GENERIC_FAILURE, NULL, 0); + return RIL_REQUEST_COMPLETED; + } + + ril_data->identity = *(int*)data; + + return RIL_REQUEST_HANDLED; +} diff --git a/samsung-ril.c b/samsung-ril.c index aaeedeb..d7dd739 100644 --- a/samsung-ril.c +++ b/samsung-ril.c @@ -306,6 +306,14 @@ struct ril_request_handler ril_request_handlers[] = { .request = RIL_REQUEST_DTMF_STOP, .handler = ril_request_dtmf_stop, }, + { + .request = RIL_REQUEST_GET_CLIR, + .handler = ril_request_get_clir, + }, + { + .request = RIL_REQUEST_SET_CLIR, + .handler = ril_request_get_clir, + }, /* SMS */ { .request = RIL_REQUEST_SEND_SMS, diff --git a/samsung-ril.h b/samsung-ril.h index 8cc012d..fe852c7 100644 --- a/samsung-ril.h +++ b/samsung-ril.h @@ -238,6 +238,7 @@ struct ril_data { RIL_RadioState radio_state; enum sim_state sim_state; char *sim_pin; + int identity; struct list_head *requests; struct list_head *requests_data; @@ -285,6 +286,8 @@ int ril_request_dtmf_start_complete(unsigned char aseq, char tone); int ril_request_dtmf_start(void *data, size_t size, RIL_Token token); int ril_request_dtmf_stop_complete(unsigned char aseq, int callback); int ril_request_dtmf_stop(void *data, size_t size, RIL_Token token); +int ril_request_get_clir(void *data, size_t size, RIL_Token token); +int ril_request_set_clir(void *data, size_t size, RIL_Token token); /* * SMS |