From a8f609727dcd1354d137ec0407aff6451bfa08cb Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Tue, 10 Oct 2017 14:36:13 -0700 Subject: [PATCH] sim: new API to check for a UST service only The existing service check API takes both SST and UST services and could inadvertently return success on a service if one (SST or UST) service did not exist. This adds an API specifically for checking for a UST service, and if the UST dir is not available it will return FALSE, rather than possibly returning true on some other SST service. --- src/ofono.h | 2 ++ src/sim.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/ofono.h b/src/ofono.h index 0da11a2b..bac4b481 100644 --- a/src/ofono.h +++ b/src/ofono.h @@ -370,6 +370,8 @@ unsigned short __ofono_sms_get_next_ref(struct ofono_sms *sms); #include +ofono_bool_t __ofono_sim_ust_service_available(struct ofono_sim *sim, + int ust_service); ofono_bool_t __ofono_sim_service_available(struct ofono_sim *sim, int ust_service, int sst_service); diff --git a/src/sim.c b/src/sim.c index ac5b6fde..88c04219 100644 --- a/src/sim.c +++ b/src/sim.c @@ -2289,6 +2289,15 @@ const unsigned char *ofono_sim_get_cphs_service_table(struct ofono_sim *sim) return sim->cphs_service_table; } +ofono_bool_t __ofono_sim_ust_service_available(struct ofono_sim *sim, + int ust_service) +{ + if (sim->efust) + return sim_ust_is_available(sim->efust, sim->efust_length, + ust_service); + return FALSE; +} + ofono_bool_t __ofono_sim_service_available(struct ofono_sim *sim, int ust_service, int sst_service)