Compare commits

...

10 Commits

Author SHA1 Message Date
Slava Monich
f56c8a33b0 Merge branch 'jb50995' into 'master'
[ril] Calculate signal strength based on rsrp value correctly. JB#50995.

See merge request mer-core/ofono!275
2020-09-15 10:46:22 +00:00
Aleksei Berman
ed2f625b8b [ril] Calculate signal strength based on rsrp value correctly. JB#50995.
All the dBm values are converted to qdbm (multiply by 4) but rsrp which
results in incorrect signal strength representation on some devices.
2020-08-28 15:57:33 +03:00
Slava Monich
ed62d38632 Merge branch 'jb50608' into 'master'
[ril] Add config options for cell info update interval. JB#50608

See merge request mer-core/ofono!273
2020-07-27 22:12:17 +00:00
Denis Grigorev
3f433c97c5 [ril] Add config options for cell info update interval. JB#50608 2020-07-28 00:18:52 +03:00
Denis Grigorev
86d8149c79 [ril] Allow setting cell info update period to 0. JB#50608
According to ril.h, a value of 0 means invoke RIL_UNSOL_CELL_INFO_LIST when
any of the reported information changes.
2020-07-27 21:33:03 +03:00
Slava Monich
f3eb9b868b [aarch64] Print PLUGINDIR when compiling. JB#49681
It's not obvious where it actualy comes from, let's have it in the build log.
2020-07-22 14:46:21 +03:00
chriadam
4e067fa827 Merge branch 'jb50214' into 'master'
[ofono] Don't support '.' as a DTMF pause character. Contributes to JB#50214

See merge request mer-core/ofono!271
2020-07-13 00:36:38 +00:00
Chris Adams
2ee5e4c827 [ofono] Don't support '.' as a DTMF pause character. Contributes to JB#50214 2020-07-13 10:35:30 +10:00
Niels Breet
1366e426be Merge branch 'jb49681' into 'master'
[aarch64] Use macros for unitdir. Contributes to JB#49681

See merge request mer-core/ofono!272
2020-07-08 13:19:30 +00:00
Niels Breet
586c9b9262 [aarch64] Use macros for unitdir. Contributes to JB#49681 2020-07-08 13:19:30 +00:00
13 changed files with 140 additions and 46 deletions

View File

@@ -373,7 +373,7 @@ static void ril_cell_info_query(struct ril_cell_info *self)
static void ril_cell_info_set_rate(struct ril_cell_info *self)
{
GRilIoRequest *req = grilio_request_array_int32_new(1,
(self->update_rate_ms > 0) ? self->update_rate_ms : INT_MAX);
(self->update_rate_ms >= 0) ? self->update_rate_ms : INT_MAX);
grilio_request_set_retry(req, RIL_RETRY_MS, MAX_RETRIES);
grilio_request_set_retry_func(req, ril_cell_info_retry);

View File

@@ -34,33 +34,29 @@ struct ril_devmon {
GRilIoChannel *channel, struct sailfish_cell_info *cell_info);
};
/* Cell info update intervals */
#define RIL_CELL_INFO_INTERVAL_SHORT_MS (2000) /* 2 sec */
#define RIL_CELL_INFO_INTERVAL_LONG_MS (30000) /* 30 sec */
/*
* Legacy Device Monitor uses RIL_REQUEST_SCREEN_STATE to tell
* the modem when screen turns on and off.
*/
struct ril_devmon *ril_devmon_ss_new(void);
struct ril_devmon *ril_devmon_ss_new(const struct ril_slot_config *config);
/*
* This Device Monitor uses RIL_REQUEST_SEND_DEVICE_STATE to let
* the modem choose the right power saving strategy. It basically
* mirrors the logic of Android's DeviceStateMonitor class.
*/
struct ril_devmon *ril_devmon_ds_new(void);
struct ril_devmon *ril_devmon_ds_new(const struct ril_slot_config *config);
/*
* This Device Monitor implementation controls network state updates
* by sending SET_UNSOLICITED_RESPONSE_FILTER.
*/
struct ril_devmon *ril_devmon_ur_new(void);
struct ril_devmon *ril_devmon_ur_new(const struct ril_slot_config *config);
/*
* This one selects the type based on the RIL version.
*/
struct ril_devmon *ril_devmon_auto_new(void);
struct ril_devmon *ril_devmon_auto_new(const struct ril_slot_config *config);
/*
* This one combines several methods. Takes ownership of ril_devmon objects.

View File

@@ -65,7 +65,7 @@ static void ril_devmon_auto_free(struct ril_devmon *devmon)
g_free(self);
}
struct ril_devmon *ril_devmon_auto_new()
struct ril_devmon *ril_devmon_auto_new(const struct ril_slot_config *config)
{
DevMon *self = g_new0(DevMon, 1);
@@ -78,8 +78,8 @@ struct ril_devmon *ril_devmon_auto_new()
*/
self->pub.free = ril_devmon_auto_free;
self->pub.start_io = ril_devmon_auto_start_io;
self->ss = ril_devmon_ss_new();
self->ds = ril_devmon_ds_new();
self->ss = ril_devmon_ss_new(config);
self->ds = ril_devmon_ds_new(config);
return &self->pub;
}

View File

@@ -65,6 +65,8 @@ typedef struct ril_devmon_ds {
MceBattery *battery;
MceCharger *charger;
MceDisplay *display;
int cell_info_interval_short_ms;
int cell_info_interval_long_ms;
} DevMon;
typedef struct ril_devmon_ds_io {
@@ -86,6 +88,8 @@ typedef struct ril_devmon_ds_io {
gulong charger_event_id[CHARGER_EVENT_COUNT];
gulong display_event_id[DISPLAY_EVENT_COUNT];
guint req_id;
int cell_info_interval_short_ms;
int cell_info_interval_long_ms;
} DevMonIo;
#define DBG_(self,fmt,args...) DBG("%s: " fmt, (self)->io->name, ##args)
@@ -201,8 +205,8 @@ static void ril_devmon_ds_io_set_cell_info_update_interval(DevMonIo *self)
(ril_devmon_ds_display_on(self->display) &&
(ril_devmon_ds_charging(self->charger) ||
ril_devmon_ds_battery_ok(self->battery))) ?
RIL_CELL_INFO_INTERVAL_SHORT_MS :
RIL_CELL_INFO_INTERVAL_LONG_MS);
self->cell_info_interval_short_ms :
self->cell_info_interval_long_ms);
}
static void ril_devmon_ds_io_connman_cb(struct ril_connman *connman,
@@ -303,6 +307,11 @@ static struct ril_devmon_io *ril_devmon_ds_start_io(struct ril_devmon *devmon,
mce_display_add_state_changed_handler(self->display,
ril_devmon_ds_io_display_cb, self);
self->cell_info_interval_short_ms =
ds->cell_info_interval_short_ms;
self->cell_info_interval_long_ms =
ds->cell_info_interval_long_ms;
ril_devmon_ds_io_update_low_data(self);
ril_devmon_ds_io_update_charging(self);
ril_devmon_ds_io_set_cell_info_update_interval(self);
@@ -320,7 +329,7 @@ static void ril_devmon_ds_free(struct ril_devmon *devmon)
g_free(self);
}
struct ril_devmon *ril_devmon_ds_new()
struct ril_devmon *ril_devmon_ds_new(const struct ril_slot_config *config)
{
DevMon *self = g_new0(DevMon, 1);
@@ -330,6 +339,10 @@ struct ril_devmon *ril_devmon_ds_new()
self->battery = mce_battery_new();
self->charger = mce_charger_new();
self->display = mce_display_new();
self->cell_info_interval_short_ms =
config->cell_info_interval_short_ms;
self->cell_info_interval_long_ms =
config->cell_info_interval_long_ms;
return &self->pub;
}

View File

@@ -50,6 +50,8 @@ typedef struct ril_devmon_ss {
MceBattery *battery;
MceCharger *charger;
MceDisplay *display;
int cell_info_interval_short_ms;
int cell_info_interval_long_ms;
} DevMon;
typedef struct ril_devmon_ss_io {
@@ -65,6 +67,8 @@ typedef struct ril_devmon_ss_io {
gulong charger_event_id[CHARGER_EVENT_COUNT];
gulong display_event_id[DISPLAY_EVENT_COUNT];
guint req_id;
int cell_info_interval_short_ms;
int cell_info_interval_long_ms;
} DevMonIo;
inline static DevMon *ril_devmon_ss_cast(struct ril_devmon *pub)
@@ -130,8 +134,8 @@ static void ril_devmon_ss_io_set_cell_info_update_interval(DevMonIo *self)
sailfish_cell_info_set_update_interval(self->cell_info,
(self->display_on && (ril_devmon_ss_charging(self->charger) ||
ril_devmon_ss_battery_ok(self->battery))) ?
RIL_CELL_INFO_INTERVAL_SHORT_MS :
RIL_CELL_INFO_INTERVAL_LONG_MS);
self->cell_info_interval_short_ms :
self->cell_info_interval_long_ms);
}
static void ril_devmon_ss_io_battery_cb(MceBattery *battery, void *user_data)
@@ -212,6 +216,11 @@ static struct ril_devmon_io *ril_devmon_ss_start_io(struct ril_devmon *devmon,
mce_display_add_state_changed_handler(self->display,
ril_devmon_ss_io_display_cb, self);
self->cell_info_interval_short_ms =
ss->cell_info_interval_short_ms;
self->cell_info_interval_long_ms =
ss->cell_info_interval_long_ms;
ril_devmon_ss_io_send_screen_state(self);
ril_devmon_ss_io_set_cell_info_update_interval(self);
return &self->pub;
@@ -227,7 +236,7 @@ static void ril_devmon_ss_free(struct ril_devmon *devmon)
g_free(self);
}
struct ril_devmon *ril_devmon_ss_new()
struct ril_devmon *ril_devmon_ss_new(const struct ril_slot_config *config)
{
DevMon *self = g_new0(DevMon, 1);
@@ -236,6 +245,10 @@ struct ril_devmon *ril_devmon_ss_new()
self->battery = mce_battery_new();
self->charger = mce_charger_new();
self->display = mce_display_new();
self->cell_info_interval_short_ms =
config->cell_info_interval_short_ms;
self->cell_info_interval_long_ms =
config->cell_info_interval_long_ms;
return &self->pub;
}

View File

@@ -55,6 +55,8 @@ typedef struct ril_devmon_ur {
MceBattery *battery;
MceCharger *charger;
MceDisplay *display;
int cell_info_interval_short_ms;
int cell_info_interval_long_ms;
} DevMon;
typedef struct ril_devmon_ur_io {
@@ -70,6 +72,8 @@ typedef struct ril_devmon_ur_io {
gulong charger_event_id[CHARGER_EVENT_COUNT];
gulong display_event_id[DISPLAY_EVENT_COUNT];
guint req_id;
int cell_info_interval_short_ms;
int cell_info_interval_long_ms;
} DevMonIo;
#define DBG_(self,fmt,args...) DBG("%s: " fmt, (self)->io->name, ##args)
@@ -136,8 +140,8 @@ static void ril_devmon_ur_io_set_cell_info_update_interval(DevMonIo *self)
sailfish_cell_info_set_update_interval(self->cell_info,
(self->display_on && (ril_devmon_ur_charging(self->charger) ||
ril_devmon_ur_battery_ok(self->battery))) ?
RIL_CELL_INFO_INTERVAL_SHORT_MS :
RIL_CELL_INFO_INTERVAL_LONG_MS);
self->cell_info_interval_short_ms :
self->cell_info_interval_long_ms);
}
static void ril_devmon_ur_io_battery_cb(MceBattery *battery, void *user_data)
@@ -218,6 +222,11 @@ static struct ril_devmon_io *ril_devmon_ur_start_io(struct ril_devmon *devmon,
mce_display_add_state_changed_handler(self->display,
ril_devmon_ur_io_display_cb, self);
self->cell_info_interval_short_ms =
ur->cell_info_interval_short_ms;
self->cell_info_interval_long_ms =
ur->cell_info_interval_long_ms;
ril_devmon_ur_io_set_unsol_response_filter(self);
ril_devmon_ur_io_set_cell_info_update_interval(self);
return &self->pub;
@@ -233,7 +242,7 @@ static void ril_devmon_ur_free(struct ril_devmon *devmon)
g_free(self);
}
struct ril_devmon *ril_devmon_ur_new()
struct ril_devmon *ril_devmon_ur_new(const struct ril_slot_config *config)
{
DevMon *self = g_new0(DevMon, 1);
@@ -242,6 +251,10 @@ struct ril_devmon *ril_devmon_ur_new()
self->battery = mce_battery_new();
self->charger = mce_charger_new();
self->display = mce_display_new();
self->cell_info_interval_short_ms =
config->cell_info_interval_short_ms;
self->cell_info_interval_long_ms =
config->cell_info_interval_long_ms;
return &self->pub;
}

View File

@@ -503,7 +503,7 @@ static int ril_netreg_get_signal_strength(struct ril_netreg *nd,
signal.qdbm = -4 * tdscdma_dbm;
} else if (signal.lte == 99 && rsrp >= 44 && rsrp <= 140) {
/* RSRP range: 44 to 140 dBm per 3GPP TS 36.133 */
signal.qdbm = -rsrp;
signal.qdbm = -4 * rsrp;
}
}

View File

@@ -100,6 +100,8 @@
#define RILMODEM_DEFAULT_USE_DATA_PROFILES FALSE
#define RILMODEM_DEFAULT_MMS_DATA_PROFILE_ID RIL_DATA_PROFILE_IMS
#define RILMODEM_DEFAULT_SLOT_FLAGS SAILFISH_SLOT_NO_FLAGS
#define RILMODEM_DEFAULT_CELL_INFO_INTERVAL_SHORT_MS (2000) /* 2 sec */
#define RILMODEM_DEFAULT_CELL_INFO_INTERVAL_LONG_MS (30000) /* 30 sec */
/* RIL socket transport name and parameters */
#define RIL_TRANSPORT_MODEM "modem"
@@ -158,6 +160,8 @@
#define RILCONF_USE_DATA_PROFILES "useDataProfiles"
#define RILCONF_MMS_DATA_PROFILE_ID "mmsDataProfileId"
#define RILCONF_DEVMON "deviceStateTracking"
#define RILCONF_CELL_INFO_INTERVAL_SHORT_MS "cellInfoIntervalShortMs"
#define RILCONF_CELL_INFO_INTERVAL_LONG_MS "cellInfoIntervalLongMs"
/* Modem error ids */
#define RIL_ERROR_ID_RILD_RESTART "rild-restart"
@@ -1230,6 +1234,10 @@ static ril_slot *ril_plugin_slot_new_take(char *transport,
RILMODEM_DEFAULT_FORCE_GSM_WHEN_RADIO_OFF;
config->use_data_profiles = RILMODEM_DEFAULT_USE_DATA_PROFILES;
config->mms_data_profile_id = RILMODEM_DEFAULT_MMS_DATA_PROFILE_ID;
config->cell_info_interval_short_ms =
RILMODEM_DEFAULT_CELL_INFO_INTERVAL_SHORT_MS;
config->cell_info_interval_long_ms =
RILMODEM_DEFAULT_CELL_INFO_INTERVAL_LONG_MS;
slot->timeout = RILMODEM_DEFAULT_TIMEOUT;
slot->sim_flags = RILMODEM_DEFAULT_SIM_FLAGS;
slot->slot_flags = RILMODEM_DEFAULT_SLOT_FLAGS;
@@ -1241,8 +1249,7 @@ static ril_slot *ril_plugin_slot_new_take(char *transport,
RILMODEM_DEFAULT_DATA_CALL_RETRY_LIMIT;
slot->data_opt.data_call_retry_delay_ms =
RILMODEM_DEFAULT_DATA_CALL_RETRY_DELAY;
slot->devmon = ril_devmon_auto_new();
slot->devmon = ril_devmon_auto_new(config);
slot->watch = ofono_watch_new(dbus_path);
slot->watch_event_id[WATCH_EVENT_MODEM] =
ofono_watch_add_modem_changed_handler(slot->watch,
@@ -1742,6 +1749,26 @@ static ril_slot *ril_plugin_parse_config_group(GKeyFile *file,
slot->legacy_imei_query ? "on" : "off");
}
/* cellInfoIntervalShortMs */
if (ril_config_get_integer(file, group,
RILCONF_CELL_INFO_INTERVAL_SHORT_MS,
&config->cell_info_interval_short_ms)) {
DBG("%s: " RILCONF_CELL_INFO_INTERVAL_SHORT_MS " %d", group,
config->cell_info_interval_short_ms);
}
/* cellInfoIntervalLongMs */
if (ril_config_get_integer(file, group,
RILCONF_CELL_INFO_INTERVAL_LONG_MS,
&config->cell_info_interval_long_ms)) {
DBG("%s: " RILCONF_CELL_INFO_INTERVAL_LONG_MS " %d",
group, config->cell_info_interval_long_ms);
}
/* Replace devmon with a new one with applied settings */
ril_devmon_free(slot->devmon);
slot->devmon = NULL;
/* deviceStateTracking */
if (ril_config_get_mask(file, group, RILCONF_DEVMON, &ival,
"ds", RIL_DEVMON_DS,
@@ -1750,11 +1777,16 @@ static ril_slot *ril_plugin_parse_config_group(GKeyFile *file,
int n = 0;
struct ril_devmon *devmon[3];
if (ival & RIL_DEVMON_DS) devmon[n++] = ril_devmon_ds_new();
if (ival & RIL_DEVMON_SS) devmon[n++] = ril_devmon_ss_new();
if (ival & RIL_DEVMON_UR) devmon[n++] = ril_devmon_ur_new();
if (ival & RIL_DEVMON_DS) {
devmon[n++] = ril_devmon_ds_new(config);
}
if (ival & RIL_DEVMON_SS) {
devmon[n++] = ril_devmon_ss_new(config);
}
if (ival & RIL_DEVMON_UR) {
devmon[n++] = ril_devmon_ur_new(config);
}
DBG("%s: " RILCONF_DEVMON " 0x%x", group, ival);
ril_devmon_free(slot->devmon);
slot->devmon = ril_devmon_combine(devmon, n);
} else {
/* Try special values */
@@ -1762,13 +1794,14 @@ static ril_slot *ril_plugin_parse_config_group(GKeyFile *file,
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 */
slot->devmon = ril_devmon_auto_new(config);
}
g_free(sval);
} else {
/* This is the default */
slot->devmon = ril_devmon_auto_new(config);
}
}

View File

@@ -339,3 +339,29 @@ socket=/dev/socket/rild
# Default true (false for MTK RILs)
#
#forceGsmWhenRadioOff=true
# Configures a period between RIL_UNSOL_CELL_INFO_LIST events when the device
# is awake. Possible values are:
#
# 0 = invoke RIL_UNSOL_CELL_INFO_LIST when any of the reported information
# changes
# 1..INT_MAX-1 (2147483646) = sets update period in milliseconds
# negative value or INT_MAX = never issue a RIL_UNSOL_CELL_INFO_LIST
#
# On MediaTek devices the period of RIL_UNSOL_CELL_INFO_LIST events can't be
# configured. The parameter RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE has
# non-standard meaning:
#
# 0 = enable RIL_UNSOL_CELL_INFO_LIST
# any other value = disable RIL_UNSOL_CELL_INFO_LIST
#
# Default 2000
#
#cellInfoIntervalShortMs=2000
# Configures period between RIL_UNSOL_CELL_INFO_LIST events when the device is
# in a power saving mode. For possible values, look cellInfoIntervalShortMs.
#
# Default 30000
#
#cellInfoIntervalLongMs=30000

View File

@@ -79,6 +79,8 @@ struct ril_slot_config {
guint mms_data_profile_id;
GUtilInts *local_hangup_reasons;
GUtilInts *remote_hangup_reasons;
int cell_info_interval_short_ms;
int cell_info_interval_long_ms;
};
#endif /* RIL_TYPES_H */

View File

@@ -30,6 +30,8 @@
#include "ofono.h"
#pragma message("PLUGINDIR="PLUGINDIR)
static GSList *plugins = NULL;
struct ofono_plugin {

View File

@@ -349,12 +349,12 @@ static int tone_queue(struct ofono_voicecall *vc, const char *tone_str,
/*
* Tones can be 0-9, *, #, A-D according to 27.007 C.2.11,
* and p for Pause.
* and p for Pause (also , for Pause as per ITU-T V.250 6.3.1.2).
*/
for (i = 0; tone_str[i]; i++)
if (!g_ascii_isdigit(tone_str[i]) && tone_str[i] != 'p' &&
tone_str[i] != 'P' && tone_str[i] != '*' &&
tone_str[i] != '.' && tone_str[i] != ',' &&
tone_str[i] != ',' &&
tone_str[i] != '#' && (tone_str[i] < 'A' ||
tone_str[i] > 'D'))
return -EINVAL;
@@ -4389,7 +4389,7 @@ static void tone_request_cb(const struct ofono_error *error, void *data)
goto done;
}
len = strspn(entry->left, "pP.,");
len = strspn(entry->left, "pP,");
entry->left += len;
done:
@@ -4423,7 +4423,7 @@ static gboolean tone_request_run(gpointer user_data)
if (entry == NULL)
return FALSE;
len = strcspn(entry->left, "pP.,");
len = strcspn(entry->left, "pP,");
if (len) {
if (len > 8) /* Arbitrary length limit per request */

View File

@@ -2,7 +2,6 @@ Name: ofono
Summary: Open Source Telephony
Version: 1.23
Release: 1
Group: Communications/Connectivity Adaptation
License: GPLv2
URL: https://git.sailfishos.org/mer-core/ofono
Source: %{name}-%{version}.tar.bz2
@@ -38,13 +37,13 @@ BuildRequires: pkgconfig(mobile-broadband-provider-info)
BuildRequires: libtool
BuildRequires: automake
BuildRequires: autoconf
BuildRequires: systemd
%description
Telephony stack
%package devel
Summary: Headers for oFono
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
%description devel
@@ -52,7 +51,6 @@ Development headers and libraries for oFono
%package tests
Summary: Test Scripts for oFono
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: dbus-python3
Requires: python3-gobject
@@ -64,7 +62,6 @@ Scripts for testing oFono and its functionality
%package configs-mer
Summary: Package to provide default configs for ofono
Group: Development/Tools
Provides: ofono-configs
%description configs-mer
@@ -72,7 +69,6 @@ This package provides default configs for ofono
%package doc
Summary: Documentation for %{name}
Group: Documentation
Requires: %{name} = %{version}-%{release}
%description doc
@@ -98,9 +94,9 @@ autoreconf --force --install
--disable-add-remove-context \
--disable-isimodem \
--disable-qmimodem \
--with-systemdunitdir="/%{_lib}/systemd/system"
--with-systemdunitdir=%{_unitdir}
make %{_smp_mflags}
%make_build
%check
# run unit tests
@@ -111,9 +107,9 @@ rm -rf %{buildroot}
%make_install
mkdir -p %{buildroot}/%{_sysconfdir}/ofono/push_forwarder.d
mkdir -p %{buildroot}/%{_lib}/systemd/system/network.target.wants
mkdir -p %{buildroot}%{_unitdir}/network.target.wants
mkdir -p %{buildroot}/var/lib/ofono
ln -s ../ofono.service %{buildroot}/%{_lib}/systemd/system/network.target.wants/ofono.service
ln -s ../ofono.service %{buildroot}%{_unitdir}/network.target.wants/ofono.service
mkdir -p %{buildroot}%{_docdir}/%{name}-%{version}
install -m0644 -t %{buildroot}%{_docdir}/%{name}-%{version} \
@@ -139,8 +135,8 @@ systemctl daemon-reload ||:
%license COPYING
%config %{_sysconfdir}/dbus-1/system.d/*.conf
%{_sbindir}/*
/%{_lib}/systemd/system/network.target.wants/ofono.service
/%{_lib}/systemd/system/ofono.service
%{_unitdir}/network.target.wants/ofono.service
%{_unitdir}/ofono.service
%dir %{_sysconfdir}/ofono/
%dir %{_sysconfdir}/ofono/push_forwarder.d
# This file is part of phonesim and not needed with ofono.