forked from sailfishos/ofono
Compare commits
3 Commits
mer/1.21+g
...
mer/1.14+g
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72395683a1 | ||
|
|
f595d0fae0 | ||
|
|
a170c3a01e |
@@ -142,7 +142,8 @@ builtin_sources += drivers/rilmodem/rilmodem.h \
|
||||
drivers/rilmodem/call-settings.c \
|
||||
drivers/rilmodem/call-forwarding.c \
|
||||
drivers/rilmodem/cbs.c \
|
||||
drivers/rilmodem/oemraw-messages.c
|
||||
drivers/rilmodem/oemraw-messages.c \
|
||||
drivers/rilmodem/call-barring.c
|
||||
|
||||
endif
|
||||
|
||||
|
||||
310
ofono/drivers/rilmodem/call-barring.c
Normal file
310
ofono/drivers/rilmodem/call-barring.c
Normal file
@@ -0,0 +1,310 @@
|
||||
/*
|
||||
*
|
||||
* oFono - Open Source Telephony
|
||||
*
|
||||
* Copyright (C) 2014 Jolla Ltd
|
||||
* Contact: Miia Leinonen
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <ofono/log.h>
|
||||
#include <ofono/modem.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "gril.h"
|
||||
#include "call-barring.h"
|
||||
#include "rilmodem.h"
|
||||
#include "ril_constants.h"
|
||||
|
||||
/* See 3GPP 27.007 7.4 for possible values */
|
||||
#define RIL_MAX_SERVICE_LENGTH 3
|
||||
|
||||
/*
|
||||
* ril.h does not state that string count must be given, but that is
|
||||
* still expected by the modem
|
||||
*/
|
||||
#define RIL_QUERY_STRING_COUNT 4
|
||||
#define RIL_SET_STRING_COUNT 5
|
||||
#define RIL_SET_PW_STRING_COUNT 3
|
||||
|
||||
#define RIL_LENGTH_ZERO 0
|
||||
|
||||
struct barring_data {
|
||||
GRil *ril;
|
||||
guint timer_id;
|
||||
};
|
||||
|
||||
static void ril_call_barring_query_cb(struct ril_msg *message,
|
||||
gpointer user_data)
|
||||
{
|
||||
struct cb_data *cbd = user_data;
|
||||
struct parcel rilp;
|
||||
struct ofono_error error;
|
||||
ofono_call_barring_query_cb_t cb = cbd->cb;
|
||||
int bearer_class = 0;
|
||||
|
||||
if (message->error != RIL_E_SUCCESS) {
|
||||
ofono_error("Call Barring query failed, err: %i",
|
||||
message->error);
|
||||
decode_ril_error(&error, "FAIL");
|
||||
goto out;
|
||||
}
|
||||
|
||||
ril_util_init_parcel(message, &rilp);
|
||||
|
||||
/*
|
||||
* Services for which the specified barring facility is active.
|
||||
* "0" means "disabled for all, -1 if unknown"
|
||||
*/
|
||||
parcel_r_int32(&rilp); /* count - we know there is only 1 */
|
||||
bearer_class = parcel_r_int32(&rilp);
|
||||
DBG("Active services: %i", bearer_class);
|
||||
|
||||
decode_ril_error(&error, "OK");
|
||||
|
||||
out:
|
||||
cb(&error, bearer_class, cbd->data);
|
||||
}
|
||||
|
||||
static void ril_call_barring_query(struct ofono_call_barring *cb,
|
||||
const char *lock, int cls,
|
||||
ofono_call_barring_query_cb_t callback,
|
||||
void *data)
|
||||
{
|
||||
struct barring_data *bd = ofono_call_barring_get_data(cb);
|
||||
struct cb_data *cbd = cb_data_new(callback, data);
|
||||
struct parcel rilp;
|
||||
int ret = 0;
|
||||
char cls_textual[RIL_MAX_SERVICE_LENGTH];
|
||||
|
||||
DBG("lock: %s, services to query: %i", lock, cls);
|
||||
|
||||
/*
|
||||
* RIL modems do not support 7 as default bearer class. According to
|
||||
* the 22.030 Annex C: When service code is not given it corresponds to
|
||||
* "All tele and bearer services"
|
||||
*/
|
||||
if (cls == BEARER_CLASS_DEFAULT)
|
||||
cls = SERVICE_CLASS_NONE;
|
||||
|
||||
sprintf(cls_textual, "%d", cls);
|
||||
|
||||
/*
|
||||
* See 3GPP 27.007 7.4 for parameter descriptions.
|
||||
* According to ril.h password should be empty string "" when not
|
||||
* needed, but in reality we only need to give string length as 0
|
||||
*/
|
||||
parcel_init(&rilp);
|
||||
parcel_w_int32(&rilp, RIL_QUERY_STRING_COUNT); /* Nbr of strings */
|
||||
parcel_w_string(&rilp, (char *) lock); /* Facility code */
|
||||
parcel_w_int32(&rilp, RIL_LENGTH_ZERO); /* Password length */
|
||||
parcel_w_string(&rilp, (char *) cls_textual);
|
||||
parcel_w_string(&rilp, NULL); /* AID (for FDN, not yet supported) */
|
||||
|
||||
ret = g_ril_send(bd->ril, RIL_REQUEST_QUERY_FACILITY_LOCK,
|
||||
rilp.data, rilp.size, ril_call_barring_query_cb,
|
||||
cbd, g_free);
|
||||
|
||||
parcel_free(&rilp);
|
||||
|
||||
if (ret <= 0) {
|
||||
ofono_error("Sending Call Barring query failed, err: %i", ret);
|
||||
g_free(cbd);
|
||||
CALLBACK_WITH_FAILURE(callback, -1, data);
|
||||
}
|
||||
}
|
||||
|
||||
static void ril_call_barring_set_cb(struct ril_msg *message, gpointer user_data)
|
||||
{
|
||||
struct cb_data *cbd = user_data;
|
||||
struct ofono_error error;
|
||||
ofono_call_barring_set_cb_t cb = cbd->cb;
|
||||
|
||||
if (message->error != RIL_E_SUCCESS) {
|
||||
ofono_error("Call Barring Set request failed, err: %i",
|
||||
message->error);
|
||||
decode_ril_error(&error, "FAIL");
|
||||
goto out;
|
||||
}
|
||||
|
||||
decode_ril_error(&error, "OK");
|
||||
|
||||
out:
|
||||
cb(&error, cbd->data);
|
||||
}
|
||||
|
||||
static void ril_call_barring_set(struct ofono_call_barring *cb,
|
||||
const char *lock, int enable,
|
||||
const char *passwd, int cls,
|
||||
ofono_call_barring_set_cb_t callback,
|
||||
void *data)
|
||||
{
|
||||
struct barring_data *bd = ofono_call_barring_get_data(cb);
|
||||
struct cb_data *cbd = cb_data_new(callback, data);
|
||||
struct parcel rilp;
|
||||
int ret = 0;
|
||||
char cls_textual[RIL_MAX_SERVICE_LENGTH];
|
||||
|
||||
DBG("lock: %s, enable: %i, bearer class: %i", lock, enable, cls);
|
||||
|
||||
/*
|
||||
* RIL modem does not support 7 as default bearer class. According to
|
||||
* the 22.030 Annex C: When service code is not given it corresponds to
|
||||
* "All tele and bearer services"
|
||||
*/
|
||||
if (cls == BEARER_CLASS_DEFAULT)
|
||||
cls = SERVICE_CLASS_NONE;
|
||||
|
||||
sprintf(cls_textual, "%d", cls);
|
||||
|
||||
/* See 3GPP 27.007 7.4 for parameter descriptions */
|
||||
parcel_init(&rilp);
|
||||
parcel_w_int32(&rilp, RIL_SET_STRING_COUNT); /* Nbr of strings */
|
||||
parcel_w_string(&rilp, (char *) lock); /* Facility code */
|
||||
|
||||
if (enable)
|
||||
parcel_w_string(&rilp, RIL_FACILITY_LOCK);
|
||||
else
|
||||
parcel_w_string(&rilp, RIL_FACILITY_UNLOCK);
|
||||
|
||||
parcel_w_string(&rilp, (char *) passwd);
|
||||
parcel_w_string(&rilp, (char *) cls_textual);
|
||||
parcel_w_string(&rilp, NULL); /* AID (for FDN, not yet supported) */
|
||||
|
||||
ret = g_ril_send(bd->ril, RIL_REQUEST_SET_FACILITY_LOCK,
|
||||
rilp.data, rilp.size, ril_call_barring_set_cb,
|
||||
cbd, g_free);
|
||||
|
||||
parcel_free(&rilp);
|
||||
|
||||
if (ret <= 0) {
|
||||
ofono_error("Sending Call Barring Set request failed, err: %i",
|
||||
ret);
|
||||
g_free(cbd);
|
||||
CALLBACK_WITH_FAILURE(callback, data);
|
||||
}
|
||||
}
|
||||
|
||||
static void ril_call_barring_set_passwd_cb(struct ril_msg *message,
|
||||
gpointer user_data)
|
||||
{
|
||||
struct cb_data *cbd = user_data;
|
||||
struct ofono_error error;
|
||||
ofono_call_barring_set_cb_t cb = cbd->cb;
|
||||
|
||||
if (message->error != RIL_E_SUCCESS) {
|
||||
ofono_error("Call Barring Set PW req failed, err: %i",
|
||||
message->error);
|
||||
decode_ril_error(&error, "FAIL");
|
||||
goto out;
|
||||
}
|
||||
|
||||
decode_ril_error(&error, "OK");
|
||||
|
||||
out:
|
||||
cb(&error, cbd->data);
|
||||
}
|
||||
|
||||
static void ril_call_barring_set_passwd(struct ofono_call_barring *barr,
|
||||
const char *lock,
|
||||
const char *old_passwd,
|
||||
const char *new_passwd,
|
||||
ofono_call_barring_set_cb_t cb,
|
||||
void *data)
|
||||
{
|
||||
struct barring_data *bd = ofono_call_barring_get_data(barr);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
struct parcel rilp;
|
||||
int ret = 0;
|
||||
|
||||
DBG("");
|
||||
|
||||
parcel_init(&rilp);
|
||||
parcel_w_int32(&rilp, RIL_SET_PW_STRING_COUNT); /* Nbr of strings */
|
||||
parcel_w_string(&rilp, (char *) lock); /* Facility code */
|
||||
parcel_w_string(&rilp, (char *) old_passwd);
|
||||
parcel_w_string(&rilp, (char *) new_passwd);
|
||||
|
||||
ret = g_ril_send(bd->ril, RIL_REQUEST_CHANGE_BARRING_PASSWORD,
|
||||
rilp.data, rilp.size, ril_call_barring_set_passwd_cb,
|
||||
cbd, g_free);
|
||||
|
||||
parcel_free(&rilp);
|
||||
|
||||
if (ret <= 0) {
|
||||
ofono_error("Sending Call Barring Set PW req failed, err: %i",
|
||||
ret);
|
||||
g_free(cbd);
|
||||
CALLBACK_WITH_FAILURE(cb, data);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean ril_delayed_register(gpointer user_data)
|
||||
{
|
||||
struct ofono_call_barring *cb = user_data;
|
||||
struct barring_data *bd = ofono_call_barring_get_data(cb);
|
||||
|
||||
bd->timer_id = 0;
|
||||
|
||||
ofono_call_barring_register(cb);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int ril_call_barring_probe(struct ofono_call_barring *cb,
|
||||
unsigned int vendor, void *user)
|
||||
{
|
||||
GRil *ril = user;
|
||||
struct barring_data *bd = g_try_new0(struct barring_data, 1);
|
||||
|
||||
bd->ril = g_ril_clone(ril);
|
||||
ofono_call_barring_set_data(cb, bd);
|
||||
g_timeout_add_seconds(2, ril_delayed_register, cb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ril_call_barring_remove(struct ofono_call_barring *cb)
|
||||
{
|
||||
struct barring_data *data = ofono_call_barring_get_data(cb);
|
||||
ofono_call_barring_set_data(cb, NULL);
|
||||
|
||||
if (data->timer_id > 0)
|
||||
g_source_remove(data->timer_id);
|
||||
|
||||
g_ril_unref(data->ril);
|
||||
g_free(data);
|
||||
}
|
||||
|
||||
static struct ofono_call_barring_driver driver = {
|
||||
.name = "rilmodem",
|
||||
.probe = ril_call_barring_probe,
|
||||
.remove = ril_call_barring_remove,
|
||||
.query = ril_call_barring_query,
|
||||
.set = ril_call_barring_set,
|
||||
.set_passwd = ril_call_barring_set_passwd
|
||||
};
|
||||
|
||||
void ril_call_barring_init(void)
|
||||
{
|
||||
ofono_call_barring_driver_register(&driver);
|
||||
}
|
||||
|
||||
void ril_call_barring_exit(void)
|
||||
{
|
||||
ofono_call_barring_driver_unregister(&driver);
|
||||
}
|
||||
@@ -53,6 +53,7 @@ static int rilmodem_init(void)
|
||||
ril_ussd_init();
|
||||
ril_call_settings_init();
|
||||
ril_call_forwarding_init();
|
||||
ril_call_barring_init();
|
||||
ril_cbs_init();
|
||||
ril_oemraw_init();
|
||||
|
||||
@@ -76,6 +77,7 @@ static void rilmodem_exit(void)
|
||||
ril_ussd_exit();
|
||||
ril_call_settings_exit();
|
||||
ril_call_forwarding_exit();
|
||||
ril_call_barring_exit();
|
||||
ril_cbs_exit();
|
||||
ril_oemraw_exit();
|
||||
}
|
||||
|
||||
@@ -68,6 +68,9 @@ extern void ril_call_settings_exit(void);
|
||||
extern void ril_call_forwarding_init(void);
|
||||
extern void ril_call_forwarding_exit(void);
|
||||
|
||||
extern void ril_call_barring_init(void);
|
||||
extern void ril_call_barring_exit(void);
|
||||
|
||||
extern void ril_cbs_init(void);
|
||||
extern void ril_cbs_exit(void);
|
||||
|
||||
|
||||
@@ -74,10 +74,6 @@
|
||||
#define ENTER_SIM_PUK_PARAMS 3
|
||||
#define CHANGE_SIM_PIN_PARAMS 3
|
||||
|
||||
/* RIL_FACILITY_LOCK parameters */
|
||||
#define RIL_FACILITY_UNLOCK "0"
|
||||
#define RIL_FACILITY_LOCK "1"
|
||||
|
||||
/* Current SIM */
|
||||
static struct ofono_sim *current_sim;
|
||||
/* Current active app */
|
||||
@@ -217,11 +213,13 @@ static void ril_file_info_cb(struct ril_msg *message, gpointer user_data)
|
||||
|
||||
if (response_len) {
|
||||
if (response[0] == 0x62) {
|
||||
ok = sim_parse_3g_get_response(response, response_len,
|
||||
&flen, &rlen, &str, access, NULL);
|
||||
ok = sim_parse_3g_get_response(
|
||||
response, response_len,
|
||||
&flen, &rlen, &str, access, NULL);
|
||||
} else
|
||||
ok = sim_parse_2g_get_response(response, response_len,
|
||||
&flen, &rlen, &str, access, &file_status);
|
||||
ok = sim_parse_2g_get_response(
|
||||
response, response_len,
|
||||
&flen, &rlen, &str, access, &file_status);
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
@@ -240,7 +238,8 @@ error:
|
||||
}
|
||||
|
||||
static void ril_sim_read_info(struct ofono_sim *sim, int fileid,
|
||||
const unsigned char *path, unsigned int path_len,
|
||||
const unsigned char *path,
|
||||
unsigned int path_len,
|
||||
ofono_sim_file_info_cb_t cb,
|
||||
void *data)
|
||||
{
|
||||
@@ -340,7 +339,8 @@ error:
|
||||
|
||||
static void ril_sim_read_binary(struct ofono_sim *sim, int fileid,
|
||||
int start, int length,
|
||||
const unsigned char *path, unsigned int path_len,
|
||||
const unsigned char *path,
|
||||
unsigned int path_len,
|
||||
ofono_sim_read_cb_t cb, void *data)
|
||||
{
|
||||
struct sim_data *sd = ofono_sim_get_data(sim);
|
||||
@@ -393,7 +393,8 @@ static void ril_sim_read_binary(struct ofono_sim *sim, int fileid,
|
||||
|
||||
static void ril_sim_read_record(struct ofono_sim *sim, int fileid,
|
||||
int record, int length,
|
||||
const unsigned char *path, unsigned int path_len,
|
||||
const unsigned char *path,
|
||||
unsigned int path_len,
|
||||
ofono_sim_read_cb_t cb, void *data)
|
||||
{
|
||||
struct sim_data *sd = ofono_sim_get_data(sim);
|
||||
@@ -506,10 +507,10 @@ static void ril_read_imsi(struct ofono_sim *sim, ofono_sim_imsi_cb_t cb,
|
||||
}
|
||||
}
|
||||
|
||||
void set_pin_lock_state(struct ofono_sim *sim,struct sim_app *app)
|
||||
void set_pin_lock_state(struct ofono_sim *sim, struct sim_app *app)
|
||||
{
|
||||
DBG("pin1:%u,pin2:%u",app->pin1_state,app->pin2_state);
|
||||
/*
|
||||
DBG("pin1:%u,pin2:%u", app->pin1_state, app->pin2_state);
|
||||
/*
|
||||
* Updates only pin and pin2 state. Other locks are not dealt here. For
|
||||
* that a RIL_REQUEST_QUERY_FACILITY_LOCK request should be used.
|
||||
*/
|
||||
@@ -518,10 +519,11 @@ void set_pin_lock_state(struct ofono_sim *sim,struct sim_app *app)
|
||||
case RIL_PINSTATE_ENABLED_VERIFIED:
|
||||
case RIL_PINSTATE_ENABLED_BLOCKED:
|
||||
case RIL_PINSTATE_ENABLED_PERM_BLOCKED:
|
||||
ofono_set_pin_lock_state(sim,OFONO_SIM_PASSWORD_SIM_PIN,TRUE);
|
||||
ofono_set_pin_lock_state(sim, OFONO_SIM_PASSWORD_SIM_PIN, TRUE);
|
||||
break;
|
||||
case RIL_PINSTATE_DISABLED:
|
||||
ofono_set_pin_lock_state(sim,OFONO_SIM_PASSWORD_SIM_PIN,FALSE);
|
||||
ofono_set_pin_lock_state(
|
||||
sim, OFONO_SIM_PASSWORD_SIM_PIN, FALSE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -531,10 +533,12 @@ void set_pin_lock_state(struct ofono_sim *sim,struct sim_app *app)
|
||||
case RIL_PINSTATE_ENABLED_VERIFIED:
|
||||
case RIL_PINSTATE_ENABLED_BLOCKED:
|
||||
case RIL_PINSTATE_ENABLED_PERM_BLOCKED:
|
||||
ofono_set_pin_lock_state(sim,OFONO_SIM_PASSWORD_SIM_PIN2,TRUE);
|
||||
ofono_set_pin_lock_state(
|
||||
sim, OFONO_SIM_PASSWORD_SIM_PIN2, TRUE);
|
||||
break;
|
||||
case RIL_PINSTATE_DISABLED:
|
||||
ofono_set_pin_lock_state(sim,OFONO_SIM_PASSWORD_SIM_PIN2,FALSE);
|
||||
ofono_set_pin_lock_state(
|
||||
sim, OFONO_SIM_PASSWORD_SIM_PIN2, FALSE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -642,7 +646,7 @@ static void sim_status_cb(struct ril_msg *message, gpointer user_data)
|
||||
if (sd->sim_registered == FALSE) {
|
||||
ofono_sim_register(sim);
|
||||
sd->sim_registered = TRUE;
|
||||
} else
|
||||
} else {
|
||||
/* TODO: There doesn't seem to be any other
|
||||
* way to force the core SIM code to
|
||||
* recheck the PIN.
|
||||
@@ -650,15 +654,16 @@ static void sim_status_cb(struct ril_msg *message, gpointer user_data)
|
||||
* more appropriate call here??
|
||||
* __ofono_sim_refresh(sim, NULL, TRUE, TRUE);
|
||||
*/
|
||||
DBG("sd->card_state:%u",sd->card_state);
|
||||
DBG("sd->card_state:%u", sd->card_state);
|
||||
if (sd->card_state != RIL_CARDSTATE_PRESENT) {
|
||||
ofono_sim_inserted_notify(sim, TRUE);
|
||||
sd->card_state = RIL_CARDSTATE_PRESENT;
|
||||
}
|
||||
}
|
||||
|
||||
if (current_passwd) {
|
||||
if (!strcmp(current_passwd, defaultpasswd)) {
|
||||
__ofono_sim_recheck_pin(sim);
|
||||
__ofono_sim_recheck_pin(sim);
|
||||
} else if (sd->passwd_state !=
|
||||
OFONO_SIM_PASSWORD_SIM_PIN) {
|
||||
__ofono_sim_recheck_pin(sim);
|
||||
@@ -787,7 +792,9 @@ static void ril_pin_change_state_cb(struct ril_msg *message, gpointer user_data)
|
||||
retries[passwd_type] = retry_count;
|
||||
sd->retries[passwd_type] = retries[passwd_type];
|
||||
|
||||
/* TODO: re-bfactor to not use macro for FAILURE; doesn't return error! */
|
||||
/*
|
||||
* TODO: re-bfactor to not use macro for FAILURE; doesn't return error!
|
||||
*/
|
||||
|
||||
if (message->error == RIL_E_SUCCESS) {
|
||||
CALLBACK_WITH_SUCCESS(cb, cbd->data);
|
||||
@@ -838,9 +845,9 @@ static void ril_pin_send(struct ofono_sim *sim, const char *passwd,
|
||||
}
|
||||
|
||||
static void ril_pin_change_state(struct ofono_sim *sim,
|
||||
enum ofono_sim_password_type passwd_type,
|
||||
int enable, const char *passwd,
|
||||
ofono_sim_lock_unlock_cb_t cb, void *data)
|
||||
enum ofono_sim_password_type passwd_type,
|
||||
int enable, const char *passwd,
|
||||
ofono_sim_lock_unlock_cb_t cb, void *data)
|
||||
{
|
||||
struct sim_data *sd = ofono_sim_get_data(sim);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
@@ -387,4 +387,8 @@
|
||||
/* Suplementary services Service class*/
|
||||
#define SERVICE_CLASS_NONE 0
|
||||
|
||||
/* RIL_FACILITY_LOCK parameters */
|
||||
#define RIL_FACILITY_UNLOCK "0"
|
||||
#define RIL_FACILITY_LOCK "1"
|
||||
|
||||
#endif /*__RIL_CONSTANTS_H*/
|
||||
|
||||
@@ -154,9 +154,12 @@ static void sim_status_cb(struct ril_msg *message, gpointer user_data)
|
||||
} else {
|
||||
ofono_warn("No SIM card present.");
|
||||
}
|
||||
// We cannot power on modem, but we need to get
|
||||
// certain interfaces up to be able to make emergency calls
|
||||
// in offline mode and without SIM
|
||||
|
||||
/*
|
||||
* We cannot power on modem, but we need to get
|
||||
* certain interfaces up to be able to make emergency calls
|
||||
* in offline mode and without SIM
|
||||
*/
|
||||
ofono_modem_set_powered(modem, TRUE);
|
||||
}
|
||||
}
|
||||
@@ -258,7 +261,7 @@ static void ril_post_sim(struct ofono_modem *modem)
|
||||
ril->modem);
|
||||
if (gc == NULL)
|
||||
break;
|
||||
|
||||
|
||||
ofono_gprs_add_context(gprs, gc);
|
||||
}
|
||||
}
|
||||
@@ -266,6 +269,7 @@ static void ril_post_sim(struct ofono_modem *modem)
|
||||
ofono_radio_settings_create(modem, 0, "rilmodem", ril->modem);
|
||||
ofono_phonebook_create(modem, 0, "rilmodem", ril->modem);
|
||||
ofono_call_forwarding_create(modem, 0, "rilmodem", ril->modem);
|
||||
ofono_call_barring_create(modem, 0, "rilmodem", ril->modem);
|
||||
|
||||
mw = ofono_message_waiting_create(modem);
|
||||
if (mw)
|
||||
@@ -292,9 +296,8 @@ static void ril_set_online_cb(struct ril_msg *message, gpointer user_data)
|
||||
struct cb_data *cbd = user_data;
|
||||
ofono_modem_online_cb_t cb = cbd->cb;
|
||||
|
||||
if (message->error == RIL_E_SUCCESS) {
|
||||
if (message->error == RIL_E_SUCCESS)
|
||||
CALLBACK_WITH_SUCCESS(cb, cbd->data);
|
||||
}
|
||||
else
|
||||
CALLBACK_WITH_FAILURE(cb, cbd->data);
|
||||
}
|
||||
@@ -406,7 +409,7 @@ static void ril_connected(struct ril_msg *message, gpointer user_data)
|
||||
|
||||
connection = ofono_dbus_get_connection();
|
||||
mce_daemon_watch = g_dbus_add_service_watch(connection, MCE_SERVICE,
|
||||
mce_connect, mce_disconnect, modem, NULL);
|
||||
mce_connect, mce_disconnect, modem, NULL);
|
||||
}
|
||||
|
||||
static gboolean ril_re_init(gpointer user_data)
|
||||
@@ -434,10 +437,10 @@ void ril_switchUser()
|
||||
ofono_error("prctl(PR_SET_KEEPCAPS) failed:%s,%d",
|
||||
strerror(errno), errno);
|
||||
|
||||
if (setgid(RADIO_ID) < 0 )
|
||||
if (setgid(RADIO_ID) < 0)
|
||||
ofono_error("setgid(%d) failed:%s,%d",
|
||||
RADIO_ID, strerror(errno), errno);
|
||||
if (setuid(RADIO_ID) < 0 )
|
||||
if (setuid(RADIO_ID) < 0)
|
||||
ofono_error("setuid(%d) failed:%s,%d",
|
||||
RADIO_ID, strerror(errno), errno);
|
||||
|
||||
|
||||
@@ -63,6 +63,8 @@ if __name__ == "__main__":
|
||||
except dbus.DBusException, e:
|
||||
print "Unable to Disable All barrings: ", e
|
||||
sys.exit(1)
|
||||
print "Disabled all call barrings"
|
||||
sys.exit(0)
|
||||
elif (sys.argv[1] == 'passwd'):
|
||||
try:
|
||||
cb.ChangePassword(old_password, new_password)
|
||||
@@ -77,6 +79,8 @@ if __name__ == "__main__":
|
||||
except dbus.DBusException, e:
|
||||
print "Unable to set property: ", e
|
||||
sys.exit(1)
|
||||
print "Property set completed", property
|
||||
sys.exit(0)
|
||||
|
||||
canexit = True
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import gobject
|
||||
import sys
|
||||
|
||||
import dbus
|
||||
import dbus.mainloop.glib
|
||||
|
||||
def print_usage():
|
||||
print "Usage: test-ss-control-cb <password>"
|
||||
sys.exit(1);
|
||||
|
||||
def property_changed(property, value):
|
||||
print "CallBarring property %s changed to %s" % (property, value)
|
||||
|
||||
@@ -15,6 +20,11 @@ def print_properties(cb):
|
||||
print "property %s, value: %s" % (p, properties[p])
|
||||
|
||||
if __name__ == "__main__":
|
||||
if (len(sys.argv) != 2):
|
||||
print_usage()
|
||||
|
||||
password = sys.argv[1]
|
||||
|
||||
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
||||
|
||||
bus = dbus.SystemBus()
|
||||
@@ -29,7 +39,7 @@ if __name__ == "__main__":
|
||||
|
||||
cb.connect_to_signal("PropertyChanged", property_changed)
|
||||
|
||||
ss = dbus.Interface(bus.get_object('org.ofono', modems[0]),
|
||||
ss = dbus.Interface(bus.get_object('org.ofono', modems[0][0]),
|
||||
'org.ofono.SupplementaryServices')
|
||||
|
||||
print_properties(cb)
|
||||
@@ -82,13 +92,19 @@ if __name__ == "__main__":
|
||||
print "Query All"
|
||||
print ss.Initiate("*#330#")
|
||||
|
||||
ss_string = "*33*" + password + "*11#"
|
||||
|
||||
print "Enable Barring for Outgoing International calls for Voice"
|
||||
print ss.Initiate("*33*3579*11#")
|
||||
print ss.Initiate(ss_string)
|
||||
|
||||
print_properties(cb)
|
||||
|
||||
ss_string = "#330*" + password + "#"
|
||||
|
||||
print "Disable All Barrings"
|
||||
print ss.Initiate("#330*3579#")
|
||||
print ss.Initiate(ss_string)
|
||||
|
||||
sys.exit(1);
|
||||
|
||||
mainloop = gobject.MainLoop()
|
||||
mainloop.run()
|
||||
|
||||
Reference in New Issue
Block a user