mirror of
https://github.com/sailfishos/ofono
synced 2025-11-23 01:35:38 +08:00
Compare commits
3 Commits
mer/1.19+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-settings.c \
|
||||||
drivers/rilmodem/call-forwarding.c \
|
drivers/rilmodem/call-forwarding.c \
|
||||||
drivers/rilmodem/cbs.c \
|
drivers/rilmodem/cbs.c \
|
||||||
drivers/rilmodem/oemraw-messages.c
|
drivers/rilmodem/oemraw-messages.c \
|
||||||
|
drivers/rilmodem/call-barring.c
|
||||||
|
|
||||||
endif
|
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_ussd_init();
|
||||||
ril_call_settings_init();
|
ril_call_settings_init();
|
||||||
ril_call_forwarding_init();
|
ril_call_forwarding_init();
|
||||||
|
ril_call_barring_init();
|
||||||
ril_cbs_init();
|
ril_cbs_init();
|
||||||
ril_oemraw_init();
|
ril_oemraw_init();
|
||||||
|
|
||||||
@@ -76,6 +77,7 @@ static void rilmodem_exit(void)
|
|||||||
ril_ussd_exit();
|
ril_ussd_exit();
|
||||||
ril_call_settings_exit();
|
ril_call_settings_exit();
|
||||||
ril_call_forwarding_exit();
|
ril_call_forwarding_exit();
|
||||||
|
ril_call_barring_exit();
|
||||||
ril_cbs_exit();
|
ril_cbs_exit();
|
||||||
ril_oemraw_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_init(void);
|
||||||
extern void ril_call_forwarding_exit(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_init(void);
|
||||||
extern void ril_cbs_exit(void);
|
extern void ril_cbs_exit(void);
|
||||||
|
|
||||||
|
|||||||
@@ -74,10 +74,6 @@
|
|||||||
#define ENTER_SIM_PUK_PARAMS 3
|
#define ENTER_SIM_PUK_PARAMS 3
|
||||||
#define CHANGE_SIM_PIN_PARAMS 3
|
#define CHANGE_SIM_PIN_PARAMS 3
|
||||||
|
|
||||||
/* RIL_FACILITY_LOCK parameters */
|
|
||||||
#define RIL_FACILITY_UNLOCK "0"
|
|
||||||
#define RIL_FACILITY_LOCK "1"
|
|
||||||
|
|
||||||
/* Current SIM */
|
/* Current SIM */
|
||||||
static struct ofono_sim *current_sim;
|
static struct ofono_sim *current_sim;
|
||||||
/* Current active app */
|
/* Current active app */
|
||||||
@@ -217,10 +213,12 @@ static void ril_file_info_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
|
|
||||||
if (response_len) {
|
if (response_len) {
|
||||||
if (response[0] == 0x62) {
|
if (response[0] == 0x62) {
|
||||||
ok = sim_parse_3g_get_response(response, response_len,
|
ok = sim_parse_3g_get_response(
|
||||||
|
response, response_len,
|
||||||
&flen, &rlen, &str, access, NULL);
|
&flen, &rlen, &str, access, NULL);
|
||||||
} else
|
} else
|
||||||
ok = sim_parse_2g_get_response(response, response_len,
|
ok = sim_parse_2g_get_response(
|
||||||
|
response, response_len,
|
||||||
&flen, &rlen, &str, access, &file_status);
|
&flen, &rlen, &str, access, &file_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,7 +238,8 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void ril_sim_read_info(struct ofono_sim *sim, int fileid,
|
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,
|
ofono_sim_file_info_cb_t cb,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
@@ -340,7 +339,8 @@ error:
|
|||||||
|
|
||||||
static void ril_sim_read_binary(struct ofono_sim *sim, int fileid,
|
static void ril_sim_read_binary(struct ofono_sim *sim, int fileid,
|
||||||
int start, int length,
|
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)
|
ofono_sim_read_cb_t cb, void *data)
|
||||||
{
|
{
|
||||||
struct sim_data *sd = ofono_sim_get_data(sim);
|
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,
|
static void ril_sim_read_record(struct ofono_sim *sim, int fileid,
|
||||||
int record, int length,
|
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)
|
ofono_sim_read_cb_t cb, void *data)
|
||||||
{
|
{
|
||||||
struct sim_data *sd = ofono_sim_get_data(sim);
|
struct sim_data *sd = ofono_sim_get_data(sim);
|
||||||
@@ -521,7 +522,8 @@ void set_pin_lock_state(struct ofono_sim *sim,struct sim_app *app)
|
|||||||
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;
|
break;
|
||||||
case RIL_PINSTATE_DISABLED:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
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_VERIFIED:
|
||||||
case RIL_PINSTATE_ENABLED_BLOCKED:
|
case RIL_PINSTATE_ENABLED_BLOCKED:
|
||||||
case RIL_PINSTATE_ENABLED_PERM_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;
|
break;
|
||||||
case RIL_PINSTATE_DISABLED:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -642,7 +646,7 @@ static void sim_status_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
if (sd->sim_registered == FALSE) {
|
if (sd->sim_registered == FALSE) {
|
||||||
ofono_sim_register(sim);
|
ofono_sim_register(sim);
|
||||||
sd->sim_registered = TRUE;
|
sd->sim_registered = TRUE;
|
||||||
} else
|
} else {
|
||||||
/* TODO: There doesn't seem to be any other
|
/* TODO: There doesn't seem to be any other
|
||||||
* way to force the core SIM code to
|
* way to force the core SIM code to
|
||||||
* recheck the PIN.
|
* recheck the PIN.
|
||||||
@@ -655,6 +659,7 @@ static void sim_status_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
ofono_sim_inserted_notify(sim, TRUE);
|
ofono_sim_inserted_notify(sim, TRUE);
|
||||||
sd->card_state = RIL_CARDSTATE_PRESENT;
|
sd->card_state = RIL_CARDSTATE_PRESENT;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (current_passwd) {
|
if (current_passwd) {
|
||||||
if (!strcmp(current_passwd, defaultpasswd)) {
|
if (!strcmp(current_passwd, defaultpasswd)) {
|
||||||
@@ -787,7 +792,9 @@ static void ril_pin_change_state_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
retries[passwd_type] = retry_count;
|
retries[passwd_type] = retry_count;
|
||||||
sd->retries[passwd_type] = retries[passwd_type];
|
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) {
|
if (message->error == RIL_E_SUCCESS) {
|
||||||
CALLBACK_WITH_SUCCESS(cb, cbd->data);
|
CALLBACK_WITH_SUCCESS(cb, cbd->data);
|
||||||
|
|||||||
@@ -387,4 +387,8 @@
|
|||||||
/* Suplementary services Service class*/
|
/* Suplementary services Service class*/
|
||||||
#define SERVICE_CLASS_NONE 0
|
#define SERVICE_CLASS_NONE 0
|
||||||
|
|
||||||
|
/* RIL_FACILITY_LOCK parameters */
|
||||||
|
#define RIL_FACILITY_UNLOCK "0"
|
||||||
|
#define RIL_FACILITY_LOCK "1"
|
||||||
|
|
||||||
#endif /*__RIL_CONSTANTS_H*/
|
#endif /*__RIL_CONSTANTS_H*/
|
||||||
|
|||||||
@@ -154,9 +154,12 @@ static void sim_status_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
} else {
|
} else {
|
||||||
ofono_warn("No SIM card present.");
|
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);
|
ofono_modem_set_powered(modem, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -266,6 +269,7 @@ static void ril_post_sim(struct ofono_modem *modem)
|
|||||||
ofono_radio_settings_create(modem, 0, "rilmodem", ril->modem);
|
ofono_radio_settings_create(modem, 0, "rilmodem", ril->modem);
|
||||||
ofono_phonebook_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_forwarding_create(modem, 0, "rilmodem", ril->modem);
|
||||||
|
ofono_call_barring_create(modem, 0, "rilmodem", ril->modem);
|
||||||
|
|
||||||
mw = ofono_message_waiting_create(modem);
|
mw = ofono_message_waiting_create(modem);
|
||||||
if (mw)
|
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;
|
struct cb_data *cbd = user_data;
|
||||||
ofono_modem_online_cb_t cb = cbd->cb;
|
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);
|
CALLBACK_WITH_SUCCESS(cb, cbd->data);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
CALLBACK_WITH_FAILURE(cb, cbd->data);
|
CALLBACK_WITH_FAILURE(cb, cbd->data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ if __name__ == "__main__":
|
|||||||
except dbus.DBusException, e:
|
except dbus.DBusException, e:
|
||||||
print "Unable to Disable All barrings: ", e
|
print "Unable to Disable All barrings: ", e
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
print "Disabled all call barrings"
|
||||||
|
sys.exit(0)
|
||||||
elif (sys.argv[1] == 'passwd'):
|
elif (sys.argv[1] == 'passwd'):
|
||||||
try:
|
try:
|
||||||
cb.ChangePassword(old_password, new_password)
|
cb.ChangePassword(old_password, new_password)
|
||||||
@@ -77,6 +79,8 @@ if __name__ == "__main__":
|
|||||||
except dbus.DBusException, e:
|
except dbus.DBusException, e:
|
||||||
print "Unable to set property: ", e
|
print "Unable to set property: ", e
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
print "Property set completed", property
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
canexit = True
|
canexit = True
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
import gobject
|
import gobject
|
||||||
|
import sys
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import dbus.mainloop.glib
|
import dbus.mainloop.glib
|
||||||
|
|
||||||
|
def print_usage():
|
||||||
|
print "Usage: test-ss-control-cb <password>"
|
||||||
|
sys.exit(1);
|
||||||
|
|
||||||
def property_changed(property, value):
|
def property_changed(property, value):
|
||||||
print "CallBarring property %s changed to %s" % (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])
|
print "property %s, value: %s" % (p, properties[p])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
if (len(sys.argv) != 2):
|
||||||
|
print_usage()
|
||||||
|
|
||||||
|
password = sys.argv[1]
|
||||||
|
|
||||||
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
||||||
|
|
||||||
bus = dbus.SystemBus()
|
bus = dbus.SystemBus()
|
||||||
@@ -29,7 +39,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
cb.connect_to_signal("PropertyChanged", property_changed)
|
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')
|
'org.ofono.SupplementaryServices')
|
||||||
|
|
||||||
print_properties(cb)
|
print_properties(cb)
|
||||||
@@ -82,13 +92,19 @@ if __name__ == "__main__":
|
|||||||
print "Query All"
|
print "Query All"
|
||||||
print ss.Initiate("*#330#")
|
print ss.Initiate("*#330#")
|
||||||
|
|
||||||
|
ss_string = "*33*" + password + "*11#"
|
||||||
|
|
||||||
print "Enable Barring for Outgoing International calls for Voice"
|
print "Enable Barring for Outgoing International calls for Voice"
|
||||||
print ss.Initiate("*33*3579*11#")
|
print ss.Initiate(ss_string)
|
||||||
|
|
||||||
print_properties(cb)
|
print_properties(cb)
|
||||||
|
|
||||||
|
ss_string = "#330*" + password + "#"
|
||||||
|
|
||||||
print "Disable All Barrings"
|
print "Disable All Barrings"
|
||||||
print ss.Initiate("#330*3579#")
|
print ss.Initiate(ss_string)
|
||||||
|
|
||||||
|
sys.exit(1);
|
||||||
|
|
||||||
mainloop = gobject.MainLoop()
|
mainloop = gobject.MainLoop()
|
||||||
mainloop.run()
|
mainloop.run()
|
||||||
|
|||||||
Reference in New Issue
Block a user