mirror of
https://github.com/sailfishos/ofono
synced 2025-12-02 23:51:10 +08:00
Compare commits
5 Commits
mer/1.23+g
...
mer/1.23+g
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1366e426be | ||
|
|
586c9b9262 | ||
|
|
83554e071a | ||
|
|
dc41c2d003 | ||
|
|
550d41ae37 |
@@ -24,6 +24,7 @@ struct ril_cbs {
|
|||||||
GRilIoChannel *io;
|
GRilIoChannel *io;
|
||||||
GRilIoQueue *q;
|
GRilIoQueue *q;
|
||||||
char *log_prefix;
|
char *log_prefix;
|
||||||
|
guint register_id;
|
||||||
gulong event_id;
|
gulong event_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -51,6 +52,12 @@ static struct ril_cbs_cbd *ril_cbs_cbd_new(struct ril_cbs *cd,
|
|||||||
return cbd;
|
return cbd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean ril_cbs_retry(GRilIoRequest *request, int ril_status,
|
||||||
|
const void *resp_data, guint resp_len, void *user_data)
|
||||||
|
{
|
||||||
|
return ril_status == RIL_E_INVALID_STATE;
|
||||||
|
}
|
||||||
|
|
||||||
static void ril_cbs_request_activation(struct ril_cbs *cd,
|
static void ril_cbs_request_activation(struct ril_cbs *cd,
|
||||||
gboolean activate, GRilIoChannelResponseFunc response,
|
gboolean activate, GRilIoChannelResponseFunc response,
|
||||||
GDestroyNotify destroy, void* user_data)
|
GDestroyNotify destroy, void* user_data)
|
||||||
@@ -61,6 +68,9 @@ static void ril_cbs_request_activation(struct ril_cbs *cd,
|
|||||||
grilio_request_append_int32(req, activate ? 0 :1);
|
grilio_request_append_int32(req, activate ? 0 :1);
|
||||||
|
|
||||||
DBG_(cd, "%sactivating CB", activate ? "" : "de");
|
DBG_(cd, "%sactivating CB", activate ? "" : "de");
|
||||||
|
grilio_request_set_retry_func(req, ril_cbs_retry);
|
||||||
|
grilio_request_set_retry(req, RIL_CBS_CHECK_RETRY_MS,
|
||||||
|
RIL_CBS_CHECK_RETRY_COUNT);
|
||||||
grilio_queue_send_request_full(cd->q, req,
|
grilio_queue_send_request_full(cd->q, req,
|
||||||
RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION,
|
RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION,
|
||||||
response, destroy, user_data);
|
response, destroy, user_data);
|
||||||
@@ -97,6 +107,9 @@ static void ril_cbs_set_config(struct ril_cbs *cd, const char *topics,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DBG_(cd, "configuring CB");
|
DBG_(cd, "configuring CB");
|
||||||
|
grilio_request_set_retry_func(req, ril_cbs_retry);
|
||||||
|
grilio_request_set_retry(req, RIL_CBS_CHECK_RETRY_MS,
|
||||||
|
RIL_CBS_CHECK_RETRY_COUNT);
|
||||||
grilio_queue_send_request_full(cd->q, req,
|
grilio_queue_send_request_full(cd->q, req,
|
||||||
RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG,
|
RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG,
|
||||||
response, destroy, user_data);
|
response, destroy, user_data);
|
||||||
@@ -152,28 +165,33 @@ static void ril_cbs_notify(GRilIoChannel *io, guint code,
|
|||||||
if (grilio_parser_get_uint32(&rilp, &pdu_len)) {
|
if (grilio_parser_get_uint32(&rilp, &pdu_len)) {
|
||||||
const void* pdu = grilio_parser_get_bytes(&rilp, pdu_len);
|
const void* pdu = grilio_parser_get_bytes(&rilp, pdu_len);
|
||||||
|
|
||||||
if (pdu) {
|
/*
|
||||||
|
* By default assume that it's a length followed by the
|
||||||
|
* binary PDU data.
|
||||||
|
*/
|
||||||
|
if (pdu && grilio_parser_bytes_remaining(&rilp) < 4) {
|
||||||
DBG_(cd, "%u bytes", pdu_len);
|
DBG_(cd, "%u bytes", pdu_len);
|
||||||
ofono_cbs_notify(cd->cbs, pdu, pdu_len);
|
ofono_cbs_notify(cd->cbs, pdu, pdu_len);
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* But I've seen cell broadcasts arriving without
|
||||||
|
* the length, simply as a blob.
|
||||||
|
*/
|
||||||
|
ofono_cbs_notify(cd->cbs, data, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ril_cbs_probe_done_cb(GRilIoChannel *io, int status,
|
static gboolean ril_cbs_register(void *user_data)
|
||||||
const void *data, guint len, void *user_data)
|
|
||||||
{
|
{
|
||||||
struct ril_cbs *cd = user_data;
|
struct ril_cbs *cd = user_data;
|
||||||
|
|
||||||
if (status == RIL_E_SUCCESS) {
|
|
||||||
DBG_(cd, "registering for CB");
|
DBG_(cd, "registering for CB");
|
||||||
|
cd->register_id = 0;
|
||||||
cd->event_id = grilio_channel_add_unsol_event_handler(cd->io,
|
cd->event_id = grilio_channel_add_unsol_event_handler(cd->io,
|
||||||
ril_cbs_notify, RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS,
|
ril_cbs_notify, RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS, cd);
|
||||||
cd);
|
|
||||||
ofono_cbs_register(cd->cbs);
|
ofono_cbs_register(cd->cbs);
|
||||||
} else {
|
return G_SOURCE_REMOVE;
|
||||||
DBG_(cd, "failed to query CB config");
|
|
||||||
ofono_cbs_remove(cd->cbs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ril_cbs_probe(struct ofono_cbs *cbs, unsigned int vendor,
|
static int ril_cbs_probe(struct ofono_cbs *cbs, unsigned int vendor,
|
||||||
@@ -181,7 +199,6 @@ static int ril_cbs_probe(struct ofono_cbs *cbs, unsigned int vendor,
|
|||||||
{
|
{
|
||||||
struct ril_modem *modem = data;
|
struct ril_modem *modem = data;
|
||||||
struct ril_cbs *cd = g_try_new0(struct ril_cbs, 1);
|
struct ril_cbs *cd = g_try_new0(struct ril_cbs, 1);
|
||||||
GRilIoRequest* req = grilio_request_new();
|
|
||||||
|
|
||||||
ofono_cbs_set_data(cbs, cd);
|
ofono_cbs_set_data(cbs, cd);
|
||||||
cd->log_prefix = (modem->log_prefix && modem->log_prefix[0]) ?
|
cd->log_prefix = (modem->log_prefix && modem->log_prefix[0]) ?
|
||||||
@@ -191,20 +208,7 @@ static int ril_cbs_probe(struct ofono_cbs *cbs, unsigned int vendor,
|
|||||||
DBG_(cd, "");
|
DBG_(cd, "");
|
||||||
cd->io = grilio_channel_ref(ril_modem_io(modem));
|
cd->io = grilio_channel_ref(ril_modem_io(modem));
|
||||||
cd->q = grilio_queue_new(cd->io);
|
cd->q = grilio_queue_new(cd->io);
|
||||||
|
cd->register_id = g_idle_add(ril_cbs_register, cd);
|
||||||
/*
|
|
||||||
* RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG often fails at startup
|
|
||||||
* especially if other RIL requests are running in parallel. We may
|
|
||||||
* have to retry a few times. Also, make it blocking in order to
|
|
||||||
* improve the chance of success.
|
|
||||||
*/
|
|
||||||
grilio_request_set_retry(req, RIL_CBS_CHECK_RETRY_MS,
|
|
||||||
RIL_CBS_CHECK_RETRY_COUNT);
|
|
||||||
grilio_request_set_blocking(req, TRUE);
|
|
||||||
grilio_queue_send_request_full(cd->q, req,
|
|
||||||
RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG,
|
|
||||||
ril_cbs_probe_done_cb, NULL, cd);
|
|
||||||
grilio_request_unref(req);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,6 +217,9 @@ static void ril_cbs_remove(struct ofono_cbs *cbs)
|
|||||||
struct ril_cbs *cd = ofono_cbs_get_data(cbs);
|
struct ril_cbs *cd = ofono_cbs_get_data(cbs);
|
||||||
|
|
||||||
DBG_(cd, "");
|
DBG_(cd, "");
|
||||||
|
if (cd->register_id) {
|
||||||
|
g_source_remove(cd->register_id);
|
||||||
|
}
|
||||||
ofono_cbs_set_data(cbs, NULL);
|
ofono_cbs_set_data(cbs, NULL);
|
||||||
grilio_channel_remove_handler(cd->io, cd->event_id);
|
grilio_channel_remove_handler(cd->io, cd->event_id);
|
||||||
grilio_channel_unref(cd->io);
|
grilio_channel_unref(cd->io);
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ Name: ofono
|
|||||||
Summary: Open Source Telephony
|
Summary: Open Source Telephony
|
||||||
Version: 1.23
|
Version: 1.23
|
||||||
Release: 1
|
Release: 1
|
||||||
Group: Communications/Connectivity Adaptation
|
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
URL: https://git.sailfishos.org/mer-core/ofono
|
URL: https://git.sailfishos.org/mer-core/ofono
|
||||||
Source: %{name}-%{version}.tar.bz2
|
Source: %{name}-%{version}.tar.bz2
|
||||||
@@ -38,13 +37,13 @@ BuildRequires: pkgconfig(mobile-broadband-provider-info)
|
|||||||
BuildRequires: libtool
|
BuildRequires: libtool
|
||||||
BuildRequires: automake
|
BuildRequires: automake
|
||||||
BuildRequires: autoconf
|
BuildRequires: autoconf
|
||||||
|
BuildRequires: systemd
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Telephony stack
|
Telephony stack
|
||||||
|
|
||||||
%package devel
|
%package devel
|
||||||
Summary: Headers for oFono
|
Summary: Headers for oFono
|
||||||
Group: Development/Libraries
|
|
||||||
Requires: %{name} = %{version}-%{release}
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
|
||||||
%description devel
|
%description devel
|
||||||
@@ -52,7 +51,6 @@ Development headers and libraries for oFono
|
|||||||
|
|
||||||
%package tests
|
%package tests
|
||||||
Summary: Test Scripts for oFono
|
Summary: Test Scripts for oFono
|
||||||
Group: Development/Libraries
|
|
||||||
Requires: %{name} = %{version}-%{release}
|
Requires: %{name} = %{version}-%{release}
|
||||||
Requires: dbus-python3
|
Requires: dbus-python3
|
||||||
Requires: python3-gobject
|
Requires: python3-gobject
|
||||||
@@ -64,7 +62,6 @@ Scripts for testing oFono and its functionality
|
|||||||
|
|
||||||
%package configs-mer
|
%package configs-mer
|
||||||
Summary: Package to provide default configs for ofono
|
Summary: Package to provide default configs for ofono
|
||||||
Group: Development/Tools
|
|
||||||
Provides: ofono-configs
|
Provides: ofono-configs
|
||||||
|
|
||||||
%description configs-mer
|
%description configs-mer
|
||||||
@@ -72,7 +69,6 @@ This package provides default configs for ofono
|
|||||||
|
|
||||||
%package doc
|
%package doc
|
||||||
Summary: Documentation for %{name}
|
Summary: Documentation for %{name}
|
||||||
Group: Documentation
|
|
||||||
Requires: %{name} = %{version}-%{release}
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
|
||||||
%description doc
|
%description doc
|
||||||
@@ -98,9 +94,9 @@ autoreconf --force --install
|
|||||||
--disable-add-remove-context \
|
--disable-add-remove-context \
|
||||||
--disable-isimodem \
|
--disable-isimodem \
|
||||||
--disable-qmimodem \
|
--disable-qmimodem \
|
||||||
--with-systemdunitdir="/%{_lib}/systemd/system"
|
--with-systemdunitdir=%{_unitdir}
|
||||||
|
|
||||||
make %{_smp_mflags}
|
%make_build
|
||||||
|
|
||||||
%check
|
%check
|
||||||
# run unit tests
|
# run unit tests
|
||||||
@@ -111,9 +107,9 @@ rm -rf %{buildroot}
|
|||||||
%make_install
|
%make_install
|
||||||
|
|
||||||
mkdir -p %{buildroot}/%{_sysconfdir}/ofono/push_forwarder.d
|
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
|
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}
|
mkdir -p %{buildroot}%{_docdir}/%{name}-%{version}
|
||||||
install -m0644 -t %{buildroot}%{_docdir}/%{name}-%{version} \
|
install -m0644 -t %{buildroot}%{_docdir}/%{name}-%{version} \
|
||||||
@@ -139,8 +135,8 @@ systemctl daemon-reload ||:
|
|||||||
%license COPYING
|
%license COPYING
|
||||||
%config %{_sysconfdir}/dbus-1/system.d/*.conf
|
%config %{_sysconfdir}/dbus-1/system.d/*.conf
|
||||||
%{_sbindir}/*
|
%{_sbindir}/*
|
||||||
/%{_lib}/systemd/system/network.target.wants/ofono.service
|
%{_unitdir}/network.target.wants/ofono.service
|
||||||
/%{_lib}/systemd/system/ofono.service
|
%{_unitdir}/ofono.service
|
||||||
%dir %{_sysconfdir}/ofono/
|
%dir %{_sysconfdir}/ofono/
|
||||||
%dir %{_sysconfdir}/ofono/push_forwarder.d
|
%dir %{_sysconfdir}/ofono/push_forwarder.d
|
||||||
# This file is part of phonesim and not needed with ofono.
|
# This file is part of phonesim and not needed with ofono.
|
||||||
|
|||||||
Reference in New Issue
Block a user