mirror of
https://github.com/sailfishos/ofono
synced 2025-12-02 23:51:10 +08:00
Compare commits
7 Commits
mer/1.23+g
...
mer/1.23+g
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
544f02e5a2 | ||
|
|
6d4638f9bf | ||
|
|
6584919e9d | ||
|
|
34fb44f4eb | ||
|
|
c98d2f41c5 | ||
|
|
b279be4528 | ||
|
|
a7912fea39 |
@@ -151,6 +151,7 @@ builtin_sources += drivers/ril/ril_call_barring.c \
|
|||||||
drivers/ril/ril_devinfo.c \
|
drivers/ril/ril_devinfo.c \
|
||||||
drivers/ril/ril_devmon.c \
|
drivers/ril/ril_devmon.c \
|
||||||
drivers/ril/ril_devmon_auto.c \
|
drivers/ril/ril_devmon_auto.c \
|
||||||
|
drivers/ril/ril_devmon_combine.c \
|
||||||
drivers/ril/ril_devmon_ds.c \
|
drivers/ril/ril_devmon_ds.c \
|
||||||
drivers/ril/ril_devmon_ss.c \
|
drivers/ril/ril_devmon_ss.c \
|
||||||
drivers/ril/ril_devmon_ur.c \
|
drivers/ril/ril_devmon_ur.c \
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* oFono - Open Source Telephony - RIL-based devices
|
* oFono - Open Source Telephony - RIL-based devices
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2019 Jolla Ltd.
|
* Copyright (C) 2015-2020 Jolla Ltd.
|
||||||
* Copyright (C) 2019 Open Mobile Platform LLC.
|
* Copyright (C) 2019-2020 Open Mobile Platform LLC.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -186,6 +186,72 @@ gboolean ril_config_get_enum(GKeyFile *file, const char *group,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean ril_config_get_mask(GKeyFile *file, const char *group,
|
||||||
|
const char *key, int *result,
|
||||||
|
const char *name, int value, ...)
|
||||||
|
{
|
||||||
|
char *str = ril_config_get_string(file, group, key);
|
||||||
|
gboolean ok = FALSE;
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
*result = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (str) {
|
||||||
|
/*
|
||||||
|
* Some people are thinking that # is a comment
|
||||||
|
* anywhere on the line, not just at the beginning
|
||||||
|
*/
|
||||||
|
char *comment = strchr(str, '#');
|
||||||
|
char **values, **ptr;
|
||||||
|
|
||||||
|
if (comment) *comment = 0;
|
||||||
|
values = g_strsplit(str, "+", -1);
|
||||||
|
|
||||||
|
for (ok = TRUE, ptr = values; *ptr && ok; ptr++) {
|
||||||
|
const char* found_str = NULL;
|
||||||
|
const char* s = g_strstrip(*ptr);
|
||||||
|
|
||||||
|
if (!strcasecmp(s, name)) {
|
||||||
|
found_str = name;
|
||||||
|
if (result) {
|
||||||
|
*result |= value;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
va_list args;
|
||||||
|
const char* known;
|
||||||
|
|
||||||
|
va_start(args, value);
|
||||||
|
while ((known = va_arg(args, char*)) != NULL) {
|
||||||
|
const int bit = va_arg(args, int);
|
||||||
|
|
||||||
|
if (!strcasecmp(s, known)) {
|
||||||
|
found_str = known;
|
||||||
|
if (result) {
|
||||||
|
*result |= bit;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found_str) {
|
||||||
|
ofono_error("Unknown bit '%s' in %s", s, key);
|
||||||
|
ok = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_strfreev(values);
|
||||||
|
g_free(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ok && result) {
|
||||||
|
*result = 0;
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
GUtilInts *ril_config_get_ints(GKeyFile *file, const char *group,
|
GUtilInts *ril_config_get_ints(GKeyFile *file, const char *group,
|
||||||
const char *key)
|
const char *key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* oFono - Open Source Telephony - RIL-based devices
|
* oFono - Open Source Telephony - RIL-based devices
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2019 Jolla Ltd.
|
* Copyright (C) 2015-2020 Jolla Ltd.
|
||||||
* Copyright (C) 2019 Open Mobile Platform LLC.
|
* Copyright (C) 2019-2020 Open Mobile Platform LLC.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -35,7 +35,12 @@ gboolean ril_config_get_flag(GKeyFile *file, const char *group,
|
|||||||
const char *key, int flag, int *flags);
|
const char *key, int flag, int *flags);
|
||||||
gboolean ril_config_get_enum(GKeyFile *file, const char *group,
|
gboolean ril_config_get_enum(GKeyFile *file, const char *group,
|
||||||
const char *key, int *result,
|
const char *key, int *result,
|
||||||
const char *name, int value, ...);
|
const char *name, int value, ...)
|
||||||
|
G_GNUC_NULL_TERMINATED;
|
||||||
|
gboolean ril_config_get_mask(GKeyFile *file, const char *group,
|
||||||
|
const char *key, int *result,
|
||||||
|
const char *name, int value, ...)
|
||||||
|
G_GNUC_NULL_TERMINATED;
|
||||||
GUtilInts *ril_config_get_ints(GKeyFile *file, const char *group,
|
GUtilInts *ril_config_get_ints(GKeyFile *file, const char *group,
|
||||||
const char *key);
|
const char *key);
|
||||||
char *ril_config_ints_to_string(GUtilInts *ints, char separator);
|
char *ril_config_ints_to_string(GUtilInts *ints, char separator);
|
||||||
|
|||||||
@@ -382,6 +382,12 @@ enum ril_unsolicited_response_filter {
|
|||||||
RIL_UR_DATA_CALL_DORMANCY_CHANGED = 0x04
|
RIL_UR_DATA_CALL_DORMANCY_CHANGED = 0x04
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE result */
|
||||||
|
enum ril_network_selection_mode {
|
||||||
|
RIL_NETWORK_SELECTION_MODE_AUTO = 0,
|
||||||
|
RIL_NETWORK_SELECTION_MODE_MANUAL = 1
|
||||||
|
};
|
||||||
|
|
||||||
#endif /*__RIL_CONSTANTS_H */
|
#endif /*__RIL_CONSTANTS_H */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* oFono - Open Source Telephony - RIL-based devices
|
* oFono - Open Source Telephony - RIL-based devices
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019 Jolla Ltd.
|
* Copyright (C) 2019-2020 Jolla Ltd.
|
||||||
|
* Copyright (C) 2020 Open Mobile Platform LLC.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -61,6 +62,11 @@ struct ril_devmon *ril_devmon_ur_new(void);
|
|||||||
*/
|
*/
|
||||||
struct ril_devmon *ril_devmon_auto_new(void);
|
struct ril_devmon *ril_devmon_auto_new(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This one combines several methods. Takes ownership of ril_devmon objects.
|
||||||
|
*/
|
||||||
|
struct ril_devmon *ril_devmon_combine(struct ril_devmon *devmon[], guint n);
|
||||||
|
|
||||||
/* Utilities (NULL tolerant) */
|
/* Utilities (NULL tolerant) */
|
||||||
struct ril_devmon_io *ril_devmon_start_io(struct ril_devmon *devmon,
|
struct ril_devmon_io *ril_devmon_start_io(struct ril_devmon *devmon,
|
||||||
GRilIoChannel *channel, struct sailfish_cell_info *cell_info);
|
GRilIoChannel *channel, struct sailfish_cell_info *cell_info);
|
||||||
|
|||||||
104
ofono/drivers/ril/ril_devmon_combine.c
Normal file
104
ofono/drivers/ril/ril_devmon_combine.c
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
/*
|
||||||
|
* oFono - Open Source Telephony - RIL-based devices
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 Jolla Ltd.
|
||||||
|
* Copyright (C) 2020 Open Mobile Platform LLC.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ril_devmon.h"
|
||||||
|
|
||||||
|
#include <ofono/log.h>
|
||||||
|
|
||||||
|
typedef struct ril_devmon_combine {
|
||||||
|
struct ril_devmon pub;
|
||||||
|
struct ril_devmon **impl;
|
||||||
|
guint count;
|
||||||
|
} DevMon;
|
||||||
|
|
||||||
|
typedef struct ril_devmon_combine_io {
|
||||||
|
struct ril_devmon_io pub;
|
||||||
|
struct ril_devmon_io **impl;
|
||||||
|
guint count;
|
||||||
|
} DevMonIo;
|
||||||
|
|
||||||
|
static inline DevMon *ril_devmon_combine_cast(struct ril_devmon *dm)
|
||||||
|
{
|
||||||
|
return G_CAST(dm, DevMon, pub);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline DevMonIo *ril_devmon_ds_io_cast(struct ril_devmon_io *io)
|
||||||
|
{
|
||||||
|
return G_CAST(io, DevMonIo, pub);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ril_devmon_combine_io_free(struct ril_devmon_io *io)
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
DevMonIo *self = ril_devmon_ds_io_cast(io);
|
||||||
|
|
||||||
|
for (i = 0; i < self->count; i++) {
|
||||||
|
ril_devmon_io_free(self->impl[i]);
|
||||||
|
}
|
||||||
|
g_free(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct ril_devmon_io *ril_devmon_combine_start_io(struct ril_devmon *dm,
|
||||||
|
GRilIoChannel *chan, struct sailfish_cell_info *ci)
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
DevMon *self = ril_devmon_combine_cast(dm);
|
||||||
|
DevMonIo *io = g_malloc0(sizeof(DevMonIo) +
|
||||||
|
sizeof(struct ril_devmon_io *) * self->count);
|
||||||
|
|
||||||
|
io->pub.free = ril_devmon_combine_io_free;
|
||||||
|
io->impl = (struct ril_devmon_io**)(io + 1);
|
||||||
|
io->count = self->count;
|
||||||
|
for (i = 0; i < io->count; i++) {
|
||||||
|
io->impl[i] = ril_devmon_start_io(self->impl[i], chan, ci);
|
||||||
|
}
|
||||||
|
return &io->pub;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ril_devmon_combine_free(struct ril_devmon *dm)
|
||||||
|
{
|
||||||
|
DevMon *self = ril_devmon_combine_cast(dm);
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
for (i = 0; i < self->count; i++) {
|
||||||
|
ril_devmon_free(self->impl[i]);
|
||||||
|
}
|
||||||
|
g_free(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ril_devmon *ril_devmon_combine(struct ril_devmon *dm[], guint n)
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
DevMon *self = g_malloc0(sizeof(DevMon) +
|
||||||
|
sizeof(struct ril_devmon *) * n);
|
||||||
|
|
||||||
|
self->pub.free = ril_devmon_combine_free;
|
||||||
|
self->pub.start_io = ril_devmon_combine_start_io;
|
||||||
|
self->impl = (struct ril_devmon **)(self + 1);
|
||||||
|
self->count = n;
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
self->impl[i] = dm[i];
|
||||||
|
}
|
||||||
|
return &self->pub;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Local Variables:
|
||||||
|
* mode: C
|
||||||
|
* c-basic-offset: 8
|
||||||
|
* indent-tabs-mode: t
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
@@ -23,7 +23,6 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "simutil.h"
|
#include "simutil.h"
|
||||||
|
|
||||||
#define REGISTRATION_TIMEOUT (100*1000) /* ms */
|
|
||||||
#define REGISTRATION_MAX_RETRIES (2)
|
#define REGISTRATION_MAX_RETRIES (2)
|
||||||
|
|
||||||
enum ril_netreg_events {
|
enum ril_netreg_events {
|
||||||
@@ -53,6 +52,7 @@ struct ril_netreg {
|
|||||||
guint current_operator_id;
|
guint current_operator_id;
|
||||||
gulong ril_event_id[NETREG_RIL_EVENT_COUNT];
|
gulong ril_event_id[NETREG_RIL_EVENT_COUNT];
|
||||||
gulong network_event_id[NETREG_NETWORK_EVENT_COUNT];
|
gulong network_event_id[NETREG_NETWORK_EVENT_COUNT];
|
||||||
|
int network_selection_timeout;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ril_netreg_cbd {
|
struct ril_netreg_cbd {
|
||||||
@@ -301,18 +301,55 @@ static void ril_netreg_register_cb(GRilIoChannel *io, int status,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ril_netreg_set_register_auto(struct ril_netreg *nd,
|
||||||
|
ofono_netreg_register_cb_t cb, void *data)
|
||||||
|
{
|
||||||
|
GRilIoRequest *req = grilio_request_new();
|
||||||
|
|
||||||
|
ofono_info("nw select automatic");
|
||||||
|
grilio_request_set_timeout(req, nd->network_selection_timeout);
|
||||||
|
grilio_request_set_retry(req, 0, REGISTRATION_MAX_RETRIES);
|
||||||
|
grilio_queue_send_request_full(nd->q, req,
|
||||||
|
RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC,
|
||||||
|
ril_netreg_register_cb, ril_netreg_cbd_free,
|
||||||
|
ril_netreg_cbd_new(nd, cb, data));
|
||||||
|
grilio_request_unref(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ril_netreg_query_register_auto_cb(GRilIoChannel *io, int status,
|
||||||
|
const void *data, guint len,
|
||||||
|
void *user_data)
|
||||||
|
{
|
||||||
|
struct ril_netreg_cbd *cbd = user_data;
|
||||||
|
ofono_netreg_register_cb_t cb = cbd->cb.reg;
|
||||||
|
|
||||||
|
if (status == RIL_E_SUCCESS) {
|
||||||
|
GRilIoParser rilp;
|
||||||
|
gint32 net_mode;
|
||||||
|
|
||||||
|
grilio_parser_init(&rilp, data, len);
|
||||||
|
if (grilio_parser_get_int32(&rilp, NULL) /* Array length */ &&
|
||||||
|
grilio_parser_get_int32(&rilp, &net_mode) &&
|
||||||
|
net_mode == RIL_NETWORK_SELECTION_MODE_AUTO) {
|
||||||
|
struct ofono_error error;
|
||||||
|
ofono_info("nw selection is already auto");
|
||||||
|
cb(ril_error_ok(&error), cbd->data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ril_netreg_set_register_auto(cbd->nd, cb, cbd->data);
|
||||||
|
}
|
||||||
|
|
||||||
static void ril_netreg_register_auto(struct ofono_netreg *netreg,
|
static void ril_netreg_register_auto(struct ofono_netreg *netreg,
|
||||||
ofono_netreg_register_cb_t cb, void *data)
|
ofono_netreg_register_cb_t cb, void *data)
|
||||||
{
|
{
|
||||||
struct ril_netreg *nd = ril_netreg_get_data(netreg);
|
struct ril_netreg *nd = ril_netreg_get_data(netreg);
|
||||||
GRilIoRequest *req = grilio_request_new();
|
GRilIoRequest *req = grilio_request_new();
|
||||||
|
|
||||||
ofono_info("nw select automatic");
|
|
||||||
grilio_request_set_timeout(req, REGISTRATION_TIMEOUT);
|
|
||||||
grilio_request_set_retry(req, 0, REGISTRATION_MAX_RETRIES);
|
|
||||||
grilio_queue_send_request_full(nd->q, req,
|
grilio_queue_send_request_full(nd->q, req,
|
||||||
RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC,
|
RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE,
|
||||||
ril_netreg_register_cb, ril_netreg_cbd_free,
|
ril_netreg_query_register_auto_cb, ril_netreg_cbd_free,
|
||||||
ril_netreg_cbd_new(nd, cb, data));
|
ril_netreg_cbd_new(nd, cb, data));
|
||||||
grilio_request_unref(req);
|
grilio_request_unref(req);
|
||||||
}
|
}
|
||||||
@@ -327,7 +364,7 @@ static void ril_netreg_register_manual(struct ofono_netreg *netreg,
|
|||||||
|
|
||||||
ofono_info("nw select manual: %s%s%s", mcc, mnc, suffix);
|
ofono_info("nw select manual: %s%s%s", mcc, mnc, suffix);
|
||||||
grilio_request_append_format(req, "%s%s%s", mcc, mnc, suffix);
|
grilio_request_append_format(req, "%s%s%s", mcc, mnc, suffix);
|
||||||
grilio_request_set_timeout(req, REGISTRATION_TIMEOUT);
|
grilio_request_set_timeout(req, nd->network_selection_timeout);
|
||||||
grilio_request_set_retry(req, 0, REGISTRATION_MAX_RETRIES);
|
grilio_request_set_retry(req, 0, REGISTRATION_MAX_RETRIES);
|
||||||
grilio_queue_send_request_full(nd->q, req,
|
grilio_queue_send_request_full(nd->q, req,
|
||||||
RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL,
|
RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL,
|
||||||
@@ -563,6 +600,7 @@ static int ril_netreg_probe(struct ofono_netreg *netreg, unsigned int vendor,
|
|||||||
nd->network_selection_manual_0 = config->network_selection_manual_0;
|
nd->network_selection_manual_0 = config->network_selection_manual_0;
|
||||||
nd->signal_strength_dbm_weak = config->signal_strength_dbm_weak;
|
nd->signal_strength_dbm_weak = config->signal_strength_dbm_weak;
|
||||||
nd->signal_strength_dbm_strong = config->signal_strength_dbm_strong;
|
nd->signal_strength_dbm_strong = config->signal_strength_dbm_strong;
|
||||||
|
nd->network_selection_timeout = config->network_selection_timeout;
|
||||||
|
|
||||||
ofono_netreg_set_data(netreg, nd);
|
ofono_netreg_set_data(netreg, nd);
|
||||||
nd->timer_id = g_idle_add(ril_netreg_register, nd);
|
nd->timer_id = g_idle_add(ril_netreg_register, nd);
|
||||||
|
|||||||
@@ -73,6 +73,7 @@
|
|||||||
#define RILMODEM_DEFAULT_LTE_MODE PREF_NET_TYPE_LTE_GSM_WCDMA
|
#define RILMODEM_DEFAULT_LTE_MODE PREF_NET_TYPE_LTE_GSM_WCDMA
|
||||||
#define RILMODEM_DEFAULT_UMTS_MODE PREF_NET_TYPE_GSM_WCDMA_AUTO
|
#define RILMODEM_DEFAULT_UMTS_MODE PREF_NET_TYPE_GSM_WCDMA_AUTO
|
||||||
#define RILMODEM_DEFAULT_NETWORK_MODE_TIMEOUT (20*1000) /* ms */
|
#define RILMODEM_DEFAULT_NETWORK_MODE_TIMEOUT (20*1000) /* ms */
|
||||||
|
#define RILMODEM_DEFAULT_NETWORK_SELECTION_TIMEOUT (100*1000) /* ms */
|
||||||
#define RILMODEM_DEFAULT_DBM_WEAK (-100) /* very weak, 0.0000000001 mW */
|
#define RILMODEM_DEFAULT_DBM_WEAK (-100) /* very weak, 0.0000000001 mW */
|
||||||
#define RILMODEM_DEFAULT_DBM_STRONG (-60) /* strong signal, 0.000001 mW */
|
#define RILMODEM_DEFAULT_DBM_STRONG (-60) /* strong signal, 0.000001 mW */
|
||||||
#define RILMODEM_DEFAULT_ENABLE_VOICECALL TRUE
|
#define RILMODEM_DEFAULT_ENABLE_VOICECALL TRUE
|
||||||
@@ -134,6 +135,7 @@
|
|||||||
#define RILCONF_LTE_MODE "lteNetworkMode"
|
#define RILCONF_LTE_MODE "lteNetworkMode"
|
||||||
#define RILCONF_UMTS_MODE "umtsNetworkMode"
|
#define RILCONF_UMTS_MODE "umtsNetworkMode"
|
||||||
#define RILCONF_NETWORK_MODE_TIMEOUT "networkModeTimeout"
|
#define RILCONF_NETWORK_MODE_TIMEOUT "networkModeTimeout"
|
||||||
|
#define RILCONF_NETWORK_SELECTION_TIMEOUT "networkSelectionTimeout"
|
||||||
#define RILCONF_SIGNAL_STRENGTH_RANGE "signalStrengthRange"
|
#define RILCONF_SIGNAL_STRENGTH_RANGE "signalStrengthRange"
|
||||||
#define RILCONF_UICC_WORKAROUND "uiccWorkaround"
|
#define RILCONF_UICC_WORKAROUND "uiccWorkaround"
|
||||||
#define RILCONF_ECCLIST_FILE "ecclistFile"
|
#define RILCONF_ECCLIST_FILE "ecclistFile"
|
||||||
@@ -179,11 +181,9 @@ enum ril_set_radio_cap_opt {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum ril_devmon_opt {
|
enum ril_devmon_opt {
|
||||||
RIL_DEVMON_NONE,
|
RIL_DEVMON_SS = 0x01,
|
||||||
RIL_DEVMON_AUTO,
|
RIL_DEVMON_DS = 0x02,
|
||||||
RIL_DEVMON_SS,
|
RIL_DEVMON_UR = 0x04
|
||||||
RIL_DEVMON_DS,
|
|
||||||
RIL_DEVMON_UR
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ril_plugin_identity {
|
struct ril_plugin_identity {
|
||||||
@@ -1195,6 +1195,8 @@ static ril_slot *ril_plugin_slot_new_take(char *transport,
|
|||||||
config->lte_network_mode = RILMODEM_DEFAULT_LTE_MODE;
|
config->lte_network_mode = RILMODEM_DEFAULT_LTE_MODE;
|
||||||
config->umts_network_mode = RILMODEM_DEFAULT_UMTS_MODE;
|
config->umts_network_mode = RILMODEM_DEFAULT_UMTS_MODE;
|
||||||
config->network_mode_timeout = RILMODEM_DEFAULT_NETWORK_MODE_TIMEOUT;
|
config->network_mode_timeout = RILMODEM_DEFAULT_NETWORK_MODE_TIMEOUT;
|
||||||
|
config->network_selection_timeout =
|
||||||
|
RILMODEM_DEFAULT_NETWORK_SELECTION_TIMEOUT;
|
||||||
config->signal_strength_dbm_weak = RILMODEM_DEFAULT_DBM_WEAK;
|
config->signal_strength_dbm_weak = RILMODEM_DEFAULT_DBM_WEAK;
|
||||||
config->signal_strength_dbm_strong = RILMODEM_DEFAULT_DBM_STRONG;
|
config->signal_strength_dbm_strong = RILMODEM_DEFAULT_DBM_STRONG;
|
||||||
config->empty_pin_query = RILMODEM_DEFAULT_EMPTY_PIN_QUERY;
|
config->empty_pin_query = RILMODEM_DEFAULT_EMPTY_PIN_QUERY;
|
||||||
@@ -1567,6 +1569,14 @@ static ril_slot *ril_plugin_parse_config_group(GKeyFile *file,
|
|||||||
config->network_mode_timeout);
|
config->network_mode_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* networkSelectionTimeout */
|
||||||
|
if (ril_config_get_integer(file, group,
|
||||||
|
RILCONF_NETWORK_SELECTION_TIMEOUT,
|
||||||
|
&config->network_selection_timeout)) {
|
||||||
|
DBG("%s: " RILCONF_NETWORK_SELECTION_TIMEOUT " %d", group,
|
||||||
|
config->network_selection_timeout);
|
||||||
|
}
|
||||||
|
|
||||||
/* signalStrengthRange */
|
/* signalStrengthRange */
|
||||||
ints = ril_config_get_ints(file, group, RILCONF_SIGNAL_STRENGTH_RANGE);
|
ints = ril_config_get_ints(file, group, RILCONF_SIGNAL_STRENGTH_RANGE);
|
||||||
if (gutil_ints_get_count(ints) == 2) {
|
if (gutil_ints_get_count(ints) == 2) {
|
||||||
@@ -1707,26 +1717,32 @@ static ril_slot *ril_plugin_parse_config_group(GKeyFile *file,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* deviceStateTracking */
|
/* deviceStateTracking */
|
||||||
if (ril_config_get_enum(file, group, RILCONF_DEVMON, &ival,
|
if (ril_config_get_mask(file, group, RILCONF_DEVMON, &ival,
|
||||||
"none", RIL_DEVMON_NONE,
|
|
||||||
"auto", RIL_DEVMON_AUTO,
|
|
||||||
"ds", RIL_DEVMON_DS,
|
"ds", RIL_DEVMON_DS,
|
||||||
"ss", RIL_DEVMON_SS,
|
"ss", RIL_DEVMON_SS,
|
||||||
"ur", RIL_DEVMON_UR, NULL)) {
|
"ur", RIL_DEVMON_UR, NULL) && ival) {
|
||||||
DBG("%s: " RILCONF_DEVMON " %s", group,
|
int n = 0;
|
||||||
ival == RIL_DEVMON_NONE ? "off" :
|
struct ril_devmon *devmon[3];
|
||||||
ival == RIL_DEVMON_DS ? "on" :
|
|
||||||
ival == RIL_DEVMON_SS ? "legacy" :
|
if (ival & RIL_DEVMON_DS) devmon[n++] = ril_devmon_ds_new();
|
||||||
ival == RIL_DEVMON_UR ? "filter" :
|
if (ival & RIL_DEVMON_SS) devmon[n++] = ril_devmon_ss_new();
|
||||||
"auto");
|
if (ival & RIL_DEVMON_UR) devmon[n++] = ril_devmon_ur_new();
|
||||||
if (ival != RIL_DEVMON_AUTO) {
|
DBG("%s: " RILCONF_DEVMON " 0x%x", group, ival);
|
||||||
/* Default is automatic, reallocate the object */
|
|
||||||
ril_devmon_free(slot->devmon);
|
ril_devmon_free(slot->devmon);
|
||||||
slot->devmon =
|
slot->devmon = ril_devmon_combine(devmon, n);
|
||||||
(ival == RIL_DEVMON_DS ? ril_devmon_ds_new() :
|
} else {
|
||||||
ival == RIL_DEVMON_SS ? ril_devmon_ss_new() :
|
/* Try special values */
|
||||||
ival == RIL_DEVMON_UR ? ril_devmon_ur_new() :
|
sval = ril_config_get_string(file, group, RILCONF_DEVMON);
|
||||||
NULL);
|
if (sval) {
|
||||||
|
if (!g_ascii_strcasecmp(sval, "none")) {
|
||||||
|
DBG("%s: " RILCONF_DEVMON " %s", group, sval);
|
||||||
|
ril_devmon_free(slot->devmon);
|
||||||
|
slot->devmon = NULL;
|
||||||
|
} else if (!g_ascii_strcasecmp(sval, "auto")) {
|
||||||
|
DBG("%s: " RILCONF_DEVMON " %s", group, sval);
|
||||||
|
/* This is the default */
|
||||||
|
}
|
||||||
|
g_free(sval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -237,6 +237,13 @@ socket=/dev/socket/rild
|
|||||||
#
|
#
|
||||||
#networkModeTimeout=20000
|
#networkModeTimeout=20000
|
||||||
|
|
||||||
|
# Timeout for RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC and
|
||||||
|
# RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, in milliseconds.
|
||||||
|
#
|
||||||
|
# Default 100000 (100 seconds)
|
||||||
|
#
|
||||||
|
#networkSelectionTimeout=100000
|
||||||
|
|
||||||
# Comma-separated signal strength range, in dBm.
|
# Comma-separated signal strength range, in dBm.
|
||||||
#
|
#
|
||||||
# These values are used for translating dBm values returned by the modem in
|
# These values are used for translating dBm values returned by the modem in
|
||||||
@@ -308,6 +315,9 @@ socket=/dev/socket/rild
|
|||||||
# auto = Choose ss or ds based on the RIL version
|
# auto = Choose ss or ds based on the RIL version
|
||||||
# none = Disable device state management
|
# none = Disable device state management
|
||||||
#
|
#
|
||||||
|
# In addition to specifying ss, ds or ur method, one can specify a
|
||||||
|
# combination of methods, e.g. ds+ur
|
||||||
|
#
|
||||||
# Default auto
|
# Default auto
|
||||||
#
|
#
|
||||||
#deviceStateTracking=auto
|
#deviceStateTracking=auto
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ struct ril_slot_config {
|
|||||||
enum ril_pref_net_type lte_network_mode;
|
enum ril_pref_net_type lte_network_mode;
|
||||||
enum ril_pref_net_type umts_network_mode;
|
enum ril_pref_net_type umts_network_mode;
|
||||||
int network_mode_timeout;
|
int network_mode_timeout;
|
||||||
|
int network_selection_timeout;
|
||||||
int signal_strength_dbm_weak;
|
int signal_strength_dbm_weak;
|
||||||
int signal_strength_dbm_strong;
|
int signal_strength_dbm_strong;
|
||||||
gboolean query_available_band_mode;
|
gboolean query_available_band_mode;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* oFono - Open Source Telephony
|
* oFono - Open Source Telephony
|
||||||
*
|
*
|
||||||
* Copyright (C) 2018-2019 Jolla Ltd.
|
* Copyright (C) 2018-2020 Jolla Ltd.
|
||||||
* Copyright (C) 2019 Open Mobile Platform LLC.
|
* Copyright (C) 2019-2020 Open Mobile Platform LLC.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -377,6 +377,39 @@ static void test_get_enum(void)
|
|||||||
test_get_value(conf, test_get_enum_cb);
|
test_get_value(conf, test_get_enum_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ==== get_mask ==== */
|
||||||
|
|
||||||
|
static void test_get_mask_cb(GKeyFile *k)
|
||||||
|
{
|
||||||
|
int v = 0;
|
||||||
|
|
||||||
|
g_assert(!ril_config_get_mask(k, "g1", "k", NULL, "x",1, "y",2, NULL));
|
||||||
|
g_assert(!ril_config_get_mask(k, "g1", "k", &v, "x",1, "y",2, NULL));
|
||||||
|
g_assert_cmpint(v, ==, 0);
|
||||||
|
|
||||||
|
g_assert(ril_config_get_mask(k, "g", "k", NULL, "x",1, "y",2, NULL));
|
||||||
|
g_assert(ril_config_get_mask(k, "g", "k", &v, "x",1, "y",2, NULL));
|
||||||
|
g_assert_cmpint(v, ==, 1);
|
||||||
|
|
||||||
|
g_assert(ril_config_get_mask(k, "g", "k1", NULL, "x",1, "y",2, NULL));
|
||||||
|
g_assert(ril_config_get_mask(k, "g", "k1", &v, "x",1, "y",2, NULL));
|
||||||
|
g_assert_cmpint(v, ==, 3);
|
||||||
|
|
||||||
|
g_assert(!ril_config_get_mask(k, "g", "k2", NULL, "x",1, "y",2, NULL));
|
||||||
|
g_assert(!ril_config_get_mask(k, "g", "k2", &v, "x",1, "y",2, NULL));
|
||||||
|
g_assert_cmpint(v, ==, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_get_mask(void)
|
||||||
|
{
|
||||||
|
static const char conf [] = "[g]\n"
|
||||||
|
"k = x# comment\n"
|
||||||
|
"k1 = x+y\n"
|
||||||
|
"k2 = x+z+y\n";
|
||||||
|
|
||||||
|
test_get_value(conf, test_get_mask_cb);
|
||||||
|
}
|
||||||
|
|
||||||
/* ==== get_ints ==== */
|
/* ==== get_ints ==== */
|
||||||
|
|
||||||
static void test_get_ints_cb(GKeyFile *k)
|
static void test_get_ints_cb(GKeyFile *k)
|
||||||
@@ -451,6 +484,7 @@ int main(int argc, char *argv[])
|
|||||||
g_test_add_func(TEST_("get_boolean3"), test_get_boolean3);
|
g_test_add_func(TEST_("get_boolean3"), test_get_boolean3);
|
||||||
g_test_add_func(TEST_("get_flag"), test_get_flag);
|
g_test_add_func(TEST_("get_flag"), test_get_flag);
|
||||||
g_test_add_func(TEST_("get_enum"), test_get_enum);
|
g_test_add_func(TEST_("get_enum"), test_get_enum);
|
||||||
|
g_test_add_func(TEST_("get_mask"), test_get_mask);
|
||||||
g_test_add_func(TEST_("get_ints"), test_get_ints);
|
g_test_add_func(TEST_("get_ints"), test_get_ints);
|
||||||
g_test_add_func(TEST_("ints_to_string"), test_ints_to_string);
|
g_test_add_func(TEST_("ints_to_string"), test_ints_to_string);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user