Compare commits

...

54 Commits

Author SHA1 Message Date
Martti Piirainen
6d35002f11 Merge pull request #197 from nemomobile-packages/next
Merge quite a many things from 'next' to 'master'
2014-03-13 17:23:44 +02:00
Tommi Kenakkala
803dda81ea Merge pull request #196 from marttipiirainen/next
Merge latest upstream oFono up to commit 278dba2ec8.
2014-03-13 13:19:33 +02:00
Slava Monich
31f8abf851 mbpi: Pop subparser stack after mmsc and mmsproxy 2014-03-13 13:19:33 +02:00
Marcel Holtmann
8f4aefa945 gatchat: Fix handling of WRITE_SCHEDULER_DEBUG 2014-03-13 13:19:33 +02:00
Tommi Kenakkala
58e133cbf5 Merge pull request #186 from ptakalok/call_forw
[rilmodem] Change call forwarding default service class per RIL design
2014-03-13 13:19:32 +02:00
Slava Monich
6c3992aa86 include: Be more const-correct in ofono_dbus_* 2014-03-13 13:19:32 +02:00
Jarko Poutiainen
c3352608c6 Merge pull request #192 from jkangas/next
Request for pulling direct SPDI reading without service table check to next branch
2014-03-13 13:19:32 +02:00
Petri Takalokastari
5da34324ca [rilmodem] Change call forwarding default service class per RIL design
RIL expects service class BEARER_CLASS_VOICE in
RIL_REQUEST_SET_CALL_FORWARD and SERVICE_CLASS_NONE in
RIL_REQUEST_QUERY_CALL_FORWARD_STATUS.

Signed-off-by: Petri Takalokastari <petri.takalokastari@oss.tieto.com>
2014-03-13 13:19:32 +02:00
Miia Leinonen
b64a5c2655 Merge pull request #191 from jkangas/next
Request for pulling cbs disabling and handling of non-existent response fix to next branch
2014-03-13 13:19:32 +02:00
Jussi Kangas
e11c1afdd3 [network] Do not check the service table before reading SPDI
Although it is correct to check support for service provider display
info from service table before reading, operators don't necessarily
care about such details. Direct reading is the surest way to find out
if the info is present or not. If it is not, ofono will just get
failure from modem.

Signed-off-by: Jussi Kangas <jussi.kangas@oss.tieto.com>
2014-03-13 13:19:32 +02:00
Jussi Kangas
9834debe92 Merge pull request #190 from leinomii/next
[rilmodem] Enable SIM operations in expired SIM cards
2014-03-13 13:19:31 +02:00
Jussi Kangas
2d75463ae2 [rilmodem] Do not handle unexisting response
Running disable-modem test case seems to cause assert triggering
in gril in developer mode. Since method seems to survive just fine
from handling of zero length command queue, removing the assert
helps testing in developer mode.

Signed-off-by: Jussi Kangas <jussi.kangas@oss.tieto.com>
2014-03-13 13:19:31 +02:00
Miia Leinonen
95b95f9af9 Merge pull request #189 from jkangas/next
Request for pulling usage of preset paths when reading ADN records to next branch
2014-03-13 13:19:31 +02:00
Miia Leinonen
d43ec9e0ed [rilmodem] Enable SIM operations also in outdated SIM cards
Following Android example for interpreting RIL_APPSTATE_ILLEGAL
as RIL_APPSTATE_READY. E.g. SIM cards that are expired can go to
this state. By mapping the state to READY we are still able to
use the SIM features such as reading phonebook. Network access
will not be permitted with such SIM card regardless or READY
state.

Signed-off-by: Miia Leinonen <miia.leinonen@oss.tieto.com>
2014-03-13 13:19:31 +02:00
Jussi Kangas
8bc1e0a300 [rilmodem] Disable cbs support
We don't know for sure if registering to listen CBS messages
causes unnecessary power consumption with our modem but since we are
not really supporting it it's better to disable the feature for now.

Signed-off-by: Jussi Kangas <jussi.kangas@oss.tieto.com>
2014-03-13 13:19:31 +02:00
Martti Piirainen
b489dc995b Merge pull request #188 from jkangas/next
Request for pulling EFPNN 7-bit unpacking before trying convert it to UTF8 to next branch
2014-03-13 13:19:31 +02:00
Jussi Kangas
d25fd17f09 [rilmodem] Set the path for all ADN record readings
Core does not list EFpbr to it's EF list so we cannot trust
sim_ef_db_get_path_3g or sim_ef_db_get_path_2g to find the
correct path. In order to read the 2nd and later phonebook
records we have to define the path in rilmodem level.

Signed-off-by: Jussi Kangas <jussi.kangas@oss.tieto.com>
2014-03-13 13:19:31 +02:00
Alfonso Sanchez-Beato
73a794e9f6 [src] Fix EF_PNN access
EF_PNN was not being read properly, which affected the displayed PLMN
name for some MVNOs. Some modems already read the file and return the
right string: these do not show the problem.
2014-03-13 13:19:31 +02:00
Martti Piirainen
df0e72c780 Merge pull request #180 from monich/split_wsp_payload
[push-forwarder] Split WSP payload
2014-03-13 13:19:30 +02:00
Jarko Poutiainen
7cdaa7cd13 Merge pull request #185 from marttipiirainen/next
Make libwspcodec dependency conditional
2014-03-13 13:19:30 +02:00
Slava Monich
558a6639d6 [push-forwarder] Split WSP payload
Instead of sending the whole WSP datagram to the handler we now send
content type string and WSP payload data. This way push handler won't
have to parse WSP headers just to extract the payload.
2014-03-13 13:19:30 +02:00
Jarko Poutiainen
5f2e8e24f0 Merge pull request #182 from jkangas/next
Request for pulling tech pref config possibility based on mobile country code to next branch
2014-03-13 13:19:30 +02:00
Martti Piirainen
31f85495dc [configure] Make libwspcodec dependency conditional
Signed-off-by: Martti Piirainen <martti.piirainen@oss.tieto.com>
2014-03-13 13:19:30 +02:00
Tommi Kenakkala
689d7358ba Merge pull request #183 from marttipiirainen/next
Make the push-forwarder plugin configurable
2014-03-13 13:19:30 +02:00
Jussi Kangas
b3ca644f1d [rilmodem] Mobile country code configuration
Enable limiting radio technology based on mobile country code found
from ICC.

Signed-off-by: Jussi Kangas <jussi.kangas@oss.tieto.com>
2014-03-13 13:19:30 +02:00
Martti Piirainen
1e811dd49a [configure] Make the push-forwarder plugin configurable
Signed-off-by: Martti Piirainen <martti.piirainen@oss.tieto.com>
2014-03-13 13:19:30 +02:00
Tommi Kenakkala
9a520a7825 Merge pull request #179 from ptakalok/mosms
[rilmodem] Refine SMS sending response value handling
2014-03-13 13:19:29 +02:00
Tommi Kenakkala
2f51bc9e62 Merge pull request #178 from marttipiirainen/next
[gril] Fix 'unused variable' compiler warning
2014-03-13 13:19:29 +02:00
Petri Takalokastari
d8dd65b579 [rilmodem] Refine SMS sending response value handling
By this change, the SMS is resent only  in cases it is worth of retrying.

Signed-off-by: Petri Takalokastari <petri.takalokastari@oss.tieto.com>
2014-03-13 13:19:29 +02:00
Martti Piirainen
1e139cb4c6 Merge pull request #177 from monich/create-push-forwarder-d
Create /etc/ofono/push_forwarder.d directory
2014-03-13 13:19:29 +02:00
Martti Piirainen
68c0a9f164 [gril] Fix 'unused variable' compiler warning
Signed-off-by: Martti Piirainen <martti.piirainen@oss.tieto.com>
2014-03-13 13:19:29 +02:00
Slava Monich
dfe0f280de Create /etc/ofono/push_forwarder.d directory 2014-03-13 13:19:20 +02:00
Tommi Kenakkala
5a54a71fd8 Merge pull request #171 from monich/push-forwarder-next
Push forwarder plugin
2014-03-13 13:18:27 +02:00
Tommi Kenakkala
0f39bdc9c3 Merge pull request #169 from monich/create-mms-context-after-upgrade
Create and provision MMS context if it doesn't exist
2014-03-13 13:18:27 +02:00
Slava Monich
24e8514c55 Push forwarder plugin 2014-03-13 13:18:27 +02:00
Tommi Kenakkala
f1b689ed3c Merge pull request #176 from ptakalok/language
[rilmodem] Set current UI system language to environment variable
2014-03-13 13:18:27 +02:00
Slava Monich
e5df37be4b [gprs] Create and provision MMS context if it doesn't exist
This is necessary to handle the upgrade scenario from an ofono version
that doesn't support MMS to the one that does.
2014-03-13 13:18:27 +02:00
Petri Takalokastari
a61a8cc183 [rilmodem] Set current UI system language to environment variable
Read current terminal UI language from configuration file and set it as
environment variable for provide local information proactive command.

Signed-off-by: Petri Takalokastari <petri.takalokastari@oss.tieto.com>
2014-03-13 13:18:27 +02:00
Martti Piirainen
e25b5b13f9 Merge pull request #166 from marttipiirainen/next
[build] Fix network time plugin build issues
2014-03-13 13:18:26 +02:00
Jussi Kangas
3f3375442d Merge pull request #170 from leinomii/next
Clean useless cast and improve handle_unsol_req readability
2014-03-13 13:18:26 +02:00
Jussi Kangas
782669b412 Merge pull request #164 from jkangas/next
Ensure that AP list has one INTERNET and one MMS access point
2014-03-13 13:18:26 +02:00
Martti Piirainen
5a401c8b50 [build] Fix network time plugin build issues
Link clock functions explicitly to the POSIX realtime library when using glibc version < 2.17 (otherwise, some compilation environments implicitly link libpthread, others fail). Also, there was a typo that broke the '--disable-nettime' configure option.

Signed-off-by: Martti Piirainen <martti.piirainen@oss.tieto.com>
2014-03-13 13:18:26 +02:00
Miia Leinonen
3ac41bc759 [gril] Clean useless cast and improve handle_unsol_req readability 2014-03-13 13:18:26 +02:00
Slava Monich
5af079bd03 Ensure that AP list has one INTERNET and one MMS access point
Also, minimized differences with upstream version of provision.c
2014-03-13 13:18:26 +02:00
Pekka Lundstrom
cf6278f5cc Merge pull request #181 from plundstr/master
Packaging fixes
2014-02-19 16:48:49 +02:00
Pekka Lundstrom
dd3b0c5aca No restart on update
Signed-off-by: Pekka Lundstrom <pekka.lundstrom@jollamobile.com>
2014-02-19 15:01:31 +02:00
Pekka Lundstrom
988a759e4c [packaking] Add fail safe to post scripts
Signed-off-by: Pekka Lundstrom <pekka.lundstrom@jollamobile.com>
2014-02-19 14:08:27 +02:00
Pekka Lundstrom
555585c17f [packaking] get rid off .yaml
Signed-off-by: Pekka Lundstrom <pekka.lundstrom@jollamobile.com>
2014-02-19 14:06:25 +02:00
Martti Piirainen
4b99034c3f Merge pull request #175 from ptakalok/subs_master
[rilmodem] Allow subscription of stk notifications only once
2014-02-13 08:10:08 +02:00
Petri Takalokastari
03e35b6757 [rilmodem] Allow subscription of stk notifications only once
Allow subscription of stk notifications only when simkit agent registers
for first time. This implementation fixes double subscription problems
which may happen if simkit agent has exited and restarts subscribing to
stk commands again.

Signed-off-by: Petri Takalokastari <petri.takalokastari@oss.tieto.com>
2014-02-11 11:00:01 +02:00
Pekka Lundstrom
b36fdce803 Merge pull request #173 from plundstr/master
[init] Added boot-time requirement to be started after dbus service
2014-02-10 18:06:38 +02:00
Pekka Lundstrom
34251bdba7 [init] Added boot-time requirement to be started after dbus service
Signed-off-by: Pekka Lundstrom <pekka.lundstrom@jollamobile.com>
2014-02-10 15:58:08 +02:00
Martti Piirainen
530c66393a Merge pull request #168 from jkangas/master
Request for pulling EFECC reading when READY to main branch
2014-02-06 14:29:37 +02:00
Jussi Kangas
10c823d732 [voicecall] Read the EFECC also if SIM goes straigth to READY
It is possible that ofono starts so that SIM is already in
in READY state when voicecall gets the information. In that case
without this fix core never asks the emergency numbers

Signed-off-by: Jussi Kangas <jussi.kangas@oss.tieto.com>
2014-02-06 13:51:02 +02:00
27 changed files with 929 additions and 266 deletions

View File

@@ -549,6 +549,13 @@ builtin_sources += plugins/smart-messaging.c
builtin_modules += push_notification
builtin_sources += plugins/push-notification.c
if PUSHFORWARDER
builtin_modules += push_forwarder
builtin_sources += plugins/push-forwarder.c
builtin_cflags += @WSPCODEC_CFLAGS@
builtin_libadd += @WSPCODEC_LIBS@
endif
builtin_modules += sms_history
builtin_sources += plugins/smshistory.c

View File

@@ -192,7 +192,10 @@ AM_CONDITIONAL(BLUETOOTH, test "${enable_bluetooth}" != "no")
AC_ARG_ENABLE(nettime, AC_HELP_STRING([--disable-nettime],
[disable Nettime plugin]),
[enable_nettime=${enableval}])
AM_CONDITIONAL(NETTIME, test "${enable_netttime}" != "no")
if (test "${enable_nettime}" != "no"); then
AC_SEARCH_LIBS([clock_gettime], [rt])
fi
AM_CONDITIONAL(NETTIME, test "${enable_nettime}" != "no")
AC_ARG_WITH([provisiondb], AC_HELP_STRING([--with-provisiondb=FILE],
[location of provision database]), [path_provisiondb=${withval}])
@@ -223,6 +226,17 @@ AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
[enable_datafiles=${enableval}])
AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
AC_ARG_ENABLE(pushforwarder, AC_HELP_STRING([--disable-pushforwarder],
[disable Push Forwarder plugin]),
[enable_pushforwarder=${enableval}])
AM_CONDITIONAL(PUSHFORWARDER, test "${enable_pushforwarder}" != "no")
if (test "${enable_pushforwarder}" != "no"); then
PKG_CHECK_MODULES(WSPCODEC, libwspcodec >= 2.0, dummy=yes,
AC_MSG_ERROR(WSP decoder is required))
AC_SUBST(WSPCODEC_CFLAGS)
AC_SUBST(WSPCODEC_LIBS)
fi
if (test "${prefix}" = "NONE"); then
dnl no prefix and no localstatedir, so default to /var
if (test "$localstatedir" = '${prefix}/var'); then

View File

@@ -3,7 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
* Copyright (C) 2013 Jolla Ltd
* Copyright (C) 2013-2014 Jolla Ltd
* Contact: Jussi Kangas <jussi.kangas@tieto.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -94,11 +94,10 @@ static void ril_registration(struct ofono_call_forwarding *cf, int type,
* or settings made with bearer class
* BEARER_CLASS_DEFAULT. Design decision: If given
* class is BEARER_CLASS_DEFAULT let's map it to
* SERVICE_CLASS_NONE as with it e.g. ./send-ussd '*21*<phone_number>#'
* returns cls:53 i.e. 1+4+16+32 as service class.
* BEARER_CLASS_VOICE as per RIL design.
*/
if (cls == BEARER_CLASS_DEFAULT)
cls = SERVICE_CLASS_NONE;
cls = BEARER_CLASS_VOICE;
parcel_w_int32(&rilp, cls);
@@ -140,11 +139,10 @@ static void ril_send_forward_cmd(struct ofono_call_forwarding *cf,
* or settings made with bearer class
* BEARER_CLASS_DEFAULT. Design decision: If given
* class is BEARER_CLASS_DEFAULT let's map it to
* SERVICE_CLASS_NONE as with it e.g. ./send-ussd '*21*<phone_number>#'
* returns cls:53 i.e. 1+4+16+32 as service class.
* BEARER_CLASS_VOICE as per RIL design.
*/
if (cls == BEARER_CLASS_DEFAULT)
cls = SERVICE_CLASS_NONE;
cls = BEARER_CLASS_VOICE;
parcel_w_int32(&rilp, cls); /* Service class */
@@ -273,8 +271,7 @@ static void ril_query(struct ofono_call_forwarding *cf, int type, int cls,
* or settings made with bearer class
* BEARER_CLASS_DEFAULT. Design decision: If given
* class is BEARER_CLASS_DEFAULT let's map it to
* SERVICE_CLASS_NONE as with it e.g. ./send-ussd '*21*<phone_number>#'
* returns cls:53 i.e. 1+4+16+32 as service class.
* SERVICE_CLASS_NONE as per RIL design.
*/
if (cls == BEARER_CLASS_DEFAULT)
cls = SERVICE_CLASS_NONE;

View File

@@ -1107,15 +1107,27 @@ static void pb_reference_data_cb(const struct ofono_error *error,
pbd->pb_reference_file_info.record_length)) {
pbd->pb_reference_file_info.record++;
DBG("Next EFpbr record %d", pbd->pb_reference_file_info.record);
pbd->sim_driver->read_file_linear(get_sim(),
pbd->pb_reference_file_info.
file_id,
pbd->pb_reference_file_info.
record,
pbd->pb_reference_file_info.
record_length,
NULL, 0,
pb_reference_data_cb, cbd);
if (RIL_APPTYPE_SIM == ril_get_app_type()) {
pbd->sim_driver->read_file_linear(get_sim(),
pbd->pb_reference_file_info.
file_id,
pbd->pb_reference_file_info.
record,
pbd->pb_reference_file_info.
record_length,
sim_path, sizeof(sim_path),
pb_reference_data_cb, cbd);
} else {
pbd->sim_driver->read_file_linear(get_sim(),
pbd->pb_reference_file_info.
file_id,
pbd->pb_reference_file_info.
record,
pbd->pb_reference_file_info.
record_length,
usim_path, sizeof(usim_path),
pb_reference_data_cb, cbd);
}
} else {
struct pb_file_info *file_info;
DBG("All EFpbr records read");

View File

@@ -35,6 +35,7 @@
#include <ofono/log.h>
#include <ofono/modem.h>
#include <ofono/radio-settings.h>
#include <ofono/sim.h>
#include "gril.h"
#include "grilutil.h"
@@ -200,11 +201,18 @@ static gboolean ril_get_net_config(struct radio_data *rsd)
{
GKeyFile *keyfile;
GError *err = NULL;
char *path = RIL_CONFIG;
char *config_path = RIL_CONFIG_DIR;
char **alreadyset = NULL;
gboolean needsconfig = FALSE;
gboolean value = FALSE;
gboolean found = FALSE;
rsd->ratmode = PREF_NET_TYPE_GSM_WCDMA_AUTO;
GDir *config_dir;
const gchar *config_file;
char *path;
gsize length;
gchar **codes = NULL;
int i;
/*
* First we need to check should the LTE be on
@@ -215,12 +223,38 @@ static gboolean ril_get_net_config(struct radio_data *rsd)
g_key_file_set_list_separator(keyfile, ',');
if (g_key_file_load_from_file(keyfile, path, 0, &err)) {
config_dir = g_dir_open(config_path, 0, NULL);
while ((config_file = g_dir_read_name(config_dir)) != NULL) {
path = g_strconcat(RIL_CONFIG_DIR "/", config_file, NULL);
if (!g_key_file_load_from_file(keyfile, path, 0, &err)) {
g_error_free(err);
needsconfig = TRUE;
continue;
}
if (g_key_file_has_group(keyfile, LTE_FLAG))
found = TRUE;
else if (g_key_file_has_group(keyfile, MCC_LIST)) {
codes = g_key_file_get_string_list(keyfile, MCC_LIST,
MCC_KEY, &length, NULL);
if (codes) {
for (i = 0; codes[i]; i++) {
if (g_str_equal(codes[i],
ofono_sim_get_mcc(get_sim()))
== TRUE) {
found = TRUE;
break;
}
}
g_strfreev(codes);
}
}
if (found) {
rsd->ratmode = PREF_NET_TYPE_LTE_GSM_WCDMA;
} else {
g_error_free(err);
needsconfig = TRUE;
break;
}
}
g_key_file_free(keyfile);

View File

@@ -28,9 +28,14 @@
/* Shared constants */
#define EF_STATUS_INVALIDATED 0
#define EF_STATUS_VALID 1
#define RIL_CONFIG "/etc/ofono/ril_subscription.conf"
#define RIL_HW_CONFIG "/etc/ofono/ril_subscription.conf"
#define RIL_CONFIG_DIR "/etc/ofono/"
#define RIL_STORE "rilmodem"
#define LTE_FLAG "4gOn"
#define MCC_LIST "MCC-whitelist"
#define MCC_KEY "Countries"
#define UI_LANG "/var/lib/environment/nemo/locale.conf"
#define CFG_LANG "LANG="
extern void ril_devinfo_init(void);
extern void ril_devinfo_exit(void);

View File

@@ -402,13 +402,25 @@ gboolean ril_util_parse_sim_status(GRil *gril,
apps[i]->app_type = parcel_r_int32(&rilp);
apps[i]->app_state = parcel_r_int32(&rilp);
/*
* Consider RIL_APPSTATE_ILLEGAL also READY. Even if app state
* is RIL_APPSTATE_ILLEGAL (-1), ICC operations must be
* permitted. Network access requests will anyway be rejected
* and ME will be in limited service.
*/
if (apps[i]->app_state == RIL_APPSTATE_ILLEGAL) {
DBG("RIL_APPSTATE_ILLEGAL => RIL_APPSTATE_READY");
apps[i]->app_state = RIL_APPSTATE_READY;
}
apps[i]->perso_substate = parcel_r_int32(&rilp);
/* TODO: we need a way to instruct parcel to skip
* a string, without allocating memory...
*/
apps[i]->aid_str = parcel_r_string(&rilp); /* application ID (AID) */
apps[i]->app_str = parcel_r_string(&rilp); /* application label */
apps[i]->aid_str = parcel_r_string(&rilp); /* app ID (AID) */
apps[i]->app_str = parcel_r_string(&rilp); /* app label */
apps[i]->pin_replaced = parcel_r_int32(&rilp);
apps[i]->pin1_state = parcel_r_int32(&rilp);
@@ -459,7 +471,8 @@ gboolean ril_util_parse_reg(GRil *gril,
* >= 4 for VOICE_REG reply
* >= 5 for DATA_REG reply
*/
if ((tmp = parcel_r_int32(&rilp)) < 4) {
tmp = parcel_r_int32(&rilp);
if (tmp < 4) {
DBG("Size of response array is too small: %d", tmp);
goto error;
}
@@ -482,10 +495,12 @@ gboolean ril_util_parse_reg(GRil *gril,
* voice & data response.
*/
if (tmp--) {
sreason = parcel_r_string(&rilp); /* TODO: different use for CDMA */
/* TODO: different use for CDMA */
sreason = parcel_r_string(&rilp);
if (tmp--) {
smax = parcel_r_string(&rilp); /* TODO: different use for CDMA */
/* TODO: different use for CDMA */
smax = parcel_r_string(&rilp);
if (smax && max_calls)
*max_calls = atoi(smax);
@@ -518,7 +533,7 @@ gboolean ril_util_parse_reg(GRil *gril,
if (tech) {
if (stech) {
switch(atoi(stech)) {
switch (atoi(stech)) {
case RADIO_TECH_UNKNOWN:
*tech = -1;
break;
@@ -659,7 +674,8 @@ gint ril_util_get_signal(GRil *gril, struct ril_msg *message)
return -1;
}
void ril_util_free_sim_apps(struct sim_app **apps, guint num_apps) {
void ril_util_free_sim_apps(struct sim_app **apps, guint num_apps)
{
guint i;
for (i = 0; i < num_apps; i++) {

View File

@@ -62,29 +62,6 @@ enum at_util_charset {
RIL_UTIL_CHARSET_8859_H = 0x10000,
};
/* TODO: consider moving these to ril_constants.h */
enum app_state {
APPSTATE_UNKNOWN,
APPSTATE_DETECTED,
APPSTATE_PIN,
APPSTATE_PUK,
APPSTATE_SUBSCRIPTION_PERSO,
APPSTATE_READY,
};
enum perso_state {
PERSOSUBSTATE_SIM_NETWORK = 3,
PERSOSUBSTATE_SIM_NETWORK_SUBSET,
PERSOSUBSTATE_SIM_CORPORATE,
PERSOSUBSTATE_SIM_SERVICE_PROVIDER,
PERSOSUBSTATE_SIM_SIM,
PERSOSUBSTATE_SIM_NETWORK_PUK,
PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK,
PERSOSUBSTATE_SIM_CORPORATE_PUK,
PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK,
PERSOSUBSTATE_SIM_SIM_PUK,
};
#define MAX_UICC_APPS 16
struct sim_status {
@@ -193,7 +170,7 @@ static inline int ril_util_convert_signal_strength(int strength)
return result;
}
#define DECLARE_FAILURE(e) \
#define DECLARE_FAILURE(e) \
struct ofono_error e; \
e.type = OFONO_ERROR_TYPE_FAILURE; \
e.error = 0 \

View File

@@ -556,42 +556,42 @@ static void configure_active_app(struct sim_data *sd,
DBG("setting aid_str (AID) to: %s", sd->aid_str);
switch (app->app_state) {
case APPSTATE_PIN:
case RIL_APPSTATE_PIN:
sd->passwd_state = OFONO_SIM_PASSWORD_SIM_PIN;
break;
case APPSTATE_PUK:
case RIL_APPSTATE_PUK:
sd->passwd_state = OFONO_SIM_PASSWORD_SIM_PUK;
break;
case APPSTATE_SUBSCRIPTION_PERSO:
case RIL_APPSTATE_SUBSCRIPTION_PERSO:
switch (app->perso_substate) {
case PERSOSUBSTATE_SIM_NETWORK:
case RIL_PERSOSUBSTATE_SIM_NETWORK:
sd->passwd_state = OFONO_SIM_PASSWORD_PHNET_PIN;
break;
case PERSOSUBSTATE_SIM_NETWORK_SUBSET:
case RIL_PERSOSUBSTATE_SIM_NETWORK_SUBSET:
sd->passwd_state = OFONO_SIM_PASSWORD_PHNETSUB_PIN;
break;
case PERSOSUBSTATE_SIM_CORPORATE:
case RIL_PERSOSUBSTATE_SIM_CORPORATE:
sd->passwd_state = OFONO_SIM_PASSWORD_PHCORP_PIN;
break;
case PERSOSUBSTATE_SIM_SERVICE_PROVIDER:
case RIL_PERSOSUBSTATE_SIM_SERVICE_PROVIDER:
sd->passwd_state = OFONO_SIM_PASSWORD_PHSP_PIN;
break;
case PERSOSUBSTATE_SIM_SIM:
case RIL_PERSOSUBSTATE_SIM_SIM:
sd->passwd_state = OFONO_SIM_PASSWORD_PHSIM_PIN;
break;
case PERSOSUBSTATE_SIM_NETWORK_PUK:
case RIL_PERSOSUBSTATE_SIM_NETWORK_PUK:
sd->passwd_state = OFONO_SIM_PASSWORD_PHNET_PUK;
break;
case PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK:
case RIL_PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK:
sd->passwd_state = OFONO_SIM_PASSWORD_PHNETSUB_PUK;
break;
case PERSOSUBSTATE_SIM_CORPORATE_PUK:
case RIL_PERSOSUBSTATE_SIM_CORPORATE_PUK:
sd->passwd_state = OFONO_SIM_PASSWORD_PHCORP_PUK;
break;
case PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK:
case RIL_PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK:
sd->passwd_state = OFONO_SIM_PASSWORD_PHSP_PUK;
break;
case PERSOSUBSTATE_SIM_SIM_PUK:
case RIL_PERSOSUBSTATE_SIM_SIM_PUK:
sd->passwd_state = OFONO_SIM_PASSWORD_PHFSIM_PUK;
break;
default:
@@ -599,11 +599,11 @@ static void configure_active_app(struct sim_data *sd,
break;
};
break;
case APPSTATE_READY:
case RIL_APPSTATE_READY:
sd->passwd_state = OFONO_SIM_PASSWORD_NONE;
break;
case APPSTATE_UNKNOWN:
case APPSTATE_DETECTED:
case RIL_APPSTATE_UNKNOWN:
case RIL_APPSTATE_DETECTED:
default:
sd->passwd_state = OFONO_SIM_PASSWORD_INVALID;
break;

View File

@@ -168,10 +168,14 @@ static void submit_sms_cb(struct ril_msg *message, gpointer user_data)
int mr;
if (message->error == RIL_E_SUCCESS) {
ofono_info("sms sending succesful");
ofono_info("sms sending successful");
decode_ril_error(&error, "OK");
} else if (message->error == RIL_E_GENERIC_FAILURE) {
ofono_info("not allowed by MO SMS control, do not retry");
error.type = OFONO_ERROR_TYPE_CMS;
error.error = 500;
} else {
ofono_error("sms sending failed");
ofono_error("sms sending failed, retry");
decode_ril_error(&error, "FAIL");
}

View File

@@ -46,6 +46,8 @@ struct stk_data {
GRil *ril;
};
gboolean subscribed;
static void ril_envelope_cb(struct ril_msg *message, gpointer user_data)
{
struct cb_data *cbd = user_data;
@@ -236,15 +238,18 @@ static void ril_stk_agent_ready(struct ofono_stk *stk)
DBG("");
/* register for unsol's only if agent has registered */
g_ril_register(sd->ril, RIL_UNSOL_STK_PROACTIVE_COMMAND,
ril_stk_pcmd_notify, stk);
if (!subscribed) {
DBG("Subscribing notifications");
g_ril_register(sd->ril, RIL_UNSOL_STK_PROACTIVE_COMMAND,
ril_stk_pcmd_notify, stk);
g_ril_register(sd->ril, RIL_UNSOL_STK_SESSION_END,
ril_stk_session_end_notify, stk);
g_ril_register(sd->ril, RIL_UNSOL_STK_SESSION_END,
ril_stk_session_end_notify, stk);
g_ril_register(sd->ril, RIL_UNSOL_STK_EVENT_NOTIFY,
ril_stk_event_notify, stk);
g_ril_register(sd->ril, RIL_UNSOL_STK_EVENT_NOTIFY,
ril_stk_event_notify, stk);
subscribed = TRUE;
}
/* fire and forget i.e. not waiting for the callback*/
ret = g_ril_send(sd->ril, request, NULL, 0,
@@ -253,6 +258,26 @@ static void ril_stk_agent_ready(struct ofono_stk *stk)
g_ril_print_request_no_args(sd->ril, ret, request);
}
void ril_stk_set_lang()
{
gchar *contents;
GError *err = NULL;
if (!g_file_get_contents(UI_LANG, &contents, NULL, &err)) {
if (err)
ofono_error("cannot open %s error: %d: message: %s",
UI_LANG, err->code, err->message);
g_error_free(err);
} else {
gchar *pch = g_strrstr(contents, CFG_LANG);
/* Set System UI lang to env LANG */
if (pch) {
setenv("LANG", pch + strlen(CFG_LANG), 1);
DBG("LANG %s", getenv("LANG"));
}
}
}
static int ril_stk_probe(struct ofono_stk *stk, unsigned int vendor, void *data)
{
GRil *ril = data;
@@ -270,6 +295,11 @@ static int ril_stk_probe(struct ofono_stk *stk, unsigned int vendor, void *data)
/* Register interface in this phase for stk agent */
ofono_stk_register(stk);
subscribed = FALSE;
/* UI language for local info */
ril_stk_set_lang();
return 0;
}

View File

@@ -835,6 +835,9 @@ static gboolean can_write_data(gpointer data)
gsize len;
char *cr;
gboolean wakeup_first = FALSE;
#ifdef WRITE_SCHEDULER_DEBUG
int limiter;
#endif
/* Grab the first command off the queue and write as
* much of it as we can
@@ -886,13 +889,20 @@ static gboolean can_write_data(gpointer data)
towrite = cr - (cmd->cmd + chat->cmd_bytes_written) + 1;
#ifdef WRITE_SCHEDULER_DEBUG
if (towrite > 5)
towrite = 5;
limiter = towrite;
if (limiter > 5)
limiter = 5;
#endif
bytes_written = g_at_io_write(chat->io,
cmd->cmd + chat->cmd_bytes_written,
towrite);
#ifdef WRITE_SCHEDULER_DEBUG
limiter
#else
towrite
#endif
);
if (bytes_written == 0)
return FALSE;

View File

@@ -355,7 +355,8 @@ static void handle_response(struct ril_s *p, struct ril_msg *message)
int i;
guint len, id;
g_assert(count > 0);
if (!count)
return;
for (i = 0; i < count; i++) {
req = g_queue_peek_nth(p->command_queue, i);
@@ -373,13 +374,13 @@ static void handle_response(struct ril_s *p, struct ril_msg *message)
message->error));
req = g_queue_pop_nth(p->command_queue, i);
if (req->callback) {
if (req->callback)
req->callback(message, req->user_data);
}
len = g_queue_get_length(p->out_queue);
for (i = 0; i < len; i++) {
id = *(guint *) g_queue_peek_nth(p->out_queue, i);
id = *(guint *) g_queue_peek_nth(
p->out_queue, i);
if (id == req->id) {
g_queue_pop_nth(p->out_queue, i);
break;
@@ -403,14 +404,21 @@ static void handle_response(struct ril_s *p, struct ril_msg *message)
}
static void notify_call_callback(gpointer data, gpointer user_data)
{
struct ril_notify_node *node = data;
struct ril_msg *message = user_data;
node->callback(message, node->user_data);
}
static void handle_unsol_req(struct ril_s *p, struct ril_msg *message)
{
GHashTableIter iter;
struct ril_notify *notify;
int req_key;
gpointer key, value;
GList *list_item;
struct ril_notify_node *node;
GSList *list_item;
gboolean found = FALSE;
if (p->notify_list == NULL)
@@ -430,15 +438,12 @@ static void handle_unsol_req(struct ril_s *p, struct ril_msg *message)
if (req_key != message->req)
continue;
list_item = (GList *) notify->nodes;
list_item = notify->nodes;
while (list_item != NULL) {
node = list_item->data;
node->callback(message, node->user_data);
if (list_item)
found = TRUE;
list_item = (GList *) g_slist_next(list_item);
}
g_slist_foreach(notify->nodes, notify_call_callback, message);
}
/* Only log events not being listended for... */
@@ -582,9 +587,8 @@ static void new_bytes(struct ring_buffer *rbuf, gpointer user_data)
while (p->suspended == FALSE && (p->read_so_far < len)) {
gsize rbytes = MIN(len - p->read_so_far, wrap - p->read_so_far);
if (rbytes < 4) {
if (rbytes < 4)
return;
}
/* this function attempts to read the next full length
* fixed message from the stream. if not all bytes are
@@ -595,9 +599,8 @@ static void new_bytes(struct ring_buffer *rbuf, gpointer user_data)
message = read_fixed_record(p, buf, &rbytes);
/* wait for the rest of the record... */
if (message == NULL) {
if (message == NULL)
break;
}
buf += rbytes;
p->read_so_far += rbytes;
@@ -642,7 +645,8 @@ static gboolean can_write_data(gpointer data)
for (i = 0; i < qlen; i++) {
req = g_queue_peek_nth(ril->command_queue, i);
if (req) {
id = *(guint *) g_queue_peek_head(ril->out_queue);
id = *(guint *) g_queue_peek_head(
ril->out_queue);
if (req->id == id)
goto out;
} else {

View File

@@ -191,6 +191,7 @@
#define RIL_PERSOSUBSTATE_RUIM_RUIM_PUK 24
/* SIM - App states */
#define RIL_APPSTATE_ILLEGAL -1
#define RIL_APPSTATE_UNKNOWN 0
#define RIL_APPSTATE_DETECTED 1
#define RIL_APPSTATE_PIN 2

View File

@@ -80,29 +80,29 @@ extern "C" {
DBusConnection *ofono_dbus_get_connection(void);
void ofono_dbus_dict_append(DBusMessageIter *dict, const char *key, int type,
void *value);
const void *value);
void ofono_dbus_dict_append_array(DBusMessageIter *dict, const char *key,
int type, void *val);
int type, const void *val);
void ofono_dbus_dict_append_dict(DBusMessageIter *dict, const char *key,
int type, void *val);
int type, const void *val);
int ofono_dbus_signal_property_changed(DBusConnection *conn, const char *path,
const char *interface, const char *name,
int type, void *value);
int type, const void *value);
int ofono_dbus_signal_array_property_changed(DBusConnection *conn,
const char *path,
const char *interface,
const char *name, int type,
void *value);
const void *value);
int ofono_dbus_signal_dict_property_changed(DBusConnection *conn,
const char *path,
const char *interface,
const char *name, int type,
void *value);
const void *value);
#ifdef __cplusplus
}

View File

@@ -190,7 +190,9 @@ static void apn_end(GMarkupParseContext *context, const gchar *element_name,
{
if (g_str_equal(element_name, "name") ||
g_str_equal(element_name, "username") ||
g_str_equal(element_name, "password"))
g_str_equal(element_name, "password") ||
g_str_equal(element_name, "mmsc") ||
g_str_equal(element_name, "mmsproxy"))
g_markup_parse_context_pop(context);
}

View File

@@ -38,6 +38,54 @@
#include "mbpi.h"
/* Returns the list containing exactly one INTERNET and one MMS access point */
static GSList *provision_normalize_apn_list(GSList *apns)
{
struct ofono_gprs_provision_data *internet = NULL;
struct ofono_gprs_provision_data *mms = NULL;
GSList *l = apns;
while (l != NULL) {
GSList *next = l->next;
struct ofono_gprs_provision_data *ap = l->data;
if (ap->type == OFONO_GPRS_CONTEXT_TYPE_INTERNET && !internet) {
internet = ap;
} else if (ap->type == OFONO_GPRS_CONTEXT_TYPE_MMS && !mms) {
mms = ap;
} else {
/* Remove duplicate and unnecessary access points */
DBG("Discarding APN: '%s' Name: '%s' Type: %s",
ap->apn, ap->name, mbpi_ap_type(ap->type));
mbpi_ap_free(ap);
apns = g_slist_remove_link(apns, l);
}
l = next;
}
if (!internet) {
internet = g_try_new0(struct ofono_gprs_provision_data, 1);
if (internet) {
internet->type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
internet->name = g_strdup("Internet");
internet->apn = g_strdup("internet");
apns = g_slist_append(apns, internet);
}
}
if (!mms) {
mms = g_try_new0(struct ofono_gprs_provision_data, 1);
if (mms) {
mms->type = OFONO_GPRS_CONTEXT_TYPE_MMS;
mms->name = g_strdup("MMS");
mms->apn = g_strdup("mms");
apns = g_slist_append(apns, mms);
}
}
return apns;
}
static int provision_get_settings(const char *mcc, const char *mnc,
const char *spn,
struct ofono_gprs_provision_data **settings,
@@ -52,33 +100,22 @@ static int provision_get_settings(const char *mcc, const char *mnc,
DBG("Provisioning for MCC %s, MNC %s, SPN '%s'", mcc, mnc, spn);
/*
* TODO: review with upstream. Default behavior was to
* disallow duplicate APN entries, which unfortunately exist
* in the mobile-broadband-provider-info db.
* Passing FALSE to mbpi_lookup_apn() would return
* an empty list if duplicates are found.
*/
apns = mbpi_lookup_apn(mcc, mnc, TRUE, &error);
if (apns == NULL) {
if (error != NULL) {
ofono_error("%s", error->message);
g_error_free(error);
}
return -ENOENT;
if (error != NULL) {
ofono_error("%s", error->message);
g_error_free(error);
}
apns = provision_normalize_apn_list(apns);
if (apns == NULL)
return -ENOENT;
ap_count = g_slist_length(apns);
ofono_info("GPRS Provisioning found %d matching APNs for SPN: %s MCC: %s MNC: %s",
ap_count, spn, mcc, mnc);
/*
* Only keep the first APN found.
*
* This allows auto-provisioning to work most of the time vs.
* passing FALSE to mbpi_lookup_apn() which would return an
* an empty list if duplicates are found.
*/
if (ap_count > 1)
ap_count = 1;
DBG("Found %d APs", ap_count);
*settings = g_try_new0(struct ofono_gprs_provision_data, ap_count);
if (*settings == NULL) {
@@ -97,25 +134,16 @@ static int provision_get_settings(const char *mcc, const char *mnc,
for (l = apns, i = 0; l; l = l->next, i++) {
struct ofono_gprs_provision_data *ap = l->data;
/*
* Only create a data context for the first matching APN.
* See comment above that restricts restricts apn_count.
*/
if (i == 0) {
ofono_info("Name: '%s'", ap->name);
ofono_info("APN: '%s'", ap->apn);
ofono_info("Type: %s", mbpi_ap_type(ap->type));
ofono_info("Username: '%s'", ap->username);
ofono_info("Password: '%s'", ap->password);
DBG("Name: '%s'", ap->name);
DBG("APN: '%s'", ap->apn);
DBG("Type: %s", mbpi_ap_type(ap->type));
DBG("Username: '%s'", ap->username);
DBG("Password: '%s'", ap->password);
memcpy(*settings + i, ap,
sizeof(struct ofono_gprs_provision_data));
g_free(ap);
} else {
mbpi_ap_free(ap);
}
memcpy(*settings + i, ap,
sizeof(struct ofono_gprs_provision_data));
g_free(ap);
}
g_slist_free(apns);

View File

@@ -0,0 +1,537 @@
/*
* Copyright (C) 2013-2014 Jolla Ltd.
*
* 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.
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/inotify.h>
#include <wspcodec.h>
#define OFONO_API_SUBJECT_TO_CHANGE
#include <ofono.h>
#include <plugin.h>
/*
* Push forwarder plugin is looking for configuration files in
* /etc/ofono/push_forwarder.d directory. Confiration files are
* glib key files that look like this:
*
* [Jolla MMS Handler]
* ContentType = application/vnd.wap.mms-message
* Interface = com.jolla.MmsEngine.
* Service = com.jolla.MmsEngine
* Method = HandlePush
* Path = /
*
* Only files with .conf suffix are loaded. In addition to the keys
* from the above example, SourcePort and DestinationPort port keys
* are supported. All other keys are ignored. One file may describe
* several push handlers. See pf_parse_config() function for details.
*
* When push fowarder receives a WAP push, it goes through the list
* of registered handlers and invokes all of them that match content
* type and/or port numbers. The rest is up to the D-Bus service
* handling the call.
*/
#define PF_CONFIG_DIR CONFIGDIR "/push_forwarder.d"
struct pf_modem {
struct ofono_modem *modem;
struct ofono_sms *sms;
struct ofono_sim *sim;
unsigned int sim_watch_id;
unsigned int sms_watch_id;
unsigned int push_watch_id;
};
struct push_datagram_handler {
char *name;
char *content_type;
char *interface;
char *service;
char *method;
char *path;
int dst_port;
int src_port;
};
static GSList *handlers;
static GSList *modems;
static unsigned int modem_watch_id;
static int inotify_fd = -1;
static int inotify_watch_id = -1;
static guint inotify_watch_source_id;
static GIOChannel *inotify_watch_channel;
static void pf_notify_handler(struct push_datagram_handler *h,
const char *imsi, const char *from, const struct tm *remote,
const struct tm *local, int dst, int src,
const char *ct, const void *data, unsigned int len)
{
struct tm remote_tm = *remote;
struct tm local_tm = *local;
dbus_uint32_t remote_time_arg = mktime(&remote_tm);
dbus_uint32_t local_time_arg = mktime(&local_tm);
dbus_int32_t dst_arg = dst;
dbus_int32_t src_arg = src;
DBusMessageIter iter, array;
DBusMessage *msg = dbus_message_new_method_call(h->service,
h->path, h->interface, h->method);
dbus_message_append_args(msg,
DBUS_TYPE_STRING, &imsi,
DBUS_TYPE_STRING, &from,
DBUS_TYPE_UINT32, &remote_time_arg,
DBUS_TYPE_UINT32, &local_time_arg,
DBUS_TYPE_INT32, &dst_arg,
DBUS_TYPE_INT32, &src_arg,
DBUS_TYPE_STRING, &ct,
DBUS_TYPE_INVALID);
dbus_message_iter_init_append(msg, &iter);
dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
DBUS_TYPE_BYTE_AS_STRING, &array);
dbus_message_iter_append_fixed_array(&array,
DBUS_TYPE_BYTE, &data, len);
dbus_message_iter_close_container(&iter, &array);
dbus_message_set_no_reply(msg, TRUE);
dbus_connection_send(ofono_dbus_get_connection(), msg, NULL);
dbus_message_unref(msg);
}
static gboolean pf_match_port(int port, int expected_port)
{
if (expected_port < 0)
return TRUE;
if (expected_port == port)
return TRUE;
return FALSE;
}
static gboolean pf_match_handler(struct push_datagram_handler *h,
const char *ct, int dst, int src)
{
if (pf_match_port(dst, h->dst_port) == FALSE)
return FALSE;
if (pf_match_port(src, h->src_port) == FALSE)
return FALSE;
if (h->content_type == NULL)
return TRUE;
if (strcmp(h->content_type, ct) == 0)
return TRUE;
return FALSE;
}
static void pf_handle_datagram(const char *from,
const struct tm *remote, const struct tm *local, int dst,
int src, const unsigned char *buffer, unsigned int len,
void *userdata)
{
struct pf_modem *pm = userdata;
guint remain;
const guint8 *data;
unsigned int hdrlen;
unsigned int off;
const void *ct;
const char *imsi;
GSList *link;
DBG("received push of size: %u", len);
if (pm->sim == NULL)
return;
imsi = ofono_sim_get_imsi(pm->sim);
if (len < 3)
return;
if (buffer[1] != 6)
return;
remain = len - 2;
data = buffer + 2;
if (wsp_decode_uintvar(data, remain, &hdrlen, &off) == FALSE)
return;
if ((off + hdrlen) > remain)
return;
data += off;
remain -= off;
DBG(" WAP header %u bytes", hdrlen);
if (wsp_decode_content_type(data, hdrlen, &ct, &off, NULL) == FALSE)
return;
DBG(" content type %s", (char *)ct);
DBG(" imsi %s", imsi);
link = handlers;
while (link) {
struct push_datagram_handler *h = link->data;
if (pf_match_handler(h, ct, dst, src) != FALSE) {
DBG("notifying %s", h->name);
pf_notify_handler(h, imsi, from, remote, local, dst,
src, ct, data + hdrlen, len - hdrlen);
}
link = link->next;
}
}
static void pf_sms_watch(struct ofono_atom *atom,
enum ofono_atom_watch_condition cond, void *userdata)
{
struct pf_modem *pm = userdata;
if (cond == OFONO_ATOM_WATCH_CONDITION_REGISTERED) {
DBG("registered");
pm->sms = __ofono_atom_get_data(atom);
pm->push_watch_id = __ofono_sms_datagram_watch_add(pm->sms,
pf_handle_datagram, -1, -1, pm, NULL);
} else if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) {
DBG("unregistered");
pm->sms = NULL;
pm->push_watch_id = 0;
}
}
static void pf_sms_watch_done(void *userdata)
{
struct pf_modem *pm = userdata;
pm->sms_watch_id = 0;
}
static void pf_sim_watch(struct ofono_atom *atom,
enum ofono_atom_watch_condition cond, void *userdata)
{
struct pf_modem *pm = userdata;
if (cond == OFONO_ATOM_WATCH_CONDITION_REGISTERED) {
DBG("registered");
pm->sim = __ofono_atom_get_data(atom);
} else if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) {
DBG("unregistered");
pm->sim = NULL;
}
}
static void pf_sim_watch_done(void *userdata)
{
struct pf_modem *pm = userdata;
pm->sim_watch_id = 0;
}
static void pf_free_modem(struct pf_modem *pm)
{
if (pm == NULL)
return;
if (pm->push_watch_id != 0)
__ofono_sms_datagram_watch_remove(pm->sms, pm->push_watch_id);
if (pm->sim_watch_id != 0)
__ofono_modem_remove_atom_watch(pm->modem, pm->sim_watch_id);
if (pm->sms_watch_id != 0)
__ofono_modem_remove_atom_watch(pm->modem, pm->sms_watch_id);
g_free(pm);
}
static void pf_modem_watch(struct ofono_modem *modem,
gboolean added, void *userdata)
{
DBG("modem: %p, added: %d", modem, added);
if (added != FALSE) {
struct pf_modem *pm;
pm = g_try_new0(struct pf_modem, 1);
if (pm == NULL)
return;
pm->modem = modem;
pm->sim_watch_id = __ofono_modem_add_atom_watch(modem,
OFONO_ATOM_TYPE_SMS, pf_sms_watch, pm,
pf_sms_watch_done);
pm->sms_watch_id = __ofono_modem_add_atom_watch(modem,
OFONO_ATOM_TYPE_SIM, pf_sim_watch, pm,
pf_sim_watch_done);
modems = g_slist_append(modems, pm);
} else {
GSList *link = modems;
while (link) {
struct pf_modem *pm = link->data;
if (pm->modem == modem) {
modems = g_slist_delete_link(modems, link);
pf_free_modem(pm);
break;
}
link = link->next;
}
}
}
static void pf_modem_init(struct ofono_modem *modem,
void *userdata)
{
pf_modem_watch(modem, TRUE, NULL);
}
static void pf_free_handler(void *data)
{
struct push_datagram_handler *h = data;
g_free(h->content_type);
g_free(h->interface);
g_free(h->service);
g_free(h->method);
g_free(h->path);
g_free(h->name);
g_free(h);
}
static void pf_parse_handler(GKeyFile *conf, const char *g)
{
GError *err = NULL;
struct push_datagram_handler *h;
char *interface;
char *service;
char *method;
char *path;
interface = g_key_file_get_string(conf, g, "Interface", NULL);
if (interface == NULL)
goto no_interface;
service = g_key_file_get_string(conf, g, "Service", NULL);
if (service == NULL)
goto no_service;
method = g_key_file_get_string(conf, g, "Method", NULL);
if (method == NULL)
goto no_method;
path = g_key_file_get_string(conf, g, "Path", NULL);
if (path == NULL)
goto no_path;
h = g_try_new0(struct push_datagram_handler, 1);
if (h == NULL)
goto no_memory;
h->name = g_strdup(g);
h->interface = interface;
h->service = service;
h->method = method;
h->path = path;
h->content_type = g_key_file_get_string(conf, g, "ContentType", NULL);
h->dst_port = g_key_file_get_integer(conf, g, "DestinationPort", &err);
if (h->dst_port == 0 && err != NULL) {
h->dst_port = -1;
g_error_free(err);
err = NULL;
}
h->src_port = g_key_file_get_integer(conf, g, "SourcePort", &err);
if (h->src_port == 0 && err != NULL) {
h->src_port = -1;
g_error_free(err);
err = NULL;
}
DBG("registered %s", h->name);
if (h->content_type != NULL)
DBG(" ContentType: %s", h->content_type);
if (h->dst_port >= 0)
DBG(" DestinationPort: %d", h->dst_port);
if (h->src_port >= 0)
DBG(" SourcePort: %d", h->src_port);
DBG(" Interface: %s", interface);
DBG(" Service: %s", service);
DBG(" Method: %s", method);
DBG(" Path: %s", path);
handlers = g_slist_append(handlers, h);
return;
no_memory:
g_free(path);
no_path:
g_free(method);
no_method:
g_free(service);
no_service:
g_free(interface);
no_interface:
return;
}
static void pf_parse_config(void)
{
GDir *dir;
const gchar *file;
g_slist_free_full(handlers, pf_free_handler);
handlers = NULL;
dir = g_dir_open(PF_CONFIG_DIR, 0, NULL);
if (dir == NULL) {
DBG(PF_CONFIG_DIR " not found.");
return;
}
DBG("loading configuration from " PF_CONFIG_DIR);
while ((file = g_dir_read_name(dir)) != NULL) {
GError *err;
GKeyFile *conf;
char *path;
if (g_str_has_suffix(file, ".conf") == FALSE)
continue;
err = NULL;
conf = g_key_file_new();
path = g_strconcat(PF_CONFIG_DIR "/", file, NULL);
DBG("reading %s", file);
if (g_key_file_load_from_file(conf, path, 0, &err) != FALSE) {
gsize i, n;
char **names = g_key_file_get_groups(conf, &n);
for (i = 0; i < n; i++)
pf_parse_handler(conf, names[i]);
g_strfreev(names);
} else {
ofono_warn("%s", err->message);
g_error_free(err);
}
g_key_file_free(conf);
g_free(path);
}
g_dir_close(dir);
}
static gboolean pf_inotify(GIOChannel *gio, GIOCondition c, gpointer data)
{
int avail;
gsize len;
void *buf;
GError *error;
if (ioctl(inotify_fd, FIONREAD, &avail) < 0)
return FALSE;
buf = g_try_malloc(avail);
if (buf == NULL)
return FALSE;
error = NULL;
if (g_io_channel_read_chars(gio, buf, avail, &len, &error) !=
G_IO_STATUS_NORMAL) {
g_free(buf);
return FALSE;
}
pf_parse_config();
g_free(buf);
return TRUE;
}
static int pf_plugin_init(void)
{
DBG("");
pf_parse_config();
modem_watch_id = __ofono_modemwatch_add(pf_modem_watch, NULL, NULL);
__ofono_modem_foreach(pf_modem_init, NULL);
inotify_fd = inotify_init();
if (inotify_fd < 0)
return 0;
inotify_watch_id = inotify_add_watch(inotify_fd,
PF_CONFIG_DIR,
IN_CLOSE_WRITE | IN_DELETE | IN_MOVE);
if (inotify_watch_id < 0)
goto no_inotify_watch_id;
inotify_watch_channel = g_io_channel_unix_new(inotify_fd);
if (inotify_watch_channel == NULL)
goto no_inotify_watch_channel;
g_io_channel_set_encoding(inotify_watch_channel, NULL, NULL);
g_io_channel_set_buffered(inotify_watch_channel, FALSE);
inotify_watch_source_id = g_io_add_watch(inotify_watch_channel,
G_IO_IN, pf_inotify, NULL);
if (inotify_watch_source_id != 0)
return 0;
g_io_channel_unref(inotify_watch_channel);
inotify_watch_channel = NULL;
no_inotify_watch_channel:
inotify_rm_watch(inotify_fd, inotify_watch_id);
inotify_watch_id = -1;
no_inotify_watch_id:
close(inotify_fd);
inotify_fd = -1;
return 0;
}
static void pf_plugin_exit(void)
{
DBG("");
__ofono_modemwatch_remove(modem_watch_id);
modem_watch_id = 0;
g_slist_free_full(modems, (GDestroyNotify)pf_free_modem);
modems = NULL;
g_slist_free_full(handlers, pf_free_handler);
handlers = NULL;
if (inotify_watch_source_id == 0)
return;
g_source_remove(inotify_watch_source_id);
inotify_watch_source_id = 0;
g_io_channel_unref(inotify_watch_channel);
inotify_watch_channel = NULL;
inotify_rm_watch(inotify_fd, inotify_watch_id);
inotify_watch_id = -1;
close(inotify_fd);
inotify_fd = -1;
}
OFONO_PLUGIN_DEFINE(push_forwarder, "Push Forwarder Plugin", VERSION,
OFONO_PLUGIN_PRIORITY_DEFAULT, pf_plugin_init,
pf_plugin_exit)

View File

@@ -288,7 +288,6 @@ static void ril_post_online(struct ofono_modem *modem)
ofono_netreg_create(modem, 0, "rilmodem", ril->modem);
ofono_ussd_create(modem, 0, "rilmodem", ril->modem);
ofono_call_settings_create(modem, 0, "rilmodem", ril->modem);
ofono_cbs_create(modem, 0, "rilmodem", ril->modem);
ofono_oem_raw_create(modem, 0, "rilmodem", ril->modem);
}

View File

@@ -48,7 +48,7 @@ struct error_mapping_entry cme_errors_mapping[] = {
};
static void append_variant(DBusMessageIter *iter,
int type, void *value)
int type, const void *value)
{
char sig[2];
DBusMessageIter valueiter;
@@ -65,7 +65,7 @@ static void append_variant(DBusMessageIter *iter,
}
void ofono_dbus_dict_append(DBusMessageIter *dict,
const char *key, int type, void *value)
const char *key, int type, const void *value)
{
DBusMessageIter keyiter;
@@ -85,7 +85,8 @@ void ofono_dbus_dict_append(DBusMessageIter *dict,
dbus_message_iter_close_container(dict, &keyiter);
}
static void append_array_variant(DBusMessageIter *iter, int type, void *val)
static void append_array_variant(DBusMessageIter *iter, int type,
const void *val)
{
DBusMessageIter variant, array;
char typesig[2];
@@ -113,7 +114,7 @@ static void append_array_variant(DBusMessageIter *iter, int type, void *val)
}
void ofono_dbus_dict_append_array(DBusMessageIter *dict, const char *key,
int type, void *val)
int type, const void *val)
{
DBusMessageIter entry;
@@ -127,7 +128,8 @@ void ofono_dbus_dict_append_array(DBusMessageIter *dict, const char *key,
dbus_message_iter_close_container(dict, &entry);
}
static void append_dict_variant(DBusMessageIter *iter, int type, void *val)
static void append_dict_variant(DBusMessageIter *iter, int type,
const void *val)
{
DBusMessageIter variant, array, entry;
char typesig[5];
@@ -182,7 +184,7 @@ static void append_dict_variant(DBusMessageIter *iter, int type, void *val)
}
void ofono_dbus_dict_append_dict(DBusMessageIter *dict, const char *key,
int type, void *val)
int type, const void *val)
{
DBusMessageIter entry;
@@ -200,7 +202,7 @@ int ofono_dbus_signal_property_changed(DBusConnection *conn,
const char *path,
const char *interface,
const char *name,
int type, void *value)
int type, const void *value)
{
DBusMessage *signal;
DBusMessageIter iter;
@@ -225,7 +227,7 @@ int ofono_dbus_signal_array_property_changed(DBusConnection *conn,
const char *path,
const char *interface,
const char *name,
int type, void *value)
int type, const void *value)
{
DBusMessage *signal;
@@ -251,7 +253,7 @@ int ofono_dbus_signal_dict_property_changed(DBusConnection *conn,
const char *path,
const char *interface,
const char *name,
int type, void *value)
int type, const void *value)
{
DBusMessage *signal;

View File

@@ -3016,14 +3016,56 @@ static void ofono_gprs_finish_register(struct ofono_gprs *gprs)
__ofono_atom_register(gprs->atom, gprs_unregister);
}
static gboolean mms_context_configured(struct ofono_gprs *gprs)
{
GSList *l;
for (l = gprs->contexts; l; l = l->next) {
struct pri_context *ctx = l->data;
if (ctx->type == OFONO_GPRS_CONTEXT_TYPE_MMS)
return TRUE;
}
return FALSE;
}
static void provision_mms_context(struct ofono_gprs *gprs, const char *mcc,
const char *mnc, const char *spn)
{
struct ofono_gprs_provision_data *settings;
int count;
int i;
if (__ofono_gprs_provision_get_settings(mcc, mnc, spn,
&settings, &count) == FALSE) {
ofono_warn("Provisioning failed");
return;
}
for (i = 0; i < count; i++) {
if (settings[i].type == OFONO_GPRS_CONTEXT_TYPE_MMS) {
provision_context(&settings[i], gprs);
break;
}
}
__ofono_gprs_provision_free_settings(settings, count);
}
static void spn_read_cb(const char *spn, const char *dc, void *data)
{
struct ofono_gprs *gprs = data;
struct ofono_modem *modem = __ofono_atom_get_modem(gprs->atom);
struct ofono_sim *sim = __ofono_atom_find(OFONO_ATOM_TYPE_SIM, modem);
provision_contexts(gprs, ofono_sim_get_mcc(sim),
if (gprs->contexts == NULL) {
provision_contexts(gprs, ofono_sim_get_mcc(sim),
ofono_sim_get_mnc(sim), spn);
} else if (!mms_context_configured(gprs)) {
provision_mms_context(gprs, ofono_sim_get_mcc(sim),
ofono_sim_get_mnc(sim), spn);
}
ofono_sim_remove_spn_watch(sim, &gprs->spn_watch);
@@ -3040,7 +3082,7 @@ void ofono_gprs_register(struct ofono_gprs *gprs)
gprs_load_settings(gprs, ofono_sim_get_imsi(sim));
if (gprs->contexts)
if (mms_context_configured(gprs))
goto finish;
ofono_sim_add_spn_watch(sim, &gprs->spn_watch, spn_read_cb, gprs, NULL);

View File

@@ -2106,18 +2106,14 @@ void ofono_netreg_register(struct ofono_netreg *netreg)
ofono_sim_add_spn_watch(netreg->sim, &netreg->spn_watch,
spn_read_cb, netreg, NULL);
if (__ofono_sim_service_available(netreg->sim,
SIM_UST_SERVICE_PROVIDER_DISPLAY_INFO,
SIM_SST_SERVICE_PROVIDER_DISPLAY_INFO)) {
ofono_sim_read(netreg->sim_context, SIM_EFSPDI_FILEID,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
sim_spdi_read_cb, netreg);
ofono_sim_read(netreg->sim_context, SIM_EFSPDI_FILEID,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
sim_spdi_read_cb, netreg);
ofono_sim_add_file_watch(netreg->sim_context,
SIM_EFSPDI_FILEID,
sim_spdi_changed,
netreg, NULL);
}
ofono_sim_add_file_watch(netreg->sim_context,
SIM_EFSPDI_FILEID,
sim_spdi_changed,
netreg, NULL);
}
__ofono_atom_register(netreg->atom, netreg_unregister);

View File

@@ -1,6 +1,7 @@
[Unit]
Description=Telephony service
After=syslog.target
Requires=dbus.service
After=dbus.service
[Service]
Type=dbus

View File

@@ -767,12 +767,14 @@ static char *sim_network_name_parse(const unsigned char *buffer, int length,
gboolean *add_ci)
{
char *ret = NULL;
unsigned char *endp;
unsigned char dcs;
int i;
gboolean ci = FALSE;
unsigned char *unpacked_buf;
long num_char, written;
int spare_bits;
if (length < 1)
if (length < 2)
return NULL;
dcs = *buffer++;
@@ -787,11 +789,18 @@ static char *sim_network_name_parse(const unsigned char *buffer, int length,
switch (dcs & (7 << 4)) {
case 0x00:
endp = memchr(buffer, 0xff, length);
if (endp)
length = endp - buffer;
ret = convert_gsm_to_utf8(buffer, length,
NULL, NULL, 0xff);
spare_bits = dcs & 0x07;
num_char = (length * 8 - spare_bits) / 7;
unpacked_buf = unpack_7bit(buffer, length, 0, FALSE,
num_char, &written, 0);
if (unpacked_buf == NULL)
break;
ret = convert_gsm_to_utf8(unpacked_buf, written, NULL, NULL, 0);
g_free(unpacked_buf);
break;
case 0x10:
if ((length % 2) == 1) {

View File

@@ -2859,19 +2859,24 @@ static void read_sim_ecc_numbers(int id, void *userdata)
ecc_g3_read_cb, vc);
}
static void get_ecc_numbers(struct ofono_voicecall *vc)
{
if (vc->sim_context == NULL) {
vc->sim_context = ofono_sim_context_create(vc->sim);
ofono_sim_add_file_watch(vc->sim_context, SIM_EFECC_FILEID,
read_sim_ecc_numbers, vc, NULL);
}
read_sim_ecc_numbers(SIM_EFECC_FILEID, vc);
}
static void sim_state_watch(enum ofono_sim_state new_state, void *user)
{
struct ofono_voicecall *vc = user;
switch (new_state) {
case OFONO_SIM_STATE_INSERTED:
if (vc->sim_context == NULL)
vc->sim_context = ofono_sim_context_create(vc->sim);
read_sim_ecc_numbers(SIM_EFECC_FILEID, vc);
ofono_sim_add_file_watch(vc->sim_context, SIM_EFECC_FILEID,
read_sim_ecc_numbers, vc, NULL);
get_ecc_numbers(vc);
break;
case OFONO_SIM_STATE_NOT_PRESENT:
case OFONO_SIM_STATE_RESETTING:
@@ -2888,6 +2893,8 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *user)
voicecall_close_settings(vc);
break;
case OFONO_SIM_STATE_READY:
get_ecc_numbers(vc);
voicecall_load_settings(vc);
break;
case OFONO_SIM_STATE_LOCKED_OUT:

View File

@@ -1,13 +1,5 @@
#
# Do NOT Edit the Auto-generated Part!
# Generated by: spectacle version 0.26
#
Name: ofono
# >> macros
# << macros
Summary: Open Source Telephony
Version: 1.14
Release: 1
@@ -15,7 +7,6 @@ Group: Communications/Connectivity Adaptation
License: GPLv2
URL: http://ofono.org
Source0: http://www.kernel.org/pub/linux/network/ofono/ofono-%{version}.tar.xz
Source100: ofono.yaml
Requires: dbus
Requires: systemd
Requires: ofono-configs
@@ -27,6 +18,7 @@ BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(libudev) >= 145
BuildRequires: pkgconfig(bluez) >= 4.85
BuildRequires: pkgconfig(mobile-broadband-provider-info)
BuildRequires: pkgconfig(libwspcodec) >= 2.0
BuildRequires: libtool
BuildRequires: automake
BuildRequires: autoconf
@@ -66,14 +58,10 @@ This package provides default configs for ofono
%prep
%setup -q -n %{name}-%{version}/%{name}
# >> setup
./bootstrap
# << setup
%build
# >> build pre
autoreconf --force --install
# << build pre
%configure --disable-static \
--enable-dundee \
@@ -82,35 +70,32 @@ autoreconf --force --install
make %{?jobs:-j%jobs}
# >> build post
# << build post
%install
rm -rf %{buildroot}
# >> install pre
# << install pre
%make_install
# >> install post
mkdir -p %{buildroot}/%{_sysconfdir}/ofono/push_forwarder.d
mkdir -p %{buildroot}/%{_lib}/systemd/system/network.target.wants
ln -s ../ofono.service %{buildroot}/%{_lib}/systemd/system/network.target.wants/ofono.service
# << install post
%preun
if [ "$1" -eq 0 ]; then
systemctl stop ofono.service
systemctl stop ofono.service ||:
fi
%post
systemctl daemon-reload
systemctl reload-or-try-restart ofono.service
systemctl daemon-reload ||:
# Do not restart during update
# We don't want to break anything during update
# New daemon is taken in use after reboot
# systemctl reload-or-try-restart ofono.service ||:
%postun
systemctl daemon-reload
systemctl daemon-reload ||:
%files
%defattr(-,root,root,-)
# >> files
%doc COPYING ChangeLog AUTHORS README
%config(noreplace) %{_sysconfdir}/dbus-1/system.d/*.conf
%{_sbindir}/*
@@ -118,27 +103,21 @@ systemctl daemon-reload
/%{_lib}/systemd/system/ofono.service
/%{_lib}/systemd/system/dundee.service
%dir %{_sysconfdir}/ofono/
%dir %{_sysconfdir}/ofono/push_forwarder.d
# This file is part of phonesim and not needed with ofono.
%exclude %{_sysconfdir}/ofono/phonesim.conf
%doc /usr/share/man/man8/ofonod.8.gz
%dir %attr(775,radio,radio) /var/lib/ofono
# << files
%files devel
%defattr(-,root,root,-)
%{_includedir}/ofono/
%{_libdir}/pkgconfig/ofono.pc
# >> files devel
# << files devel
%files tests
%defattr(-,root,root,-)
%{_libdir}/%{name}/test/*
# >> files tests
# << files tests
%files configs-mer
%defattr(-,root,root,-)
%config /etc/ofono/ril_subscription.conf
# >> files ofono-configs-mer
# << files ofono-configs-mer

View File

@@ -1,50 +0,0 @@
Name: ofono
Summary: Open Source Telephony
Description: Telephony stack
Version: 1.14
Release: 1
Group: Communications/Connectivity Adaptation
License: GPLv2
URL: http://ofono.org
Sources:
- http://www.kernel.org/pub/linux/network/ofono/ofono-%{version}.tar.xz
Requires:
- dbus
PkgBR:
- libtool
- automake
- autoconf
PkgConfigBR:
- glib-2.0
- dbus-1
- libudev >= 145
- bluez >= 4.85
- mobile-broadband-provider-info
SetupOptions: -q -n %{name}-%{version}/%{name}
ConfigOptions:
- --enable-dundee
- --enable-test
- --with-systemdunitdir="/%{_lib}/systemd/system"
SubPackages:
- Name: devel
Summary: Headers for oFono
Group: Development/Libraries
Description: Development headers and libraries for oFono
Files:
- "%{_includedir}/ofono/"
- "%{_libdir}/pkgconfig/ofono.pc"
- Name: tests
Summary: Test Scripts for oFono
Group: Development/Libraries
Description: Scripts for testing oFono and its functionality
Obsoletes:
- "ofono-test < 1.0"
Provides:
- "ofono-test >= 1.0"
Requires:
- dbus-python
- pygobject2
Files:
- "%{_libdir}/%{name}/test/*"