summaryrefslogtreecommitdiffstats
path: root/samsung-ril.c
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2020-10-15 08:24:47 +0200
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2021-01-01 23:54:56 +0100
commite593f410d7c3f0924033e71c84dcb1ace32fd6a0 (patch)
treedbc1fe7366b4c13189e10f74d78ae1d7683c2149 /samsung-ril.c
parent1f4962b5d11e5e3567e6a78ecce7207ed3ef438e (diff)
downloadhardware_replicant_libsamsung-ril-master.tar.gz
hardware_replicant_libsamsung-ril-master.tar.bz2
hardware_replicant_libsamsung-ril-master.zip
Convert to use separate SIM statusHEADreplicant-6.0-0004-rc4master
In 2001, in the RIL repository[1], the SIM states were separated from the radio states by the following commit: 2bc78d614e349574426d198c37e51ccb7455b5bb 2bc78d61 Separate SIM states from Radio States Then in 2016 the SIM states were removed from the RADIO_STATES by the following commit: 2baf72329c43d9e3f7850973f087176f535e31e8 2baf7232 Remove deprecated RADIO_STATES So to be compatible with recent rild, we need to convert the code to use separate SIM states. This was tested on Replicant 4.2 with a Galaxy SIII (GT-I9300) and a Nexus S (GT-I9023) and in both cases: - It compiled fine - Calling worked fine too: I called an invalid number I got an automatic voice reply telling me that this number was invalid. Similarly that was also tested on Replicant 6.0 0004 RC3 both by compiling it and calling an invalid number, as this commit was part of the Replicant 6.0 0004 RC3 release. Since then only the commit message was modified to add information about the tests as it didn't have them but had the following text instead: TODO: - Test this code with Replicant 4.2!!!! [1]https://android.googlesource.com/platform/hardware/ril Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Diffstat (limited to 'samsung-ril.c')
-rw-r--r--samsung-ril.c47
1 files changed, 41 insertions, 6 deletions
diff --git a/samsung-ril.c b/samsung-ril.c
index 31d0244..6378c23 100644
--- a/samsung-ril.c
+++ b/samsung-ril.c
@@ -1197,20 +1197,36 @@ int ril_radio_state_update(RIL_RadioState radio_state)
}
/*
+ * RIL SIM state
+ */
+
+int ril_sim_state_update(enum sim_state sim_state)
+{
+ if (ril_data == NULL)
+ return -1;
+
+ if (ril_data->sim_state == sim_state)
+ return 0;
+
+ RIL_LOGD("Updating RIL SIM state to %d", sim_state);
+
+ ril_data->sim_state = sim_state;
+
+ ril_request_unsolicited(RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED, NULL, 0);
+
+ return 0;
+}
+
+/*
* Returns 0 if the RIL has reached the given radio_state
* Returns -1 otherwise
*/
int ril_radio_has_reached_state(RIL_RadioState given_state)
{
RIL_RadioState radio_states[] = {
- RADIO_STATE_UNAVAILABLE,
RADIO_STATE_OFF,
+ RADIO_STATE_UNAVAILABLE,
RADIO_STATE_ON,
- RADIO_STATE_NV_NOT_READY,
- RADIO_STATE_NV_READY,
- RADIO_STATE_SIM_NOT_READY,
- RADIO_STATE_SIM_LOCKED_OR_ABSENT,
- RADIO_STATE_SIM_READY,
};
RIL_RadioState curr_state;
@@ -1243,6 +1259,25 @@ int ril_radio_has_reached_state(RIL_RadioState given_state)
}
/*
+ * Returns 0 if the RIL has reached the given sim_state
+ * Returns -1 otherwise
+ */
+int ril_sim_has_reached_state(enum sim_state given_state)
+{
+ enum sim_state curr_state;
+
+ if (ril_data == NULL)
+ return -1;
+
+ curr_state = ril_data->sim_state;
+
+ if (curr_state < given_state)
+ return -1;
+
+ return 0;
+}
+
+/*
* RIL data
*/