Compare commits

...

55 Commits

Author SHA1 Message Date
Martti Piirainen
99497f79cb Merge pull request #151 from jkangas/master
Request for pulling LTE configuration bug fix to main branch
2014-01-15 00:46:33 -08:00
Jussi Kangas
2c6c7a9f23 [rilmodem] Force GSM WCDMA configuration in very first start
There was a bug in previous solution where GSM WCDMA was set
only if previous configuration was defined. This fix forces
the GSM WCDMA configuration always if configured.

Signed-off-by: Jussi Kangas <jussi.kangas@oss.tieto.com>
2014-01-14 12:31:51 +02:00
Jussi Kangas
6c7ea7b902 Merge pull request #147 from marttipiirainen/master
Update to upstream version 1.14
2014-01-14 00:21:21 -08:00
Martti Piirainen
94b7a395af [ofono] Update version number to 1.14 2014-01-09 14:38:05 +02:00
Martti Piirainen
852c0cc69a Merge branch 'upstream1.14'
Conflicts:
	ofono/Makefile.am
	ofono/include/dbus.h
	ofono/src/ofono.h

Signed-off-by: Martti Piirainen <martti.piirainen@oss.tieto.com>
2014-01-09 14:34:07 +02:00
Tommi Kenakkala
ad370a4557 Merge pull request #146 from jkangas/master
Request for pulling modem name freezing to main branch
2014-01-09 03:38:29 -08:00
Jussi Kangas
8d6acf833a [rilmodem] Do not increase modem id when restarted
Silent restarting of rilmodem without killing ofono  when rild dies
causes ril modem id to increase. This might cause problems if
clients are not reading the modem id. Since this modem id increase
is unnecessary at the moment ( we are not supporting multiple
modems ) removal of id increase is recommendable as precaution.

Signed-off-by: Jussi Kangas <jussi.kangas@oss.tieto.com>
2014-01-09 12:07:19 +02:00
Tommi Kenakkala
f02f070667 Merge pull request #144 from tkenakka/oemraw
[ofono][rilmodem] OemRaw interface and rilplugin implementation
2014-01-09 00:51:59 -08:00
Martti Piirainen
a9c03ebf70 Merge pull request #145 from marttipiirainen/master
Merge from 'next' to 'master': [rilmodem] fix warnings from ril plugin
2014-01-08 04:50:28 -08:00
Jarko Poutiainen
5ea65dd144 [rilmodem] fix warnings from ril plugin
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-01-08 14:48:08 +02:00
Tommi Kenakkala
d00df4db74 [ofono][rilmodem] OemRaw interface and rilplugin implementation
Signed-off-by: Tommi Kenakkala <tommi.kenakkala@oss.tieto.com>
2014-01-08 11:39:54 +02:00
Martti Piirainen
91e9d02ebb Merge pull request #143 from marttipiirainen/nextmerge
Merge 'next' branch to 'master'
2014-01-07 05:57:03 -08:00
Martti Piirainen
9db8d81f40 Revert "Revert "[rilmodem] Make LTE configuration forcing working both ways""
This reverts commit bffa0c79a0.

Conflicts:

	ofono/drivers/rilmodem/radio-settings.c
2014-01-07 13:26:07 +02:00
Martti Piirainen
685578124f [voicecall] Fix compiler warnings
Fix 'unused variable' compiler warnings introduced by commit 6aafbe93744b366518fe5cd69661d5998ae70958.

Signed-off-by: Martti Piirainen <martti.piirainen@oss.tieto.com>
2014-01-07 07:36:28 +02:00
Petri Takalokastari
ca4efde0b4 [rilmodem] Fix for call waiting status query
As stated on 3GPP 27.007, 7.12 Call waiting +CCWA:
"When querying the status of a network service (<mode>=2) the response
line for 'not active' case (<status>=0) should be returned only if service is
not active for any <class>."
If status is 'active', rilmodem will provide bitmap of service classes having
CW enabled to oFono core. Core will mask from this bitmap, whether CW
is enabled for voice call

Signed-off-by: Petri Takalokastari <petri.takalokastari@oss.tieto.com>
2014-01-07 07:36:28 +02:00
Jarko Poutiainen
543fb0eeec [ril] fix merge and some style issues
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-01-07 07:36:28 +02:00
Jarko Poutiainen
caa16fbaff [ril] Multiple PDP context support for rilmodem
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-01-07 07:36:28 +02:00
Jarko Poutiainen
9dee219d9c [ril] run ofono as root
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-01-07 07:36:28 +02:00
Jarko Poutiainen
87f4764bb3 [ril] Leave extra capabilities as radio cannot set IP address
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-01-07 07:36:28 +02:00
Richard Braakman
4cc59829a2 [gdbus] Handle dbus disconnect signal
A previous patch stopped ofono from crashing when it received the disconnect signal (which has no sender). However this wasn't enough. gdbus/mainloop.c actually registers a listener for the disconnect signal, so message_filter should dispatch it.

This patch makes sure of that, and hardens message_filter's loop against any other fields which might be NULL. (the logic: if the data-> field is NULL it means don't filter on that value; if the message field is NULL then only match data structs that have that field NULL.)

Without this patch, if dbus is restarted ofonod will hang around and be useless until the next reboot.
2014-01-07 07:36:28 +02:00
Jussi Kangas
1c30b645aa [rilmodem] Configure the tech preference only once
Information if the configuration has been done or not cannot be
stored to same file where configuration is read from due the lack
of priviledges. This change makes ofono to store the information
to same place as any other setting stored by ofono.

Signed-off-by: Jussi Kangas <jussi.kangas@oss.tieto.com>
2014-01-07 07:36:28 +02:00
Jussi Kangas
4d1c78b549 [rilmodem] Do not close the ofono if rild dies
There is no need to kill ofono if connection to rild dies. We just
need to inform client about connection drop and try again

Signed-off-by: Jussi Kangas <jussi.kangas@oss.tieto.com>
2014-01-07 07:36:00 +02:00
Tommi Kenakkala
753b316826 [ofono] Handle gril ioconnection shutdown by exit
Before: gril connection hand up (G_IO_HUP) causes ofono gril
to shutdown and no messages are handled.
After: gril notifies ril plugin which emits a message
to clients and exits ofono.

Signed-off-by: Tommi Kenakkala <tommi.kenakkala@oss.tieto.com>
2014-01-07 07:36:00 +02:00
Slava Monich
04277bcf20 Fixed memory leak in provision_get_settings 2014-01-07 07:36:00 +02:00
Jarko Poutiainen
8dee8f75de [gril]send all commands before destroying watch
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-01-07 07:34:48 +02:00
Jarko Poutiainen
623bd2252b [gril]revert grilio back to original
Signed-off-by: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>
2014-01-07 07:34:48 +02:00
Jussi Kangas
c2db8e1ce2 [rilmodem] Enhancing traces
We are getting too little traces in release mode and too much in
debug mode. This change fixes the problem

Signed-off-by: Jussi Kangas <jussi.kangas@oss.tieto.com>
2014-01-07 07:33:49 +02:00
Martti Piirainen
b4518cd92e [rilmodem] Call direction bookkeeping
Signed-off-by: Martti Piirainen <martti.piirainen@oss.tieto.com>
2014-01-07 07:33:49 +02:00
Martti Piirainen
7fdb1fe651 [rilmodem] Remove unnecessary 'fake' held status when dialing 2nd call 2014-01-07 07:33:49 +02:00
Marcel Holtmann
e99e52e5de Release 1.14 2013-12-22 13:03:11 -08:00
Marcel Holtmann
c86997223a unit: Ignore errors about deprecated g_test_trap_fork 2013-12-21 13:27:36 -08:00
Marcel Holtmann
ed93490647 build: Remove unused dependency on USB library 2013-12-21 13:13:07 -08:00
Denis Kenzior
d6af339c99 git: Fixup messed up permissions 2013-12-21 13:39:54 -06:00
Krzysztof Wilk
ed4e155acd features: Describe Siri feature 2013-12-18 15:28:56 -06:00
Denis Kenzior
5b89d3068c AUTHORS: Mention Krzysztof's contributions 2013-12-18 00:10:19 -06:00
Krzysztof Wilk
9d847687eb phonesim: Enable Siri atom 2013-12-18 00:07:47 -06:00
Krzysztof Wilk
c8a3172c00 hfp_hf_bluez5: Enable Siri atom 2013-12-18 00:07:47 -06:00
Krzysztof Wilk
1e14b217b0 hfp_hf_bluez4: Enable Siri atom 2013-12-18 00:07:47 -06:00
Krzysztof Wilk
171d4dee76 siri: Add atom driver 2013-12-18 00:07:47 -06:00
Krzysztof Wilk
5c11e13019 siri: Add atom implementation 2013-12-18 00:07:47 -06:00
Krzysztof Wilk
5b07c59f34 include: Add Siri interface definition 2013-12-18 00:07:47 -06:00
Krzysztof Wilk
8621d36c15 dbus: Define Siri DBUS Interface 2013-12-18 00:07:47 -06:00
Krzysztof Wilk
203409a25b doc: Add Siri API 2013-12-18 00:07:47 -06:00
Denis Kenzior
fc98985d14 AUTHORS: Mention Andrew's contributions 2013-12-05 03:50:05 -06:00
Andrew Earl
e0aeebae0a hfp: Add Voice Recognition flag to BRSF 2013-12-05 03:45:48 -06:00
Denis Kenzior
7c7cdd8759 he910: tweak initialization logic 2013-11-26 16:25:48 -06:00
Denis Kenzior
85cdacb509 netreg: Turn off CIEV indications other than rssi 2013-11-26 16:25:03 -06:00
Denis Kenzior
3722e626f3 AUTHORS: Mention Slava's contributions 2013-11-26 15:33:08 -06:00
Slava Monich
a7ba6d1e9e mbpi: Provision mmsc and message_proxy 2013-11-26 15:32:03 -06:00
Denis Kenzior
9b224fff79 hfp_ag_bluez5: Try to support non-phone hardware
For devices which are not 'real' phone modems, the voicecall
initialization can happen outside of the pre-sim state.  In this case
the voicecall atom detection logic fails.  Try to detect the voicecall
atom separately, and register the profile if the SIM atom is already
present and in state 'READY'.

For all other cases, the previous logic still applies.
2013-11-25 11:33:57 -06:00
Denis Kenzior
06598ef47c udevng: Add he910 detection logic 2013-11-25 10:55:59 -06:00
Denis Kenzior
6e52f03f64 plugins: Add initial Telit he910 driver 2013-11-25 10:55:59 -06:00
Denis Kenzior
8440f77f9a build: Always build the connman plugin
It is not related to BLUEZ 4 support
2013-11-25 10:55:59 -06:00
Bastien Nocera
7a6da06f27 gdbus: Fix trying to remove already removed sources
When we return FALSE from idle handlers, the source is removed.
This will be causing warnings in glib 2.40.

See https://bugzilla.gnome.org/show_bug.cgi?id=710724
2013-11-11 01:06:19 -08:00
Marcel Holtmann
9be2fb1b10 Release 1.13 2013-11-08 00:34:09 -08:00
54 changed files with 2040 additions and 143 deletions

View File

@@ -89,3 +89,6 @@ Claudio Takahasi <claudio.takahasi@openbossa.org>
Paulo Borges <paulo.borges@openbossa.org>
Anthony Viallard <viallard@syscom-instruments.com>
Jesper Larsen <jesper.larsen@ixonos.com>
Slava Monich <slava.monich@jolla.com>
Andrew Earl <andrewx.earl@intel.com>
Krzysztof Wilk <krzysztofx.wilk@intel.com>

View File

@@ -1,3 +1,20 @@
ver 1.14:
Add support for Apple Siri specific Handsfree commands.
Add support for provisioning of MMSC and Message Proxy.
Add support for Telit HE910 modems.
ver 1.13:
Fix issue with parsing SS control strings.
Fix issue with error reporting and Sierra modems.
Fix issue with GPRS activation and SIM900 modems.
Fix issue with serial receiver and SIM900 modems.
Fix issue with signal strength and SIM900 modems.
Fix issue with AT+CNMI handling and SIM900 modems.
Fix issue with broken +CMER behavior and MBM modems.
Fix issue with handling +CIEV and release and swap.
Add support for Handsfree profile 1.6 functionality.
Add support for Handsfree audio interface.
ver 1.12:
Fix issue with alpha ID and self explanatory icons.
Fix issue with SIM Refresh handling and resetting state.

View File

@@ -21,7 +21,8 @@ pkginclude_HEADERS = include/log.h include/plugin.h include/history.h \
include/cdma-connman.h include/gnss.h \
include/private-network.h include/cdma-netreg.h \
include/cdma-provision.h include/handsfree.h \
include/handsfree-audio.h include/sim-mnclength.h
include/handsfree-audio.h include/sim-mnclength.h \
include/oemraw.h include/siri.h
nodist_pkginclude_HEADERS = include/version.h
@@ -140,7 +141,8 @@ builtin_sources += drivers/rilmodem/rilmodem.h \
drivers/rilmodem/ussd.c \
drivers/rilmodem/call-settings.c \
drivers/rilmodem/call-forwarding.c \
drivers/rilmodem/cbs.c
drivers/rilmodem/cbs.c \
drivers/rilmodem/oemraw-messages.c
endif
@@ -352,7 +354,8 @@ builtin_sources += drivers/atmodem/atutil.h \
drivers/hfpmodem/network-registration.c \
drivers/hfpmodem/call-volume.c \
drivers/hfpmodem/devinfo.c \
drivers/hfpmodem/handsfree.c
drivers/hfpmodem/handsfree.c \
drivers/hfpmodem/siri.c
builtin_modules += speedupmodem
builtin_sources += drivers/atmodem/atutil.h \
@@ -455,6 +458,12 @@ builtin_modules += sim900
builtin_sources += plugins/sim900.c
endif
builtin_modules += connman
builtin_sources += plugins/connman.c
builtin_modules += he910
builtin_sources += plugins/he910.c
if BLUETOOTH
if BLUEZ4
builtin_modules += bluez4
@@ -475,9 +484,6 @@ builtin_sources += plugins/hfp_ag_bluez4.c plugins/bluez4.h
builtin_modules += dun_gw_bluez4
builtin_sources += plugins/dun_gw_bluez4.c plugins/bluez4.h
builtin_modules += connman
builtin_sources += plugins/connman.c
builtin_sources += $(btio_sources)
builtin_cflags += @BLUEZ_CFLAGS@
builtin_libadd += @BLUEZ_LIBS@
@@ -571,7 +577,8 @@ src_ofonod_SOURCES = $(builtin_sources) src/ofono.ver \
src/cdma-sms.c src/private-network.c src/cdma-netreg.c \
src/cdma-provision.c src/handsfree.c \
src/handsfree-audio.c src/bluetooth.h \
src/hfp.h src/sim-mnclength.c
src/hfp.h src/sim-mnclength.c src/oemraw.c \
src/siri.c
src_ofonod_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
@GLIB_LIBS@ @DBUS_LIBS@ -ldl
@@ -591,8 +598,7 @@ else
build_plugindir = $(plugindir)
endif
AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @USB_CFLAGS@ \
$(builtin_cflags) \
AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ $(builtin_cflags) \
-DOFONO_PLUGIN_BUILTIN \
-DPLUGINDIR=\""$(build_plugindir)"\"
@@ -616,7 +622,8 @@ doc_files = doc/overview.txt doc/ofono-paper.txt doc/release-faq.txt \
doc/audio-settings-api.txt doc/text-telephony-api.txt \
doc/calypso-modem.txt doc/message-api.txt \
doc/location-reporting-api.txt doc/smshistory-api.txt \
doc/certification.txt
doc/oemraw-api.txt \
doc/certification.txt doc/siri-api.txt
test_scripts = test/backtrace \

View File

@@ -1,5 +1,5 @@
AC_PREREQ(2.60)
AC_INIT(ofono, 1.12)
AC_INIT(ofono, 1.14)
AM_INIT_AUTOMAKE([foreign subdir-objects color-tests])
AC_CONFIG_HEADERS(config.h)
@@ -116,12 +116,6 @@ AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
AC_ARG_ENABLE(tools, AC_HELP_STRING([--enable-tools],
[enable testing tools]), [enable_tools=${enableval}])
if (test "${enable_tools}" = "yes"); then
PKG_CHECK_MODULES(USB, libusb-1.0, dummy=yes,
AC_MSG_ERROR(USB library is required))
AC_SUBST(USB_CFLAGS)
AC_SUBST(USB_LIBS)
fi
AM_CONDITIONAL(TOOLS, test "${enable_tools}" = "yes")
AC_ARG_ENABLE(dundee, AC_HELP_STRING([--enable-dundee],

View File

@@ -739,3 +739,11 @@ Bluetooth Handsfree Profile
access to Bluetooth HFP specific features via the oFono Handsfree interface.
These features include voice recognition activation, last number redial,
etc.
Apple Siri
==========
- Siri feature. oFono can query availability of Siri on an iOS device. oFono
uses 'EyesFreeMode' property on the Siri interface to control the state of the
Siri Eyes Free Mode. When EyesFreeMode state is enabled, the iOS devices
screen wont light up during a voice recognition session and an incoming call.

19
ofono/doc/oemraw-api.txt Normal file
View File

@@ -0,0 +1,19 @@
OemRaw hierarchy
==============================
Service org.ofono
Interface org.ofono.OemRaw
Object path [variable prefix]/{modem0,modem1,...}
Methods array{byte} Send(array{byte} req)
Sends an array of bytes to modem and returns its
response.
One potential use is proprietary request handling.
Composing a properly formatted request is on the
responsibility of the client.
Multiple simultaneous requests are supported by ofono
core, but driver- or modem-specific restrictions may
exist.

41
ofono/doc/siri-api.txt Normal file
View File

@@ -0,0 +1,41 @@
Siri hierarchy [experimental]
========================
Service org.ofono
Interface org.ofono.Siri
Object path [variable prefix]/{modem0,modem1,...}
Methods dict GetProperties()
Returns all Siri properties. See the
properties section for available properties.
Possible Errors: [service].Error.InProgress
[service].Error.Failed
void SetProperty(string name, variant value)
Changes the value of the specified property. Only
properties that are listed as read-write are
changeable. On success a PropertyChanged signal
will be emitted.
Possible Errors: [service].Error.InvalidArguments
[service].Error.InProgress
[service].Error.Failed
Signals PropertyChanged(string property, variant value)
This signal indicates a changed value of the given
property.
Properties boolean Enabled [readonly]
This property indicates whether Siri is available on
the device.
string EyesFreeMode [readwrite]
This property indicates the state of Siri Eyes Free
Mode. The current possible values are: "enabled"
and "disabled"

View File

@@ -1656,6 +1656,8 @@ static void cind_support_cb(gboolean ok, GAtResult *result, gpointer user_data)
int min = 0;
int max = 0;
int tmp_min, tmp_max, invalid;
int i, len;
char buf[256];
if (!ok)
goto error;
@@ -1715,6 +1717,15 @@ static void cind_support_cb(gboolean ok, GAtResult *result, gpointer user_data)
if (nd->signal_index == 0)
goto error;
/* Turn off all CIEV indicators except the signal indicator */
len = sprintf(buf, "AT+CIND=");
for (i = 1; i < index - 1; i++)
len += sprintf(buf + len, i == nd->signal_index ? "1," : "0,");
len += sprintf(buf + len, i == nd->signal_index ? "1" : "0");
g_at_chat_send(nd->chat, buf, NULL, NULL, NULL, NULL);
switch (nd->vendor) {
case OFONO_VENDOR_MBM:
/*

View File

@@ -39,6 +39,7 @@ static int hfpmodem_init(void)
hfp_netreg_init();
hfp_call_volume_init();
hfp_handsfree_init();
hfp_siri_init();
return 0;
}
@@ -50,6 +51,7 @@ static void hfpmodem_exit(void)
hfp_netreg_exit();
hfp_call_volume_exit();
hfp_handsfree_exit();
hfp_siri_exit();
}
OFONO_PLUGIN_DEFINE(hfpmodem, "Hands-Free Profile Driver", VERSION,

View File

@@ -34,5 +34,8 @@ extern void hfp_voicecall_exit(void);
extern void hfp_handsfree_init(void);
extern void hfp_handsfree_exit(void);
extern void hfp_siri_init(void);
extern void hfp_siri_exit(void);
extern void hfp_devinfo_init(void);
extern void hfp_devinfo_exit(void);

View File

@@ -0,0 +1,214 @@
/*
*
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2013 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <glib.h>
#include <gatchat.h>
#include <gatresult.h>
#include <ofono/log.h>
#include <ofono/modem.h>
#include <ofono/siri.h>
#include "hfpmodem.h"
#include "hfp.h"
#include "slc.h"
#define APPLE_SIRI_STATUS_FEATURE 8
static const char *xapl_prefix[] = { "+XAPL=", NULL };
static const char *aplsiri_prefix[] = { "+APLSIRI:", NULL };
static const char *aplefm_prefix[] = { "+APLEFM:", NULL };
struct siri_data
{
GAtChat *chat;
};
static void aplsiri_notify(GAtResult *result, gpointer user_data)
{
struct ofono_siri *siri = user_data;
GAtResultIter iter;
gint value;
g_at_result_iter_init(&iter, result);
if (!g_at_result_iter_next(&iter, "+APLSIRI:"))
return;
if (!g_at_result_iter_next_number(&iter, &value))
return;
ofono_siri_set_status(siri, value);
}
static void aplsiri_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_siri *siri = user_data;
struct siri_data *sd = ofono_siri_get_data(siri);
struct ofono_error error;
GAtResultIter iter;
gint value;
if (!ok)
goto fail;
decode_at_error(&error, g_at_result_final_response(result));
if (error.type != OFONO_ERROR_TYPE_NO_ERROR)
goto fail;
g_at_result_iter_init(&iter, result);
if (!g_at_result_iter_next(&iter, "+APLSIRI:"))
goto fail;
if (!g_at_result_iter_next_number(&iter, &value))
goto fail;
if (value == 0)
goto fail;
g_at_chat_register(sd->chat, "+APLSIRI:",
aplsiri_notify, FALSE, siri, NULL);
ofono_siri_register(siri);
ofono_siri_set_status(siri, value);
return;
fail:
ofono_siri_remove(siri);
}
static void xapl_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_siri *siri = user_data;
struct siri_data *sd = ofono_siri_get_data(siri);
struct ofono_error error;
if (!ok) {
ofono_siri_remove(siri);
return;
}
decode_at_error(&error, g_at_result_final_response(result));
if (error.type != OFONO_ERROR_TYPE_NO_ERROR) {
ofono_siri_remove(siri);
return;
}
g_at_chat_send(sd->chat, "AT+APLSIRI?",
aplsiri_prefix, aplsiri_cb, siri, NULL);
}
static int hfp_siri_probe(struct ofono_siri *siri, unsigned int vendor,
void *data)
{
struct hfp_slc_info *info = data;
struct siri_data *sd;
char at_command[64];
DBG("");
sd = g_new0(struct siri_data, 1);
sd->chat = g_at_chat_clone(info->chat);
ofono_siri_set_data(siri, sd);
snprintf(at_command, sizeof(at_command),
"AT+XAPL=Linux-oFono-%s,%d",
VERSION, APPLE_SIRI_STATUS_FEATURE);
g_at_chat_send(sd->chat, at_command, xapl_prefix, xapl_cb, siri, NULL);
return 0;
}
static void hfp_siri_remove(struct ofono_siri *siri)
{
struct siri_data *sd = ofono_siri_get_data(siri);
ofono_siri_set_data(siri, NULL);
g_at_chat_unref(sd->chat);
g_free(sd);
}
static void hfp_siri_eyes_free_mode_cb(gboolean ok, GAtResult *result,
gpointer user_data)
{
struct cb_data *cbd = user_data;
ofono_siri_cb_t cb = cbd->cb;
struct ofono_siri *siri = cbd->data;
struct ofono_error error;
decode_at_error(&error, g_at_result_final_response(result));
cb(&error, siri);
}
static void hfp_siri_set_eyes_free_mode(struct ofono_siri *siri,
ofono_siri_cb_t cb, unsigned int val)
{
struct siri_data *sd = ofono_siri_get_data(siri);
struct cb_data *cbd = cb_data_new(cb, siri);
char at_command[16];
snprintf(at_command, sizeof(at_command), "AT+APLEFM=%d", val);
if (g_at_chat_send(sd->chat, at_command, aplefm_prefix,
hfp_siri_eyes_free_mode_cb,
cbd, g_free) > 0)
return;
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, NULL);
}
static struct ofono_siri_driver driver = {
.name = "hfpmodem",
.probe = hfp_siri_probe,
.remove = hfp_siri_remove,
.set_eyes_free_mode = hfp_siri_set_eyes_free_mode,
};
void hfp_siri_init(void)
{
ofono_siri_driver_register(&driver);
}
void hfp_siri_exit(void)
{
ofono_siri_driver_unregister(&driver);
}

View File

@@ -63,6 +63,7 @@ void hfp_slc_info_init(struct hfp_slc_info *info, guint16 version)
info->hf_features |= HFP_HF_FEATURE_3WAY;
info->hf_features |= HFP_HF_FEATURE_CLIP;
info->hf_features |= HFP_HF_FEATURE_REMOTE_VOLUME_CONTROL;
info->hf_features |= HFP_HF_FEATURE_VOICE_RECOGNITION;
if (version < HFP_VERSION_1_5)
goto done;

View File

@@ -64,8 +64,10 @@ static void ril_set_forward_cb(struct ril_msg *message, gpointer user_data)
if (message->error == RIL_E_SUCCESS)
CALLBACK_WITH_SUCCESS(cb, cbd->data);
else
else {
ofono_error("CF setting failed");
CALLBACK_WITH_FAILURE(cb, cbd->data);
}
}
static void ril_registration(struct ofono_call_forwarding *cf, int type,
@@ -79,6 +81,8 @@ static void ril_registration(struct ofono_call_forwarding *cf, int type,
struct parcel rilp;
int ret = 0;
ofono_info("cf registration");
parcel_init(&rilp);
parcel_w_int32(&rilp, CF_ACTION_REGISTRATION);
@@ -111,6 +115,7 @@ static void ril_registration(struct ofono_call_forwarding *cf, int type,
/* In case of error free cbd and return the cb with failure */
if (ret <= 0) {
ofono_error("CF registration failed");
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, data);
}
@@ -165,6 +170,7 @@ static void ril_send_forward_cmd(struct ofono_call_forwarding *cf,
/* In case of error free cbd and return the cb with failure */
if (ret <= 0) {
ofono_error("CF action failed");
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, data);
}
@@ -174,6 +180,7 @@ static void ril_erasure(struct ofono_call_forwarding *cf,
int type, int cls,
ofono_call_forwarding_set_cb_t cb, void *data)
{
ofono_info("CF_ACTION_ERASURE");
ril_send_forward_cmd(cf, type, cls, cb, data, CF_ACTION_ERASURE);
}
@@ -181,6 +188,7 @@ static void ril_deactivate(struct ofono_call_forwarding *cf,
int type, int cls,
ofono_call_forwarding_set_cb_t cb, void *data)
{
ofono_info("CF_ACTION_DISABLE");
ril_send_forward_cmd(cf, type, cls, cb, data, CF_ACTION_DISABLE);
}
@@ -188,6 +196,7 @@ static void ril_activate(struct ofono_call_forwarding *cf,
int type, int cls,
ofono_call_forwarding_set_cb_t cb, void *data)
{
ofono_info("CF_ACTION_ENABLE");
ril_send_forward_cmd(cf, type, cls, cb, data, CF_ACTION_ENABLE);
}
@@ -240,8 +249,10 @@ static void ril_query_cb(struct ril_msg *message, gpointer user_data)
CALLBACK_WITH_SUCCESS(cb, 1, list, cbd->data);
g_free(list);
} else
} else {
ofono_error("CF query failed");
CALLBACK_WITH_FAILURE(cb, 0, NULL, cbd->data);
}
}
static void ril_query(struct ofono_call_forwarding *cf, int type, int cls,
@@ -253,6 +264,8 @@ static void ril_query(struct ofono_call_forwarding *cf, int type, int cls,
struct parcel rilp;
int ret = 0;
ofono_info("cf query");
parcel_init(&rilp);
parcel_w_int32(&rilp, 2);
@@ -292,6 +305,7 @@ static void ril_query(struct ofono_call_forwarding *cf, int type, int cls,
/* In case of error free cbd and return the cb with failure */
if (ret <= 0) {
ofono_error("unable to send CF query");
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, 0, NULL, data);
}

View File

@@ -59,6 +59,7 @@ static void ril_clip_cb(struct ril_msg *message, gpointer user_data)
if (message->error == RIL_E_SUCCESS) {
ril_util_init_parcel(message, &rilp);
/* data length of the response */
res = parcel_r_int32(&rilp);
if (res > 0)
@@ -118,6 +119,36 @@ static void ril_cw_set(struct ofono_call_settings *cs, int mode, int cls,
}
}
static void ril_cw_query_cb(struct ril_msg *message, gpointer user_data)
{
struct cb_data *cbd = user_data;
ofono_call_settings_status_cb_t cb = cbd->cb;
struct parcel rilp;
int res = 0;
int sv = 0;
if (message->error == RIL_E_SUCCESS) {
ril_util_init_parcel(message, &rilp);
/* first value in int[] is len so let's skip that */
parcel_r_int32(&rilp);
/* status of call waiting service, disabled is returned only if
* service is not active for any service class */
res = parcel_r_int32(&rilp);
DBG("CW enabled/disabled: %d", res);
if (res > 0) {
/* services for which call waiting is enabled, 27.007 7.12 */
sv = parcel_r_int32(&rilp);
DBG("CW enabled for: %d", sv);
}
CALLBACK_WITH_SUCCESS(cb, sv, cbd->data);
} else
CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
}
static void ril_cw_query(struct ofono_call_settings *cs, int cls,
ofono_call_settings_status_cb_t cb, void *data)
{
@@ -137,7 +168,7 @@ static void ril_cw_query(struct ofono_call_settings *cs, int cls,
parcel_w_int32(&rilp, 0);
ret = g_ril_send(sd->ril, RIL_REQUEST_QUERY_CALL_WAITING,
rilp.data, rilp.size, ril_clip_cb, cbd, g_free);
rilp.data, rilp.size, ril_cw_query_cb, cbd, g_free);
parcel_free(&rilp);

View File

@@ -90,8 +90,6 @@ static void ril_gprs_context_call_list_changed(struct ril_msg *message,
GSList *iterator = NULL;
struct ofono_error error;
DBG("");
unsol = g_ril_unsol_parse_data_call_list(gcd->ril, message, &error);
if (error.type != OFONO_ERROR_TYPE_NO_ERROR)
@@ -103,11 +101,9 @@ static void ril_gprs_context_call_list_changed(struct ril_msg *message,
call = (struct data_call *) iterator->data;
if (call->cid == gcd->active_rild_cid) {
DBG("Found current call in call list: %d", call->cid);
active_cid_found = TRUE;
if (call->active == 0) {
DBG("call->status is DISCONNECTED for cid: %d", call->cid);
disconnect = TRUE;
ofono_gprs_context_deactivated(gc, gcd->active_ctx_cid);
}
@@ -117,8 +113,7 @@ static void ril_gprs_context_call_list_changed(struct ril_msg *message,
}
if (disconnect || active_cid_found == FALSE) {
DBG("Clearing active context");
ofono_error("Clearing active context");
set_context_disconnected(gcd);
}
@@ -136,8 +131,11 @@ static void ril_setup_data_call_cb(struct ril_msg *message, gpointer user_data)
struct reply_setup_data_call *reply = NULL;
char **split_ip_addr = NULL;
ofono_info("setting up data call");
if (message->error != RIL_E_SUCCESS) {
DBG("Reply failure: %s", ril_error_to_string(message->error));
ofono_error("GPRS context: Reply failure: %s",
ril_error_to_string(message->error));
error.type = OFONO_ERROR_TYPE_FAILURE;
error.error = message->error;
@@ -151,9 +149,10 @@ static void ril_setup_data_call_cb(struct ril_msg *message, gpointer user_data)
gcd->active_rild_cid = reply->cid;
if (error.type != OFONO_ERROR_TYPE_NO_ERROR) {
if (gcd->active_rild_cid != -1)
if (gcd->active_rild_cid != -1) {
ofono_error("no active context. disconnect");
disconnect_context(gc);
}
goto error;
}
@@ -231,7 +230,7 @@ static void ril_gprs_context_activate_primary(struct ofono_gprs_context *gc,
int reqid = RIL_REQUEST_SETUP_DATA_CALL;
int ret = 0;
DBG("Activating contex: %d", ctx->cid);
ofono_info("Activating context: %d", ctx->cid);
cbd->user = gc;
@@ -293,7 +292,7 @@ static void ril_deactivate_data_call_cb(struct ril_msg *message, gpointer user_d
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
gint id = gcd->active_ctx_cid;
DBG("");
ofono_info("deactivating data call");
/* Reply has no data... */
if (message->error == RIL_E_SUCCESS) {
@@ -333,7 +332,7 @@ static void ril_gprs_context_deactivate_primary(struct ofono_gprs_context *gc,
int reqid = RIL_REQUEST_DEACTIVATE_DATA_CALL;
int ret = 0;
DBG("");
ofono_info("deactivate primary");
if (gcd->active_rild_cid == -1) {
set_context_disconnected(gcd);

View File

@@ -188,7 +188,7 @@ static void ril_data_reg_cb(struct ril_msg *message, gpointer user_data)
ofono_gprs_set_cid_range(gprs, 1, max_cids);
}
DBG("data registration status is %d", status);
ofono_info("data registration status is %d", status);
if (status == NETWORK_REGISTRATION_STATUS_ROAMING)
status = check_if_really_roaming(status);

View File

@@ -117,7 +117,7 @@ static void ril_creg_cb(struct ril_msg *message, gpointer user_data)
if (status == NETWORK_REGISTRATION_STATUS_ROAMING)
status = check_if_really_roaming(status);
DBG("voice registration status is %d", status);
ofono_info("voice registration status is %d", status);
nd->tech = tech;
cb(&error, status, lac, ci, tech, cbd->data);
@@ -301,7 +301,7 @@ static void ril_cops_list_cb(struct ril_msg *message, gpointer user_data)
/* Number of operators at the list (4 strings for every operator) */
noperators = parcel_r_int32(&rilp) / 4;
DBG("noperators = %d", noperators);
ofono_info("noperators = %d", noperators);
list = g_try_new0(struct ofono_network_operator, noperators);
if (list == NULL)
@@ -386,6 +386,7 @@ static void ril_list_operators(struct ofono_netreg *netreg,
g_ril_print_request_no_args(nd->ril, ret, request);
if (ret <= 0) {
ofono_error("operator listing failed");
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, 0, NULL, data);
}
@@ -404,6 +405,7 @@ static void ril_register_cb(struct ril_msg *message, gpointer user_data)
g_ril_print_response_no_args(nd->ril, message);
} else {
ofono_error("registration failed");
decode_ril_error(&error, "FAIL");
}
@@ -425,6 +427,7 @@ static void ril_register_auto(struct ofono_netreg *netreg,
g_ril_print_request_no_args(nd->ril, ret, request);
if (ret <= 0) {
ofono_error("auto registration failed");
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, data);
}
@@ -460,6 +463,7 @@ static void ril_register_manual(struct ofono_netreg *netreg,
/* In case of error free cbd and return the cb with failure */
if (ret <= 0) {
ofono_error("manual registration failed");
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, data);
}

View File

@@ -0,0 +1,161 @@
/*
* oFono - Open Source Telephony
*
* Copyright (C) 2013 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <glib.h>
#include <ofono/log.h>
#include <ofono/modem.h>
#include <ofono/oemraw.h>
#include "common.h"
#include "gril.h"
#include "rilmodem.h"
struct oem_raw_data {
GRil *ril;
unsigned int vendor;
};
static gboolean ril_oemraw_delayed_register(gpointer user_data)
{
struct ofono_oem_raw *raw = user_data;
DBG("");
ofono_oem_raw_dbus_register(raw);
return FALSE; /* This makes the timeout a single-shot */
}
static int ril_oemraw_probe(struct ofono_oem_raw *raw, unsigned int vendor,
void *data)
{
GRil *ril = data;
struct oem_raw_data *od;
DBG("");
od = g_new0(struct oem_raw_data, 1);
od->ril = g_ril_clone(ril);
od->vendor = vendor;
ofono_oem_raw_set_data(raw, od);
g_timeout_add_seconds(1, ril_oemraw_delayed_register, raw);
return 0;
}
static void ril_oemraw_remove(struct ofono_oem_raw *raw)
{
struct oem_raw_data *od;
DBG("");
od = ofono_oem_raw_get_data(raw);
ofono_oem_raw_set_data(raw, NULL);
g_ril_unref(od->ril);
g_free(od);
}
static void ril_oemraw_request_cb(struct ril_msg *msg,
gpointer user_data)
{
struct ofono_error error;
struct ofono_oem_raw_results result;
struct cb_data *cbd = user_data;
ofono_oem_raw_query_cb_t cb = cbd->cb;
if (msg && msg->error == RIL_E_SUCCESS) {
decode_ril_error(&error, "OK");
} else {
DBG("error:%d len:%d unsol:%d req:%d serial_no:%d",
msg->error, msg->buf_len, msg->unsolicited,
msg->req, msg->serial_no);
CALLBACK_WITH_FAILURE(cb, NULL, cbd->data);
return;
}
result.data = msg->buf;
result.length = msg->buf_len;
cb(&error, &result, cbd->data);
}
static void ril_oemraw_request(struct ofono_oem_raw *raw,
const struct ofono_oem_raw_request *request,
ofono_oem_raw_query_cb_t cb, void *data)
{
int ret;
int i;
struct cb_data *cbd;
struct oem_raw_data *od;
struct parcel parcel;
cbd = cb_data_new(cb, data);
od = ofono_oem_raw_get_data(raw);
parcel_init(&parcel);
for (i = 0; i < request->length; i++) {
/*DBG("Byte: 0x%x", request->data[i]); Enable for debugging*/
parcel_w_byte(&parcel, request->data[i]);
}
ret = g_ril_send(od->ril, RIL_REQUEST_OEM_HOOK_RAW, parcel.data,
parcel.size, ril_oemraw_request_cb, cbd,
g_free);
parcel_free(&parcel);
if (ret <= 0) {
g_free(cbd);
DBG("Failed to issue an OEM RAW request to RIL: result=%d ",
ret);
CALLBACK_WITH_FAILURE(cb, NULL, data);
}
return;
}
static struct ofono_oem_raw_driver driver = {
.name = "rilmodem",
.probe = ril_oemraw_probe,
.remove = ril_oemraw_remove,
.request = ril_oemraw_request,
};
void ril_oemraw_init(void)
{
DBG("");
ofono_oem_raw_driver_register(&driver);
}
void ril_oemraw_exit(void)
{
DBG("");
ofono_oem_raw_driver_unregister(&driver);
}

View File

@@ -38,6 +38,7 @@
#include "gril.h"
#include "grilutil.h"
#include "storage.h"
#include "rilmodem.h"
@@ -56,8 +57,10 @@ static void ril_set_rat_cb(struct ril_msg *message, gpointer user_data)
if (message->error == RIL_E_SUCCESS)
CALLBACK_WITH_SUCCESS(cb, cbd->data);
else
else {
ofono_error("rat mode setting failed");
CALLBACK_WITH_FAILURE(cb, cbd->data);
}
}
static void ril_set_rat_mode(struct ofono_radio_settings *rs,
@@ -71,6 +74,8 @@ static void ril_set_rat_mode(struct ofono_radio_settings *rs,
int pref = rd->ratmode;
int ret = 0;
ofono_info("setting rat mode");
parcel_init(&rilp);
parcel_w_int32(&rilp, 1); /* Number of params */
@@ -97,20 +102,37 @@ static void ril_set_rat_mode(struct ofono_radio_settings *rs,
parcel_free(&rilp);
if (ret <= 0) {
ofono_error("unable to set rat mode");
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, data);
}
}
static void ril_force_rat_mode(struct radio_data *rd, int pref)
{
struct parcel rilp;
if (pref == rd->ratmode)
return;
parcel_init(&rilp);
parcel_w_int32(&rilp, 1);
parcel_w_int32(&rilp, rd->ratmode);
g_ril_send(rd->ril,
RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE,
rilp.data, rilp.size, NULL,
NULL, g_free);
parcel_free(&rilp);
}
static void ril_rat_mode_cb(struct ril_msg *message, gpointer user_data)
{
DBG("");
struct cb_data *cbd = user_data;
ofono_radio_settings_rat_mode_query_cb_t cb = cbd->cb;
struct parcel rilp, rilp_out;
struct parcel rilp;
int mode = OFONO_RADIO_ACCESS_MODE_ANY;
int pref;
struct radio_data *rd = NULL;
if (message->error == RIL_E_SUCCESS) {
ril_util_init_parcel(message, &rilp);
@@ -124,25 +146,18 @@ static void ril_rat_mode_cb(struct ril_msg *message, gpointer user_data)
case PREF_NET_TYPE_GSM_ONLY:
mode = OFONO_RADIO_ACCESS_MODE_GSM;
break;
case PREF_NET_TYPE_GSM_WCDMA_AUTO:/* according to UI design */
if (!cb)
ril_force_rat_mode(cbd->user, pref);
case PREF_NET_TYPE_WCDMA:
case PREF_NET_TYPE_GSM_WCDMA: /* according to UI design */
case PREF_NET_TYPE_GSM_WCDMA_AUTO:/* according to UI design */
mode = OFONO_RADIO_ACCESS_MODE_UMTS;
break;
case PREF_NET_TYPE_LTE_CDMA_EVDO:
case PREF_NET_TYPE_LTE_GSM_WCDMA:
case PREF_NET_TYPE_LTE_CMDA_EVDO_GSM_WCDMA:
if (!cb) {
rd = cbd->user;
parcel_init(&rilp_out);
parcel_w_int32(&rilp_out, 1);
parcel_w_int32(&rilp_out, rd->ratmode);
g_ril_send(rd->ril,
RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE,
rilp_out.data, rilp_out.size, NULL,
NULL, g_free);
parcel_free(&rilp_out);
}
if (!cb)
ril_force_rat_mode(cbd->user, pref);
break;
case PREF_NET_TYPE_CDMA_EVDO_AUTO:
case PREF_NET_TYPE_CDMA_ONLY:
@@ -156,6 +171,7 @@ static void ril_rat_mode_cb(struct ril_msg *message, gpointer user_data)
} else {
if (cb)
CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
ofono_error("rat mode query failed");
}
}
@@ -167,34 +183,74 @@ static void ril_query_rat_mode(struct ofono_radio_settings *rs,
struct cb_data *cbd = cb_data_new(cb, data);
int ret = 0;
ofono_info("rat mode query");
ret = g_ril_send(rd->ril, RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE,
NULL, 0, ril_rat_mode_cb, cbd, g_free);
/* In case of error free cbd and return the cb with failure */
if (ret <= 0) {
ofono_error("unable to send rat mode query");
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, -1, data);
}
}
static void ril_get_net_config(struct radio_data *rsd)
static gboolean ril_get_net_config(struct radio_data *rsd)
{
GKeyFile *keyfile;
GError *err = NULL;
char *path = RIL_CONFIG;
char **alreadyset = NULL;
gboolean needsconfig = FALSE;
gboolean value = FALSE;
rsd->ratmode = PREF_NET_TYPE_GSM_WCDMA_AUTO;
/*
* First we need to check should the LTE be on
* or not
*/
keyfile = g_key_file_new();
g_key_file_set_list_separator(keyfile, ',');
if (!g_key_file_load_from_file(keyfile, path, 0, &err))
g_error_free(err);
else {
if (g_key_file_load_from_file(keyfile, path, 0, &err)) {
if (g_key_file_has_group(keyfile, LTE_FLAG))
rsd->ratmode = PREF_NET_TYPE_LTE_GSM_WCDMA;
} else {
g_error_free(err);
needsconfig = TRUE;
}
g_key_file_free(keyfile);
/* Then we need to check if it already set */
keyfile = storage_open(NULL, RIL_STORE);
alreadyset = g_key_file_get_groups(keyfile, NULL);
if (alreadyset[0])
value = g_key_file_get_boolean(
keyfile, alreadyset[0], LTE_FLAG, NULL);
else if (rsd->ratmode == PREF_NET_TYPE_GSM_WCDMA_AUTO)
value = TRUE;
if (!value && rsd->ratmode == PREF_NET_TYPE_LTE_GSM_WCDMA) {
g_key_file_set_boolean(keyfile,
LTE_FLAG, LTE_FLAG, TRUE);
needsconfig = TRUE;
} else if (value && rsd->ratmode == PREF_NET_TYPE_GSM_WCDMA_AUTO) {
g_key_file_set_boolean(keyfile,
LTE_FLAG, LTE_FLAG, FALSE);
needsconfig = TRUE;
}
g_strfreev(alreadyset);
storage_close(NULL, RIL_STORE, keyfile, TRUE);
return needsconfig;
}
static gboolean ril_delayed_register(gpointer user_data)
@@ -217,12 +273,11 @@ static int ril_radio_settings_probe(struct ofono_radio_settings *rs,
int ret;
struct radio_data *rsd = g_try_new0(struct radio_data, 1);
rsd->ril = g_ril_clone(ril);
ril_get_net_config(rsd);
if (rsd->ratmode == PREF_NET_TYPE_GSM_WCDMA_AUTO) {
if (ril_get_net_config(rsd)) {
cbd = cb_data_new2(rsd, NULL, NULL);
ret = g_ril_send(rsd->ril,
RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE,
NULL, 0, ril_rat_mode_cb, cbd, g_free);
RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE,
NULL, 0, ril_rat_mode_cb, cbd, g_free);
if (ret <= 0)
g_free(cbd);
}

View File

@@ -4,6 +4,7 @@
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
* Copyright (C) 2012 Canonical, Ltd. All rights reserved.
* Copyright (C) 2013 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
@@ -53,6 +54,7 @@ static int rilmodem_init(void)
ril_call_settings_init();
ril_call_forwarding_init();
ril_cbs_init();
ril_oemraw_init();
return 0;
}
@@ -75,6 +77,7 @@ static void rilmodem_exit(void)
ril_call_settings_exit();
ril_call_forwarding_exit();
ril_cbs_exit();
ril_oemraw_exit();
}
OFONO_PLUGIN_DEFINE(rilmodem, "RIL modem driver", VERSION,

View File

@@ -4,6 +4,7 @@
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
* Copyright (C) 2012 Canonical Ltd.
* Copyright (C) 2013 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
@@ -28,6 +29,7 @@
#define EF_STATUS_INVALIDATED 0
#define EF_STATUS_VALID 1
#define RIL_CONFIG "/etc/ofono/ril_subscription.conf"
#define RIL_STORE "rilmodem"
#define LTE_FLAG "4gOn"
extern void ril_devinfo_init(void);
@@ -72,3 +74,5 @@ extern void ril_cbs_exit(void);
extern void ril_phonebook_init(void);
extern void ril_phonebook_exit(void);
extern void ril_oemraw_init(void);
extern void ril_oemraw_exit(void);

View File

@@ -229,7 +229,9 @@ GSList *ril_util_parse_clcc(GRil *gril, struct ril_msg *message)
call->id = parcel_r_int32(&rilp);
call->phone_number.type = parcel_r_int32(&rilp);
parcel_r_int32(&rilp); /* isMpty */
parcel_r_int32(&rilp); /* isMT */
call->direction = (parcel_r_int32(&rilp) ? /* isMT */
CALL_DIRECTION_MOBILE_TERMINATED :
CALL_DIRECTION_MOBILE_ORIGINATED);
parcel_r_int32(&rilp); /* als */
call->type = parcel_r_int32(&rilp); /* isVoice */
parcel_r_int32(&rilp); /* isVoicePrivacy */

View File

@@ -154,11 +154,6 @@ static void set_path(struct sim_data *sd, struct parcel *rilp,
* ../../src/simutil.c for more details.
*/
parcel_w_string(rilp, (char *) ROOTMF);
g_ril_append_print_buf(sd->ril,
"%spath=%s,",
print_buf,
ROOTMF);
} else {
/*
* The only known case of this is EFPHASE_FILED (0x6FAE).
@@ -202,14 +197,14 @@ static void ril_file_info_cb(struct ril_msg *message, gpointer user_data)
&sw1,
&sw2,
&response_len)) == NULL) {
DBG("Can't parse SIM IO response from RILD");
ofono_error("Can't parse SIM IO response from RILD");
decode_ril_error(&error, "FAIL");
goto error;
}
if ((sw1 != 0x90 && sw1 != 0x91 && sw1 != 0x92 && sw1 != 0x9f) ||
(sw1 == 0x90 && sw2 != 0x00)) {
DBG("Error reply, invalid values: sw1: %02x sw2: %02x", sw1, sw2);
ofono_error("invalid values: sw1: %02x sw2: %02x", sw1, sw2);
memset(&error, 0, sizeof(error));
/* TODO: fix decode_ril_error to take type & error */
@@ -230,7 +225,7 @@ static void ril_file_info_cb(struct ril_msg *message, gpointer user_data)
}
if (!ok) {
DBG("parse response failed");
ofono_error("parse response failed");
decode_ril_error(&error, "FAIL");
goto error;
}
@@ -319,7 +314,8 @@ static void ril_file_io_cb(struct ril_msg *message, gpointer user_data)
if (message->error == RIL_E_SUCCESS) {
decode_ril_error(&error, "OK");
} else {
DBG("RILD reply failure: %s", ril_error_to_string(message->error));
ofono_error("RILD reply failure: %s",
ril_error_to_string(message->error));
goto error;
}
@@ -329,7 +325,7 @@ static void ril_file_io_cb(struct ril_msg *message, gpointer user_data)
&sw1,
&sw2,
&response_len)) == NULL) {
DBG("Error parsing IO response");
ofono_error("Error parsing IO response");
goto error;
}
@@ -461,7 +457,8 @@ static void ril_imsi_cb(struct ril_msg *message, gpointer user_data)
DBG("GET IMSI reply - OK");
decode_ril_error(&error, "OK");
} else {
DBG("Reply failure: %s", ril_error_to_string(message->error));
ofono_error("Reply failure: %s",
ril_error_to_string(message->error));
decode_ril_error(&error, "FAIL");
cb(&error, NULL, cbd->data);
return;

View File

@@ -57,8 +57,10 @@ static void ril_csca_set_cb(struct ril_msg *message, gpointer user_data)
if (message->error == RIL_E_SUCCESS)
CALLBACK_WITH_SUCCESS(cb, cbd->data);
else
else {
ofono_error("csca setting failed");
CALLBACK_WITH_FAILURE(cb, cbd->data);
}
}
static void ril_csca_set(struct ofono_sms *sms,
@@ -88,6 +90,7 @@ static void ril_csca_set(struct ofono_sms *sms,
/* In case of error free cbd and return the cb with failure */
if (ret <= 0) {
ofono_error("unable to set csca");
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, user_data);
}
@@ -105,6 +108,7 @@ static void ril_csca_query_cb(struct ril_msg *message, gpointer user_data)
if (message->error == RIL_E_SUCCESS) {
decode_ril_error(&error, "OK");
} else {
ofono_error("csca query failed");
decode_ril_error(&error, "FAIL");
cb(&error, NULL, cbd->data);
return;
@@ -130,6 +134,7 @@ static void ril_csca_query_cb(struct ril_msg *message, gpointer user_data)
cb(&error, &sca, cbd->data);
} else {
ofono_error("return value invalid");
CALLBACK_WITH_FAILURE(cb, NULL, cbd->data);
}
}
@@ -147,6 +152,7 @@ static void ril_csca_query(struct ofono_sms *sms, ofono_sms_sca_query_cb_t cb,
ril_csca_query_cb, cbd, g_free);
if (ret <= 0) {
ofono_error("unable to send sca query");
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, NULL, user_data);
}
@@ -162,8 +168,10 @@ 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");
decode_ril_error(&error, "OK");
} else {
ofono_error("sms sending failed");
decode_ril_error(&error, "FAIL");
}
@@ -185,7 +193,7 @@ static void ril_cmgs(struct ofono_sms *sms, const unsigned char *pdu,
cbd->user = sd;
DBG("pdu_len: %d, tpdu_len: %d mms: %d", pdu_len, tpdu_len, mms);
DBG("pdu_len: %d, tpdu_len: %d mms: %d", pdu_len, tpdu_len, mms);
/* TODO: if (mms) { ... } */
@@ -227,6 +235,7 @@ static void ril_cmgs(struct ofono_sms *sms, const unsigned char *pdu,
parcel_free(&rilp);
if (ret <= 0) {
ofono_error("unable to send sms");
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, -1, user_data);
}
@@ -305,7 +314,7 @@ static void ril_sms_notify(struct ril_msg *message, gpointer user_data)
* to calculate the proper tpdu length.
*/
smsc_len = ril_data[0] + 1;
DBG("smsc_len is %d", smsc_len);
ofono_info("sms received, smsc_len is %d", smsc_len);
g_ril_append_print_buf(sd->ril, "(%s)", ril_pdu);
g_ril_print_unsol(sd->ril, message);

View File

@@ -68,6 +68,8 @@ static void ril_ussd_request(struct ofono_ussd *ussd, int dcs,
enum sms_charset charset;
int ret = -1;
ofono_info("send ussd");
if (cbs_dcs_decode(dcs, NULL, NULL, &charset,
NULL, NULL, NULL)) {
if (charset == SMS_CHARSET_7BIT) {
@@ -114,8 +116,10 @@ static void ril_ussd_cancel_cb(struct ril_msg *message, gpointer user_data)
if (message->error == RIL_E_SUCCESS)
decode_ril_error(&error, "OK");
else
else {
ofono_error("ussd canceling failed");
decode_ril_error(&error, "FAIL");
}
cb(&error, cbd->data);
}
@@ -126,7 +130,7 @@ static void ril_ussd_cancel(struct ofono_ussd *ussd,
struct ussd_data *ud = ofono_ussd_get_data(ussd);
struct cb_data *cbd = cb_data_new(cb, user_data);
DBG("");
ofono_info("send ussd cancel");
cbd->user = ud;
@@ -134,6 +138,8 @@ static void ril_ussd_cancel(struct ofono_ussd *ussd,
ril_ussd_cancel_cb, cbd, g_free) > 0)
return;
ofono_error("unable cancel ussd");
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, user_data);
@@ -147,6 +153,8 @@ static void ril_ussd_notify(struct ril_msg *message, gpointer user_data)
gchar *type;
gint ussdtype;
ofono_info("ussd_received");
ril_util_init_parcel(message, &rilp);
parcel_r_int32(&rilp);
type = parcel_r_string(&rilp);

View File

@@ -99,7 +99,7 @@ static void lastcause_cb(struct ril_msg *message, gpointer user_data)
if (parcel_r_int32(&rilp) > 0)
last_cause = parcel_r_int32(&rilp);
DBG("Call %d ended with RIL cause %d", id, last_cause);
ofono_info("Call %d ended with RIL cause %d", id, last_cause);
if (last_cause == CALL_FAIL_NORMAL || last_cause == CALL_FAIL_BUSY) {
reason = OFONO_DISCONNECT_REASON_REMOTE_HANGUP;
}
@@ -239,6 +239,7 @@ static void generic_cb(struct ril_msg *message, gpointer user_data)
if (message->error == RIL_E_SUCCESS) {
decode_ril_error(&error, "OK");
} else {
ofono_error("generic fail");
decode_ril_error(&error, "FAIL");
goto out;
}
@@ -304,29 +305,17 @@ static void rild_cb(struct ril_msg *message, gpointer user_data)
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
ofono_voicecall_cb_t cb = cbd->cb;
struct ofono_error error;
struct ofono_call *call;
GSList *l;
if (message->error == RIL_E_SUCCESS) {
decode_ril_error(&error, "OK");
} else {
ofono_error("call failed.");
decode_ril_error(&error, "FAIL");
goto out;
}
g_ril_print_response_no_args(vd->ril, message);
/* On a success, make sure to put all active calls on hold */
for (l = vd->calls; l; l = l->next) {
call = l->data;
if (call->status != CALL_STATUS_ACTIVE)
continue;
call->status = CALL_STATUS_HELD;
ofono_voicecall_notify(vc, call);
}
/* CLCC will update the oFono call list with proper ids */
if (!vd->clcc_source)
vd->clcc_source = g_timeout_add(POLL_CLCC_INTERVAL,
@@ -352,6 +341,8 @@ static void ril_dial(struct ofono_voicecall *vc,
int request = RIL_REQUEST_DIAL;
int ret;
ofono_info("dialing");
cbd->user = vc;
parcel_init(&rilp);
@@ -379,6 +370,7 @@ static void ril_dial(struct ofono_voicecall *vc,
/* In case of error free cbd and return the cb with failure */
if (ret <= 0) {
ofono_error("Unable to call");
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, data);
}
@@ -444,6 +436,7 @@ static void ril_hangup_specific(struct ofono_voicecall *vc,
if (ret > 0) {
CALLBACK_WITH_SUCCESS(cb, data);
} else {
ofono_error("unable to hangup specific");
CALLBACK_WITH_FAILURE(cb, data);
}
}

View File

@@ -1006,6 +1006,8 @@ static gboolean process_changes(gpointer user_data)
if (data->removed != NULL)
emit_interfaces_removed(data);
data->process_id = 0;
return FALSE;
}
@@ -1019,6 +1021,7 @@ static void generic_unregister(DBusConnection *connection, void *user_data)
if (data->process_id > 0) {
g_source_remove(data->process_id);
data->process_id = 0;
process_changes(data);
}

View File

@@ -519,8 +519,6 @@ static DBusHandlerResult message_filter(DBusConnection *connection,
dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &arg, DBUS_TYPE_INVALID);
/* Sender is always the owner */
if (sender == NULL)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
for (current = listeners; current != NULL; current = current->next) {
data = current->data;
@@ -528,21 +526,19 @@ static DBusHandlerResult message_filter(DBusConnection *connection,
if (connection != data->connection)
continue;
if (data->owner && g_str_equal(sender, data->owner) == FALSE)
if (data->owner && g_strcmp0(sender, data->owner) != 0)
continue;
if (data->path && g_str_equal(path, data->path) == FALSE)
if (data->path && g_strcmp0(path, data->path) != 0)
continue;
if (data->interface && g_str_equal(iface,
data->interface) == FALSE)
if (data->interface && g_strcmp0(iface, data->interface) != 0)
continue;
if (data->member && g_str_equal(member, data->member) == FALSE)
if (data->member && g_strcmp0(member, data->member) != 0)
continue;
if (data->argument && g_str_equal(arg,
data->argument) == FALSE)
if (data->argument && g_strcmp0(arg, data->argument) != 0)
continue;
if (data->handle_func) {

View File

@@ -127,6 +127,18 @@ char print_buf[RIL_PRINT_BUF_SIZE] __attribute__((used));
static void ril_wakeup_writer(struct ril_s *ril);
gboolean g_ril_set_disconnect_function(GRil *ril,
GRilDisconnectFunc disconnect,
gpointer user_data)
{
if (ril == NULL)
return FALSE;
ril->parent->user_disconnect = disconnect;
ril->parent->user_disconnect_data = user_data;
return TRUE;
}
static void ril_notify_node_destroy(gpointer data, gpointer user_data)
{
struct ril_notify_node *node = data;
@@ -244,10 +256,6 @@ static struct ril_request *ril_request_create(struct ril_s *ril,
if (r == NULL)
return 0;
DBG("req: %s, id: %d, data_len: %d",
ril_request_id_to_string(req), id, (int) data_len);
/* RIL request: 8 byte header + data */
len = 8 + data_len;
@@ -352,9 +360,6 @@ static void handle_response(struct ril_s *p, struct ril_msg *message)
for (i = 0; i < count; i++) {
req = g_queue_peek_nth(p->command_queue, i);
DBG("comparing req->id: %d to message->serial_no: %d",
req->id, message->serial_no);
if (req->id == message->serial_no) {
found = TRUE;
message->req = req->req;
@@ -369,15 +374,12 @@ static void handle_response(struct ril_s *p, struct ril_msg *message)
req = g_queue_pop_nth(p->command_queue, i);
if (req->callback) {
DBG("req->callback");
req->callback(message, req->user_data);
}
len = g_queue_get_length(p->out_queue);
DBG("requests in sent queue before removing:%d", len);
for (i = 0; i < len; i++) {
id = *(guint *) g_queue_peek_nth(p->out_queue, i);
DBG("peeked id:%d", id);
if (id == req->id) {
g_queue_pop_nth(p->out_queue, i);
break;
@@ -386,7 +388,8 @@ static void handle_response(struct ril_s *p, struct ril_msg *message)
ril_request_destroy(req);
if (g_queue_peek_head(p->command_queue))
if (g_queue_get_length(p->command_queue)
> g_queue_get_length(p->out_queue))
ril_wakeup_writer(p);
break;
@@ -576,13 +579,10 @@ static void new_bytes(struct ring_buffer *rbuf, gpointer user_data)
p->in_read_handler = TRUE;
DBG("len: %d, wrap: %d", len, wrap);
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) {
DBG("Not enough bytes for header length: len: %d", len);
return;
}
@@ -596,7 +596,6 @@ static void new_bytes(struct ring_buffer *rbuf, gpointer user_data)
/* wait for the rest of the record... */
if (message == NULL) {
DBG("Not enough bytes for fixed record");
break;
}
@@ -692,7 +691,6 @@ out:
len = req->data_len;
towrite = len - ril->req_bytes_written;
DBG("req:%d,len:%d,towrite:%d", req->id, len, towrite);
#ifdef WRITE_SCHEDULER_DEBUG
if (towrite > 5)
towrite = 5;
@@ -711,6 +709,10 @@ out:
else
ril->req_bytes_written = 0;
if (g_queue_get_length(ril->command_queue)
> g_queue_get_length(ril->out_queue))
return TRUE;
return FALSE;
}
@@ -906,8 +908,7 @@ static struct ril_s *create_ril()
return ril;
error:
ofono_error("Exiting...");
exit(EXIT_FAILURE);
return NULL;
}
static struct ril_notify *ril_notify_create(struct ril_s *ril,
@@ -1005,8 +1006,6 @@ static guint ril_register(struct ril_s *ril, guint group,
if ((req == RIL_UNSOL_RIL_CONNECTED) && (ril->connected == TRUE)) {
/* fire the callback in a timer, as it won't ever fire */
DBG("CONNECTED already received... ");
message.req = RIL_UNSOL_RIL_CONNECTED;
message.unsolicited = TRUE;
message.buf_len = 0;
@@ -1143,7 +1142,6 @@ guint g_ril_send(GRil *ril, const guint reqid, const char *data,
const gsize data_len, GRilResponseFunc func,
gpointer user_data, GDestroyNotify notify)
{
DBG("enter");
struct ril_request *r;
struct ril_s *p;
@@ -1165,9 +1163,7 @@ guint g_ril_send(GRil *ril, const guint reqid, const char *data,
g_queue_push_tail(p->command_queue, r);
DBG("calling wakeup_writer: qlen: %d", g_queue_get_length(p->command_queue));
ril_wakeup_writer(p);
DBG("exit");
return r->id;
}

View File

@@ -281,6 +281,15 @@ gboolean g_ril_io_set_write_handler(GRilIO *io, GRilIOWriteFunc write_handler,
if (io == NULL)
return FALSE;
if (io->write_watch > 0) {
if (write_handler == NULL) {
g_source_remove(io->write_watch);
return TRUE;
}
return FALSE;
}
if (write_handler == NULL)
return FALSE;

View File

@@ -1,6 +1,7 @@
/*
* Copyright (C) 2011 Joel Armstrong <jcarmst@sandia.gov>
* Copyright (C) 2012 Canonical Ltd.
* Copyright (C) 2013 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (`GPL') as published by
@@ -32,8 +33,6 @@
#include <glib.h>
#include <ofono/log.h>
/* Parcel-handling code */
#include <sys/types.h>
#include <string.h>
@@ -82,9 +81,6 @@ int parcel_w_int32(struct parcel *p, int32_t val)
{
for (;;) {
DBG("parcel_w_int32(%d): offset = %d, cap = %d, size = %d\n",
val, p->offset, p->capacity, p->size);
if (p->offset + sizeof(int32_t) < p->capacity) {
/* There's enough space */
*((int32_t *) (p->data + p->offset)) = val;
@@ -99,6 +95,23 @@ int parcel_w_int32(struct parcel *p, int32_t val)
return 0;
}
int parcel_w_byte(struct parcel *p, const char val)
{
for (;;) {
if (p->offset + sizeof(char) < p->capacity) {
/* There's enough space */
*((char *) (p->data + p->offset)) = val;
p->offset += sizeof(char);
p->size += sizeof(char);
break;
} else {
/* Grow data and retry */
parcel_grow(p, sizeof(int32_t));
}
}
return 0;
}
int parcel_w_string(struct parcel *p, char *str)
{
gunichar2 *gs16;
@@ -122,8 +135,6 @@ int parcel_w_string(struct parcel *p, char *str)
for (;;) {
size_t padded = PAD_SIZE(len);
DBG("parcel_w_string(\"%s\"): len %d offset %d, cap %d, size %d",
str, len, p->offset, p->capacity, p->size);
if (p->offset + len < p->capacity) {
/* There's enough space */
memcpy(p->data + p->offset, gs16, gs16_size);
@@ -132,9 +143,6 @@ int parcel_w_string(struct parcel *p, char *str)
p->size += padded;
if (padded != len) {
DBG("Writing %d bytes, padded to %d\n",
len, padded);
#if BYTE_ORDER == BIG_ENDIAN
static const uint32_t mask[4] = {
0x00000000, 0xffffff00,

View File

@@ -1,5 +1,6 @@
/*
* Copyright © 2011 Joel Armstrong <jcarmst@sandia.gov>
* Copyright © 2013 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (`GPL') as published by
@@ -36,6 +37,7 @@ void parcel_grow(struct parcel *p, size_t size);
void parcel_free(struct parcel *p);
int32_t parcel_r_int32(struct parcel *p);
int parcel_w_int32(struct parcel *p, int32_t val);
int parcel_w_byte(struct parcel *p, const char val);
int parcel_w_string(struct parcel *p, char *str);
char *parcel_r_string(struct parcel *p);
size_t parcel_data_avail(struct parcel *p);

View File

@@ -7,9 +7,9 @@
#
# current lte configuration possibilities
# - none ( leave lines commented out ). LTE is not supported
# - 4Gon LTE is supported
# - 4gOn LTE is supported
#[sub]
#sub=SUB1
#[4Gon]
#[4gOn]

View File

@@ -3,6 +3,7 @@
* oFono - Open Telephony stack for Linux
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
* Copyright (C) 2013 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
@@ -60,6 +61,8 @@ extern "C" {
#define OFONO_GNSS_POSR_AGENT_INTERFACE "org.ofono.PositioningRequestAgent"
#define OFONO_HANDSFREE_INTERFACE OFONO_SERVICE ".Handsfree"
#define OFONO_NETWORK_TIME_INTERFACE OFONO_SERVICE ".NetworkTime"
#define OFONO_OEM_RAW_INTERFACE "org.ofono.OemRaw"
#define OFONO_SIRI_INTERFACE OFONO_SERVICE ".Siri"
/* CDMA Interfaces */
#define OFONO_CDMA_VOICECALL_MANAGER_INTERFACE "org.ofono.cdma.VoiceCallManager"

77
ofono/include/oemraw.h Normal file
View File

@@ -0,0 +1,77 @@
/*
*
* oFono - Open Source Telephony
*
* Copyright (C) 2013 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __OFONO_OEM_RAW_H
#define __OFONO_OEM_RAW_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <dbus/dbus.h>
#include <ofono/types.h>
struct ofono_oem_raw;
/* Request response from driver to core */
struct ofono_oem_raw_results {
char *data;
int length;
};
/* Request details from core to driver */
struct ofono_oem_raw_request {
char *data;
int length; /* Number of bytes in data */
DBusMessage *pending;
};
typedef void (*ofono_oem_raw_query_cb_t)(const struct ofono_error *error,
const struct ofono_oem_raw_results *results, void *data);
struct ofono_oem_raw_driver {
const char *name;
int (*probe)(struct ofono_oem_raw *raw,
unsigned int vendor,
void *data);
void (*remove)(struct ofono_oem_raw *raw);
void (*request)(struct ofono_oem_raw *raw,
const struct ofono_oem_raw_request *request,
ofono_oem_raw_query_cb_t cb,
void *data);
};
struct ofono_oem_raw *ofono_oem_raw_create(struct ofono_modem *modem,
unsigned int vendor,
const char *driver,
void *data);
void ofono_oem_raw_dbus_register(struct ofono_oem_raw *raw);
void ofono_oem_raw_remove(struct ofono_oem_raw *raw);
int ofono_oem_raw_driver_register(struct ofono_oem_raw_driver *driver);
void ofono_oem_raw_driver_unregister(struct ofono_oem_raw_driver *driver);
void *ofono_oem_raw_get_data(struct ofono_oem_raw *raw);
void ofono_oem_raw_set_data(struct ofono_oem_raw *raw, void *cid);
#ifdef __cplusplus
}
#endif
#endif /* __OFONO_OEM_RAW_H */

63
ofono/include/siri.h Normal file
View File

@@ -0,0 +1,63 @@
/*
*
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2013 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __OFONO_SIRI_H
#define __OFONO_SIRI_H
#ifdef __cplusplus
extern "C" {
#endif
#include <ofono/types.h>
struct ofono_siri;
typedef void (*ofono_siri_cb_t)(const struct ofono_error *error,
struct ofono_siri *siri);
struct ofono_siri_driver {
const char *name;
int (*probe)(struct ofono_siri *siri, unsigned int vendor, void *data);
void (*remove)(struct ofono_siri *siri);
void (*set_eyes_free_mode) (struct ofono_siri *siri, ofono_siri_cb_t cb,
unsigned int val);
};
void ofono_siri_set_status(struct ofono_siri *siri, int value);
int ofono_siri_driver_register(const struct ofono_siri_driver *driver);
void ofono_siri_driver_unregister(const struct ofono_siri_driver *driver);
struct ofono_siri *ofono_siri_create(struct ofono_modem *modem,
unsigned int vendor,
const char *driver, void *data);
void ofono_siri_register(struct ofono_siri *siri);
void ofono_siri_remove(struct ofono_siri *siri);
void ofono_siri_set_data(struct ofono_siri *siri, void *data);
void *ofono_siri_get_data(struct ofono_siri *siri);
#ifdef __cplusplus
}
#endif
#endif /* __OFONO_SIRI_H */

377
ofono/plugins/he910.c Normal file
View File

@@ -0,0 +1,377 @@
/*
*
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <string.h>
#include <sys/socket.h>
#include <glib.h>
#include <gatchat.h>
#include <gattty.h>
#define OFONO_API_SUBJECT_TO_CHANGE
#include <ofono/plugin.h>
#include <ofono/log.h>
#include <ofono/modem.h>
#include <ofono/call-barring.h>
#include <ofono/call-forwarding.h>
#include <ofono/call-meter.h>
#include <ofono/call-settings.h>
#include <ofono/devinfo.h>
#include <ofono/message-waiting.h>
#include <ofono/netreg.h>
#include <ofono/phonebook.h>
#include <ofono/sim.h>
#include <ofono/gprs.h>
#include <ofono/gprs-context.h>
#include <ofono/sms.h>
#include <ofono/ussd.h>
#include <ofono/voicecall.h>
#include <drivers/atmodem/atutil.h>
#include <drivers/atmodem/vendor.h>
static const char *none_prefix[] = { NULL };
struct he910_data {
GAtChat *chat; /* AT chat */
GAtChat *modem; /* Data port */
struct ofono_sim *sim;
ofono_bool_t have_sim;
ofono_bool_t sms_phonebook_added;
};
static void he910_debug(const char *str, void *user_data)
{
const char *prefix = user_data;
ofono_info("%s%s", prefix, str);
}
static GAtChat *open_device(struct ofono_modem *modem,
const char *key, char *debug)
{
const char *device;
GAtSyntax *syntax;
GIOChannel *channel;
GAtChat *chat;
GHashTable *options;
device = ofono_modem_get_string(modem, key);
if (device == NULL)
return NULL;
DBG("%s %s", key, device);
options = g_hash_table_new(g_str_hash, g_str_equal);
if (options == NULL)
return NULL;
g_hash_table_insert(options, "Baud", "115200");
channel = g_at_tty_open(device, options);
g_hash_table_destroy(options);
if (channel == NULL)
return NULL;
syntax = g_at_syntax_new_gsmv1();
chat = g_at_chat_new(channel, syntax);
g_at_syntax_unref(syntax);
g_io_channel_unref(channel);
if (chat == NULL)
return NULL;
if (getenv("OFONO_AT_DEBUG"))
g_at_chat_set_debug(chat, he910_debug, debug);
return chat;
}
static void switch_sim_state_status(struct ofono_modem *modem, int status)
{
struct he910_data *data = ofono_modem_get_data(modem);
DBG("%p, SIM status: %d", modem, status);
switch (status) {
case 0: /* SIM not inserted */
if (data->have_sim == TRUE) {
ofono_sim_inserted_notify(data->sim, FALSE);
data->have_sim = FALSE;
data->sms_phonebook_added = FALSE;
}
break;
case 1: /* SIM inserted */
case 2: /* SIM inserted and PIN unlocked */
if (data->have_sim == FALSE) {
ofono_sim_inserted_notify(data->sim, TRUE);
data->have_sim = TRUE;
}
break;
case 3: /* SIM inserted, SMS and phonebook ready */
if (data->sms_phonebook_added == FALSE) {
ofono_phonebook_create(modem, 0, "atmodem", data->chat);
ofono_sms_create(modem, 0, "atmodem", data->chat);
data->sms_phonebook_added = TRUE;
}
break;
default:
ofono_warn("Unknown SIM state %d received", status);
break;
}
}
static void he910_qss_notify(GAtResult *result, gpointer user_data)
{
struct ofono_modem *modem = user_data;
int status;
GAtResultIter iter;
DBG("%p", modem);
g_at_result_iter_init(&iter, result);
if (!g_at_result_iter_next(&iter, "#QSS:"))
return;
g_at_result_iter_next_number(&iter, &status);
switch_sim_state_status(modem, status);
}
static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_modem *modem = user_data;
struct he910_data *data = ofono_modem_get_data(modem);
DBG("%p", modem);
if (!ok) {
g_at_chat_unref(data->chat);
data->chat = NULL;
g_at_chat_unref(data->modem);
data->modem = NULL;
ofono_modem_set_powered(modem, FALSE);
return;
}
/*
* Switch data carrier detect signal off.
* When the DCD is disabled the modem does not hangup anymore
* after the data connection.
*/
g_at_chat_send(data->chat, "AT&C0", NULL, NULL, NULL, NULL);
data->have_sim = FALSE;
data->sms_phonebook_added = FALSE;
ofono_modem_set_powered(modem, TRUE);
/*
* Tell the modem not to automatically initiate auto-attach
* proceedures on its own.
*/
g_at_chat_send(data->chat, "AT#AUTOATT=0", none_prefix,
NULL, NULL, NULL);
}
static int he910_enable(struct ofono_modem *modem)
{
struct he910_data *data = ofono_modem_get_data(modem);
DBG("%p", modem);
data->modem = open_device(modem, "Modem", "Modem: ");
if (data->modem == NULL)
return -EINVAL;
data->chat = open_device(modem, "Aux", "Aux: ");
if (data->chat == NULL) {
g_at_chat_unref(data->modem);
data->modem = NULL;
return -EIO;
}
g_at_chat_set_slave(data->modem, data->chat);
/*
* Disable command echo and
* enable the Extended Error Result Codes
*/
g_at_chat_send(data->chat, "ATE0 +CMEE=1", none_prefix,
NULL, NULL, NULL);
/* Follow sim state */
g_at_chat_register(data->chat, "#QSS:", he910_qss_notify,
FALSE, modem, NULL);
/* Enable sim state notification */
g_at_chat_send(data->chat, "AT#QSS=2", none_prefix, NULL, NULL, NULL);
/* Set phone functionality */
g_at_chat_send(data->chat, "AT+CFUN=1", none_prefix,
cfun_enable_cb, modem, NULL);
return -EINPROGRESS;
}
static void cfun_disable_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_modem *modem = user_data;
struct he910_data *data = ofono_modem_get_data(modem);
DBG("%p", modem);
g_at_chat_unref(data->chat);
data->chat = NULL;
if (ok)
ofono_modem_set_powered(modem, FALSE);
}
static int he910_disable(struct ofono_modem *modem)
{
struct he910_data *data = ofono_modem_get_data(modem);
DBG("%p", modem);
g_at_chat_cancel_all(data->modem);
g_at_chat_unregister_all(data->modem);
g_at_chat_unref(data->modem);
data->modem = NULL;
g_at_chat_cancel_all(data->chat);
g_at_chat_unregister_all(data->chat);
/* Power down modem */
g_at_chat_send(data->chat, "AT+CFUN=4", none_prefix,
cfun_disable_cb, modem, NULL);
return -EINPROGRESS;
}
static void he910_pre_sim(struct ofono_modem *modem)
{
struct he910_data *data = ofono_modem_get_data(modem);
DBG("%p", modem);
ofono_devinfo_create(modem, 0, "atmodem", data->chat);
data->sim = ofono_sim_create(modem, OFONO_VENDOR_TELIT, "atmodem",
data->chat);
}
static void he910_post_online(struct ofono_modem *modem)
{
struct he910_data *data = ofono_modem_get_data(modem);
struct ofono_message_waiting *mw;
struct ofono_gprs *gprs;
struct ofono_gprs_context *gc;
DBG("%p", modem);
ofono_voicecall_create(modem, 0, "atmodem", data->chat);
ofono_netreg_create(modem, OFONO_VENDOR_TELIT, "atmodem", data->chat);
ofono_ussd_create(modem, 0, "atmodem", data->chat);
ofono_call_forwarding_create(modem, 0, "atmodem", data->chat);
ofono_call_settings_create(modem, 0, "atmodem", data->chat);
ofono_call_meter_create(modem, 0, "atmodem", data->chat);
ofono_call_barring_create(modem, 0, "atmodem", data->chat);
mw = ofono_message_waiting_create(modem);
if (mw)
ofono_message_waiting_register(mw);
gprs = ofono_gprs_create(modem, OFONO_VENDOR_TELIT, "atmodem",
data->chat);
gc = ofono_gprs_context_create(modem, 0, "atmodem", data->modem);
if (gprs && gc)
ofono_gprs_add_context(gprs, gc);
}
static int he910_probe(struct ofono_modem *modem)
{
struct he910_data *data;
DBG("%p", modem);
data = g_try_new0(struct he910_data, 1);
if (data == NULL)
return -ENOMEM;
ofono_modem_set_data(modem, data);
return 0;
}
static void he910_remove(struct ofono_modem *modem)
{
struct he910_data *data = ofono_modem_get_data(modem);
DBG("%p", modem);
ofono_modem_set_data(modem, NULL);
/* Cleanup after hot-unplug */
g_at_chat_unref(data->chat);
g_at_chat_unref(data->modem);
g_free(data);
}
static struct ofono_modem_driver he910_driver = {
.name = "he910",
.probe = he910_probe,
.remove = he910_remove,
.enable = he910_enable,
.disable = he910_disable,
.pre_sim = he910_pre_sim,
.post_online = he910_post_online,
};
static int he910_init(void)
{
DBG("");
return ofono_modem_driver_register(&he910_driver);
}
static void he910_exit(void)
{
ofono_modem_driver_unregister(&he910_driver);
}
OFONO_PLUGIN_DEFINE(he910, "Telit HE910 driver", VERSION,
OFONO_PLUGIN_PRIORITY_DEFAULT, he910_init, he910_exit)

View File

@@ -268,6 +268,41 @@ static void sim_watch(struct ofono_atom *atom,
sim_state_watch(ofono_sim_get_state(sim), modem);
}
static void voicecall_watch(struct ofono_atom *atom,
enum ofono_atom_watch_condition cond,
void *data)
{
struct ofono_atom *sim_atom;
struct ofono_sim *sim;
struct ofono_modem *modem;
DBusConnection *conn = ofono_dbus_get_connection();
if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED)
return;
/*
* This logic is only intended to handle voicecall atoms
* registered in post_sim state or later
*/
modem = __ofono_atom_get_modem(atom);
sim_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SIM);
if (sim_atom == NULL)
return;
sim = __ofono_atom_get_data(sim_atom);
if (ofono_sim_get_state(sim) != OFONO_SIM_STATE_READY)
return;
modems = g_list_append(modems, modem);
if (modems->next != NULL)
return;
bt_register_profile(conn, HFP_AG_UUID, HFP_VERSION_1_5, "hfp_ag",
HFP_AG_EXT_PROFILE_PATH, NULL, 0);
}
static void modem_watch(struct ofono_modem *modem, gboolean added, void *user)
{
DBG("modem: %p, added: %d", modem, added);
@@ -277,6 +312,8 @@ static void modem_watch(struct ofono_modem *modem, gboolean added, void *user)
__ofono_modem_add_atom_watch(modem, OFONO_ATOM_TYPE_SIM,
sim_watch, modem, NULL);
__ofono_modem_add_atom_watch(modem, OFONO_ATOM_TYPE_VOICECALL,
voicecall_watch, modem, NULL);
}
static void call_modemwatch(struct ofono_modem *modem, void *user)

View File

@@ -44,6 +44,7 @@
#include <ofono/voicecall.h>
#include <ofono/call-volume.h>
#include <ofono/handsfree.h>
#include <ofono/siri.h>
#include <drivers/hfpmodem/slc.h>
@@ -490,6 +491,7 @@ static void hfp_pre_sim(struct ofono_modem *modem)
ofono_netreg_create(modem, 0, "hfpmodem", &data->info);
ofono_call_volume_create(modem, 0, "hfpmodem", &data->info);
ofono_handsfree_create(modem, 0, "hfpmodem", &data->info);
ofono_siri_create(modem, 0, "hfpmodem", &data->info);
}
static void hfp_post_sim(struct ofono_modem *modem)

View File

@@ -48,6 +48,7 @@
#include <ofono/call-volume.h>
#include <ofono/handsfree.h>
#include <ofono/handsfree-audio.h>
#include <ofono/siri.h>
#include <drivers/atmodem/atutil.h>
#include <drivers/hfpmodem/slc.h>
@@ -296,6 +297,7 @@ static void hfp_pre_sim(struct ofono_modem *modem)
ofono_netreg_create(modem, 0, "hfpmodem", &hfp->info);
ofono_handsfree_create(modem, 0, "hfpmodem", &hfp->info);
ofono_call_volume_create(modem, 0, "hfpmodem", &hfp->info);
ofono_siri_create(modem, 0, "hfpmodem", &hfp->info);
}
static void hfp_post_sim(struct ofono_modem *modem)

View File

@@ -174,6 +174,12 @@ static void apn_start(GMarkupParseContext *context, const gchar *element_name,
else if (g_str_equal(element_name, "password"))
g_markup_parse_context_push(context, &text_parser,
&apn->password);
else if (g_str_equal(element_name, "mmsc"))
g_markup_parse_context_push(context, &text_parser,
&apn->message_center);
else if (g_str_equal(element_name, "mmsproxy"))
g_markup_parse_context_push(context, &text_parser,
&apn->message_proxy);
else if (g_str_equal(element_name, "usage"))
usage_start(context, attribute_names, attribute_values,
&apn->type, error);

View File

@@ -60,6 +60,7 @@
#include <ofono/gprs-context.h>
#include <ofono/gnss.h>
#include <ofono/handsfree.h>
#include <ofono/siri.h>
#include <drivers/atmodem/vendor.h>
#include <drivers/atmodem/atutil.h>
@@ -957,6 +958,7 @@ static void localhfp_pre_sim(struct ofono_modem *modem)
ofono_netreg_create(modem, 0, "hfpmodem", info);
ofono_call_volume_create(modem, 0, "hfpmodem", info);
ofono_handsfree_create(modem, 0, "hfpmodem", info);
ofono_siri_create(modem, 0, "hfpmodem", info);
}
static struct ofono_modem_driver localhfp_driver = {

View File

@@ -115,6 +115,7 @@ static int provision_get_settings(const char *mcc, const char *mnc,
} else {
mbpi_ap_free(ap);
}
}
g_slist_free(apns);

View File

@@ -33,6 +33,11 @@
#include <gril.h>
#include <parcel.h>
#include <gdbus.h>
#include <linux/capability.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/prctl.h>
#define OFONO_API_SUBJECT_TO_CHANGE
#include <ofono/plugin.h>
@@ -57,11 +62,14 @@
#include <ofono/audio-settings.h>
#include <ofono/types.h>
#include <ofono/message-waiting.h>
#include <ofono/oemraw.h>
#include "drivers/rilmodem/rilmodem.h"
#define MAX_POWER_ON_RETRIES 5
#define MAX_SIM_STATUS_RETRIES 15
#define RADIO_ID 1001
#define MAX_PDP_CONTEXTS 2
struct ril_data {
GRil *modem;
@@ -90,6 +98,9 @@ static guint mce_daemon_watch;
static guint signal_watch;
static DBusConnection *connection;
static int ril_init(void);
guint reconnect_timer;
static int send_get_sim_status(struct ofono_modem *modem);
static void ril_debug(const char *str, void *user_data)
@@ -207,6 +218,9 @@ static void ril_remove(struct ofono_modem *modem)
if (ril->timer_id > 0)
g_source_remove(ril->timer_id);
if (reconnect_timer > 0)
g_source_remove(ril->timer_id);
g_ril_unref(ril->modem);
g_free(ril);
@@ -231,18 +245,22 @@ static void ril_post_sim(struct ofono_modem *modem)
struct ofono_gprs *gprs;
struct ofono_gprs_context *gc;
struct ofono_message_waiting *mw;
int i;
/* TODO: this function should setup:
* - stk ( SIM toolkit )
*/
ofono_sms_create(modem, 0, "rilmodem", ril->modem);
gprs = ofono_gprs_create(modem, 0, "rilmodem", ril->modem);
gc = ofono_gprs_context_create(modem, 0, "rilmodem", ril->modem);
if (gprs && gc) {
DBG("calling gprs_add_context");
ofono_gprs_add_context(gprs, gc);
if (gprs) {
for (i = 0; i < MAX_PDP_CONTEXTS; i++) {
gc = ofono_gprs_context_create(modem, 0, "rilmodem",
ril->modem);
if (gc == NULL)
break;
ofono_gprs_add_context(gprs, gc);
}
}
ofono_radio_settings_create(modem, 0, "rilmodem", ril->modem);
@@ -265,6 +283,7 @@ static void ril_post_online(struct ofono_modem *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);
}
static void ril_set_online_cb(struct ril_msg *message, gpointer user_data)
@@ -390,6 +409,52 @@ static void ril_connected(struct ril_msg *message, gpointer user_data)
mce_connect, mce_disconnect, modem, NULL);
}
static gboolean ril_re_init(gpointer user_data)
{
ril_init();
return FALSE;
}
static void gril_disconnected(gpointer user_data)
{
/* Signal clients modem going down */
struct ofono_modem *modem = user_data;
DBusConnection *conn = ofono_dbus_get_connection();
if (modem) {
ofono_modem_remove(modem);
mce_disconnect(conn, user_data);
reconnect_timer = g_timeout_add_seconds(2, ril_re_init, NULL);
}
}
void ril_switchUser()
{
if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) < 0)
ofono_error("prctl(PR_SET_KEEPCAPS) failed:%s,%d",
strerror(errno), errno);
if (setgid(RADIO_ID) < 0 )
ofono_error("setgid(%d) failed:%s,%d",
RADIO_ID, strerror(errno), errno);
if (setuid(RADIO_ID) < 0 )
ofono_error("setuid(%d) failed:%s,%d",
RADIO_ID, strerror(errno), errno);
struct __user_cap_header_struct header;
struct __user_cap_data_struct cap;
header.version = _LINUX_CAPABILITY_VERSION;
header.pid = 0;
cap.effective = cap.permitted = (1 << CAP_NET_ADMIN)
| (1 << CAP_NET_RAW);
cap.inheritable = 0;
if (syscall(SYS_capset, &header, &cap) < 0)
ofono_error("syscall(SYS_capset) failed:%s,%d",
strerror(errno), errno);
}
static int ril_enable(struct ofono_modem *modem)
{
DBG("enter");
@@ -397,7 +462,11 @@ static int ril_enable(struct ofono_modem *modem)
ril->have_sim = FALSE;
/* RIL expects user radio */
ril_switchUser();
ril->modem = g_ril_new();
g_ril_set_disconnect_function(ril->modem, gril_disconnected, modem);
/* NOTE: Since AT modems open a tty, and then call
* g_at_chat_new(), they're able to return -EIO if
@@ -409,6 +478,7 @@ static int ril_enable(struct ofono_modem *modem)
if (ril->modem == NULL) {
DBG("g_ril_new() failed to create modem!");
gril_disconnected(modem);
return -EIO;
}
@@ -497,7 +567,7 @@ static int ril_init(void)
*
* args are name (optional) & type
*/
modem = ofono_modem_create(NULL, "ril");
modem = ofono_modem_create("ril_0", "ril");
if (modem == NULL) {
DBG("ofono_modem_create failed for ril");
return -ENODEV;
@@ -522,6 +592,8 @@ static int ril_init(void)
*/
ofono_modem_reset(modem);
reconnect_timer = 0;
return retval;
}

View File

@@ -634,6 +634,38 @@ static gboolean setup_telit(struct modem_info *modem)
return TRUE;
}
static gboolean setup_he910(struct modem_info *modem)
{
const char *mdm = NULL, *aux = NULL;
GSList *list;
DBG("%s", modem->syspath);
for (list = modem->devices; list; list = list->next) {
struct device_info *info = list->data;
DBG("%s %s %s %s", info->devnode, info->interface,
info->number, info->label);
if (g_strcmp0(info->interface, "2/2/1") == 0) {
if (g_strcmp0(info->number, "00") == 0)
mdm = info->devnode;
else if (g_strcmp0(info->number, "06") == 0)
aux = info->devnode;
}
}
if (aux == NULL || mdm == NULL)
return FALSE;
DBG("modem=%s aux=%s", mdm, aux);
ofono_modem_set_string(modem->modem, "Modem", mdm);
ofono_modem_set_string(modem->modem, "Aux", aux);
return TRUE;
}
static gboolean setup_simcom(struct modem_info *modem)
{
const char *mdm = NULL, *aux = NULL, *gps = NULL, *diag = NULL;
@@ -778,6 +810,7 @@ static struct {
{ "novatel", setup_novatel },
{ "nokia", setup_nokia },
{ "telit", setup_telit },
{ "he910", setup_he910 },
{ "simcom", setup_simcom },
{ "zte", setup_zte },
{ "icera", setup_icera },
@@ -988,6 +1021,7 @@ static struct {
{ "simcom", "option", "05c6", "9000" },
{ "telit", "usbserial", "1bc7" },
{ "telit", "option", "1bc7" },
{ "he910", "cdc_acm", "1bc7", "0021" },
{ "nokia", "option", "0421", "060e" },
{ "nokia", "option", "0421", "0623" },
{ "samsung", "option", "04e8", "6889" },

265
ofono/src/oemraw.c Normal file
View File

@@ -0,0 +1,265 @@
/*
*
* oFono - Open Source Telephony
*
* Copyright (C) 2013 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#define _GNU_SOURCE
#include <errno.h>
#include <glib.h>
#include <gdbus.h>
#include <dbus/dbus.h>
#include "ofono.h"
#include "common.h"
#include "ofono/oemraw.h"
static GSList *g_drivers;
struct ofono_oem_raw {
struct ofono_atom *atom;
const struct ofono_oem_raw_driver *driver;
void *driver_data;
};
static void ofono_oem_raw_query_cb(const struct ofono_error *error,
const struct ofono_oem_raw_results *res, void *data)
{
char *ptr;
char byte;
int i;
DBusMessage *reply;
DBusMessageIter iter;
DBusMessageIter subiter;
struct ofono_oem_raw_request *req = data;
if (error && error->type == OFONO_ERROR_TYPE_NO_ERROR) {
reply = dbus_message_new_method_return(req->pending);
} else {
/*
* Log error messages in driver when completing a request,
* logging here provides no extra information.
*/
goto error;
}
dbus_message_iter_init_append(reply, &iter);
if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
"y", &subiter)) {
DBG("Failed to open a dbus iterator");
goto error;
}
ptr = (char *)res->data;
for (i = 0; i < res->length; i++) {
byte = ptr[i];
dbus_message_iter_append_basic(&subiter, DBUS_TYPE_BYTE,
&byte);
}
dbus_message_iter_close_container(&iter, &subiter);
goto end;
error:
reply = __ofono_error_failed(req->pending);
end:
__ofono_dbus_pending_reply(&req->pending, reply);
g_free(req);
return;
}
static DBusMessage *oem_raw_make_request(DBusConnection *conn,
DBusMessage *msg, void *data)
{
char *array; /* Byte array containing client request*/
int array_len; /* Length of request byte array */
DBusMessageIter iter;
DBusMessageIter subiter;
struct ofono_oem_raw_request *req;
struct ofono_oem_raw *raw;
raw = data;
req = 0;
if (raw && raw->driver->request == NULL)
return __ofono_error_not_implemented(msg);
dbus_message_iter_init(msg, &iter);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY)
goto error_arg;
if (dbus_message_iter_get_element_type(&iter) != DBUS_TYPE_BYTE) {
DBG("Ignoring request because dbus request element type=%c",
dbus_message_iter_get_element_type(&iter));
goto error_arg;
}
dbus_message_iter_recurse(&iter, &subiter);
dbus_message_iter_get_fixed_array(&subiter, &array, &array_len);
req = g_new0(struct ofono_oem_raw_request, 1);
req->data = array;
req->length = array_len;
/* Store msg to request struct to allow multiple parallel requests */
req->pending = dbus_message_ref(msg);
raw->driver->request(raw, req, ofono_oem_raw_query_cb, req);
return NULL;
error_arg:
DBG("DBus arg type=%c, msg signature: %s",
dbus_message_iter_get_arg_type(&iter),
dbus_message_get_signature(msg));
return __ofono_error_invalid_args(msg);
}
static const GDBusMethodTable oem_raw_methods[] = {
{ GDBUS_ASYNC_METHOD("Send",
GDBUS_ARGS({ "req", "ay" }),
GDBUS_ARGS({ "response", "ay"}),
oem_raw_make_request) },
{ }
};
static const GDBusSignalTable oem_raw_signals[] = {
{ }
};
static void oem_raw_dbus_unregister(struct ofono_atom *atom)
{
DBG("");
struct ofono_oem_raw *oemraw = __ofono_atom_get_data(atom);
const char *path = __ofono_atom_get_path(oemraw->atom);
DBusConnection *conn = ofono_dbus_get_connection();
struct ofono_modem *modem = __ofono_atom_get_modem(oemraw->atom);
ofono_modem_remove_interface(modem, OFONO_OEM_RAW_INTERFACE);
if (!g_dbus_unregister_interface(conn, path, OFONO_OEM_RAW_INTERFACE))
ofono_error("Failed to unregister interface %s",
OFONO_OEM_RAW_INTERFACE);
}
void ofono_oem_raw_dbus_register(struct ofono_oem_raw *oemraw)
{
DBusConnection *conn;
DBG("");
conn = ofono_dbus_get_connection();
struct ofono_modem *modem = __ofono_atom_get_modem(oemraw->atom);
const char *path = __ofono_atom_get_path(oemraw->atom);
if (!g_dbus_register_interface(conn, path,
OFONO_OEM_RAW_INTERFACE,
oem_raw_methods,
oem_raw_signals,
NULL, oemraw, NULL)) {
ofono_error("Could not create interface %s",
OFONO_OEM_RAW_INTERFACE);
return;
}
ofono_modem_add_interface(modem, OFONO_OEM_RAW_INTERFACE);
__ofono_atom_register(oemraw->atom, oem_raw_dbus_unregister);
}
int ofono_oem_raw_driver_register(struct ofono_oem_raw_driver *driver)
{
if (driver->probe == NULL)
return -EINVAL;
g_drivers = g_slist_prepend(g_drivers, (void *) driver);
return 0;
}
void ofono_oem_raw_driver_unregister(struct ofono_oem_raw_driver *driver)
{
g_drivers = g_slist_remove(g_drivers, (void *) driver);
}
void ofono_oem_raw_remove(struct ofono_oem_raw *oemraw)
{
__ofono_atom_free(oemraw->atom);
}
void *ofono_oem_raw_get_data(struct ofono_oem_raw *raw)
{
return raw->driver_data;
}
void ofono_oem_raw_set_data(struct ofono_oem_raw *raw, void *cid)
{
raw->driver_data = cid;
}
static void oem_raw_remove(struct ofono_atom *atom)
{
struct ofono_oem_raw *oemraw = __ofono_atom_get_data(atom);
if (oemraw == NULL)
return;
if (oemraw->driver && oemraw->driver->remove)
oemraw->driver->remove(oemraw);
g_free(oemraw);
}
struct ofono_oem_raw *ofono_oem_raw_create(struct ofono_modem *modem,
unsigned int vendor,
const char *driver,
void *data)
{
struct ofono_oem_raw *oemraw = 0;
GSList *l;
if (driver == NULL)
return NULL;
oemraw = g_try_new0(struct ofono_oem_raw, 1);
if (oemraw == NULL)
return NULL;
oemraw->atom = __ofono_modem_add_atom(modem,
OFONO_ATOM_TYPE_OEM_RAW,
oem_raw_remove, oemraw);
for (l = g_drivers; l; l = l->next) {
const struct ofono_oem_raw_driver *drv = l->data;
if (g_strcmp0(drv->name, driver))
continue;
if (drv->probe(oemraw, vendor, data) < 0)
continue;
oemraw->driver = drv;
break;
}
return oemraw;
}

View File

@@ -151,6 +151,8 @@ enum ofono_atom_type {
OFONO_ATOM_TYPE_CDMA_SMS,
OFONO_ATOM_TYPE_CDMA_NETREG,
OFONO_ATOM_TYPE_HANDSFREE,
OFONO_ATOM_TYPE_OEM_RAW,
OFONO_ATOM_TYPE_SIRI,
};
enum ofono_atom_watch_condition {

View File

@@ -5,7 +5,7 @@ After=syslog.target
[Service]
Type=dbus
BusName=org.ofono
User=radio
User=root
EnvironmentFile=-/var/lib/environment/ofono/*.conf
ExecStart=@prefix@/sbin/ofonod -n $OFONO_ARGS
StandardError=null

333
ofono/src/siri.c Normal file
View File

@@ -0,0 +1,333 @@
/*
*
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2013 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <glib.h>
#include <ofono/log.h>
#include <ofono/modem.h>
#include <ofono/siri.h>
#include <gdbus.h>
#include "ofono.h"
#include "common.h"
static GSList *g_drivers = NULL;
struct ofono_siri {
ofono_bool_t siri_status;
unsigned int eyes_free_mode;
unsigned int pending_eyes_free_mode;
const struct ofono_siri_driver *driver;
void *driver_data;
struct ofono_atom *atom;
DBusMessage *pending;
};
void ofono_siri_set_status(struct ofono_siri *siri, int value)
{
DBusConnection *conn = ofono_dbus_get_connection();
const char *path = __ofono_atom_get_path(siri->atom);
dbus_bool_t siri_status;
if (siri == NULL)
return;
if (value == 1)
siri->siri_status = TRUE;
else
siri->siri_status = FALSE;
siri_status = siri->siri_status;
if (__ofono_atom_get_registered(siri->atom) == FALSE)
return;
ofono_dbus_signal_property_changed(conn, path, OFONO_SIRI_INTERFACE,
"Enabled", DBUS_TYPE_BOOLEAN,
&siri_status);
}
static DBusMessage *siri_get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct ofono_siri *siri = data;
DBusMessage *reply;
DBusMessageIter iter;
DBusMessageIter dict;
dbus_bool_t status;
const char *eyes_free_str;
reply = dbus_message_new_method_return(msg);
if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
OFONO_PROPERTIES_ARRAY_SIGNATURE,
&dict);
status = siri->siri_status;
ofono_dbus_dict_append(&dict, "Enabled", DBUS_TYPE_BOOLEAN, &status);
if (siri->eyes_free_mode == 0)
eyes_free_str = "disabled";
else
eyes_free_str = "enabled";
ofono_dbus_dict_append(&dict, "EyesFreeMode", DBUS_TYPE_STRING,
&eyes_free_str);
dbus_message_iter_close_container(&iter, &dict);
return reply;
}
static void set_eyes_free_mode_callback(const struct ofono_error *error,
struct ofono_siri *siri)
{
DBusConnection *conn = ofono_dbus_get_connection();
const char *path = __ofono_atom_get_path(siri->atom);
DBusMessage *reply;
const char *eyes_free_str;
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
DBG("Set eyes free mode callback returned error %s",
telephony_error_to_str(error));
reply = __ofono_error_failed(siri->pending);
__ofono_dbus_pending_reply(&siri->pending, reply);
return;
}
siri->eyes_free_mode = siri->pending_eyes_free_mode;
if (siri->eyes_free_mode == 0)
eyes_free_str = "disabled";
else
eyes_free_str = "enabled";
reply = dbus_message_new_method_return(siri->pending);
__ofono_dbus_pending_reply(&siri->pending, reply);
ofono_dbus_signal_property_changed(conn, path, OFONO_SIRI_INTERFACE,
"EyesFreeMode",
DBUS_TYPE_STRING,
&eyes_free_str);
}
static DBusMessage *siri_set_property(DBusConnection *conn, DBusMessage *msg,
void *data)
{
struct ofono_siri *siri = data;
DBusMessageIter iter, var;
char *val;
const char *name;
if (siri->pending)
return __ofono_error_busy(msg);
if (dbus_message_iter_init(msg, &iter) == FALSE)
return __ofono_error_invalid_args(msg);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
return __ofono_error_invalid_args(msg);
dbus_message_iter_get_basic(&iter, &name);
dbus_message_iter_next(&iter);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
return __ofono_error_invalid_args(msg);
dbus_message_iter_recurse(&iter, &var);
if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_STRING)
return __ofono_error_invalid_args(msg);
dbus_message_iter_get_basic(&var, &val);
if (g_str_equal(name, "EyesFreeMode") == TRUE) {
if (!siri->driver->set_eyes_free_mode)
return __ofono_error_not_implemented(msg);
if (g_str_equal(val, "disabled") == TRUE)
siri->pending_eyes_free_mode = 0;
else if (g_str_equal(val, "enabled") == TRUE)
siri->pending_eyes_free_mode = 1;
else
return __ofono_error_invalid_args(msg);
siri->pending = dbus_message_ref(msg);
siri->driver->set_eyes_free_mode(siri,
set_eyes_free_mode_callback,
siri->pending_eyes_free_mode);
} else
return __ofono_error_invalid_args(msg);
return NULL;
}
static const GDBusMethodTable siri_methods[] = {
{ GDBUS_METHOD("GetProperties",
NULL, GDBUS_ARGS({ "properties", "a{sv}"}),
siri_get_properties) },
{ GDBUS_ASYNC_METHOD("SetProperty",
GDBUS_ARGS({ "property", "s" }, { "value", "v" }), NULL,
siri_set_property) },
{ }
};
static const GDBusSignalTable siri_signals[] = {
{ GDBUS_SIGNAL("PropertyChanged",
GDBUS_ARGS({ "name", "s"}, { "value", "v"})) },
{ }
};
static void siri_remove(struct ofono_atom *atom)
{
struct ofono_siri *siri = __ofono_atom_get_data(atom);
DBG("atom: %p", atom);
if (siri == NULL)
return;
if (siri->driver != NULL && siri->driver->remove != NULL)
siri->driver->remove(siri);
g_free(siri);
}
struct ofono_siri *ofono_siri_create(struct ofono_modem *modem,
unsigned int vendor, const char *driver, void *data)
{
struct ofono_siri *siri;
GSList *l;
if (driver == NULL)
return NULL;
siri = g_try_new0(struct ofono_siri, 1);
if (siri == NULL)
return NULL;
siri->atom = __ofono_modem_add_atom(modem, OFONO_ATOM_TYPE_SIRI,
siri_remove, siri);
siri->eyes_free_mode = 0;
siri->pending_eyes_free_mode = 0;
for (l = g_drivers; l; l = l->next) {
const struct ofono_siri_driver *drv = l->data;
if (g_strcmp0(drv->name, driver))
continue;
if (drv->probe(siri, vendor, data) < 0)
continue;
siri->driver = drv;
break;
}
return siri;
}
static void ofono_siri_unregister(struct ofono_atom *atom)
{
DBusConnection *conn = ofono_dbus_get_connection();
struct ofono_modem *modem = __ofono_atom_get_modem(atom);
const char *path = __ofono_atom_get_path(atom);
struct ofono_siri *siri = __ofono_atom_get_data(atom);
if (siri->pending) {
DBusMessage *reply = __ofono_error_failed(siri->pending);
__ofono_dbus_pending_reply(&siri->pending, reply);
}
ofono_modem_remove_interface(modem, OFONO_SIRI_INTERFACE);
g_dbus_unregister_interface(conn, path,
OFONO_SIRI_INTERFACE);
}
void ofono_siri_register(struct ofono_siri *siri)
{
DBusConnection *conn = ofono_dbus_get_connection();
struct ofono_modem *modem = __ofono_atom_get_modem(siri->atom);
const char *path = __ofono_atom_get_path(siri->atom);
if (!g_dbus_register_interface(conn, path, OFONO_SIRI_INTERFACE,
siri_methods, siri_signals, NULL,
siri, NULL)) {
ofono_error("Could not create %s interface",
OFONO_SIRI_INTERFACE);
return;
}
ofono_modem_add_interface(modem, OFONO_SIRI_INTERFACE);
__ofono_atom_register(siri->atom, ofono_siri_unregister);
}
int ofono_siri_driver_register(const struct ofono_siri_driver *driver)
{
DBG("driver: %p, name: %s", driver, driver->name);
if (driver->probe == NULL)
return -EINVAL;
g_drivers = g_slist_prepend(g_drivers, (void *) driver);
return 0;
}
void ofono_siri_driver_unregister(const struct ofono_siri_driver *driver)
{
DBG("driver: %p, name: %s", driver, driver->name);
g_drivers = g_slist_remove(g_drivers, (void *) driver);
}
void ofono_siri_remove(struct ofono_siri *siri)
{
__ofono_atom_free(siri->atom);
}
void ofono_siri_set_data(struct ofono_siri *siri, void *data)
{
siri->driver_data = data;
}
void *ofono_siri_get_data(struct ofono_siri *siri)
{
return siri->driver_data;
}

View File

@@ -29,6 +29,8 @@
#include <stdlib.h>
#include <string.h>
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <glib.h>
#include <glib/gprintf.h>

View File

@@ -30,6 +30,8 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <glib.h>
#include <glib/gprintf.h>

View File

@@ -1,3 +1,6 @@
* Thu Jan 09 2014 Martti Piirainen <martti.piirainen@oss.tieto.com> - 1.14
- Update to upstream 1.14.
* Wed Jun 12 2013 Juho Hämäläinen <juho.hamalainen@tieto.com> - 1.12
- Update to upstream 1.12.
- Add phablet patches for ril (version 1.12phablet3).

View File

@@ -9,7 +9,7 @@ Name: ofono
# << macros
Summary: Open Source Telephony
Version: 1.12
Version: 1.14
Release: 1
Group: Communications/Connectivity Adaptation
License: GPLv2

View File

@@ -1,7 +1,7 @@
Name: ofono
Summary: Open Source Telephony
Description: Telephony stack
Version: 1.12
Version: 1.14
Release: 1
Group: Communications/Connectivity Adaptation
License: GPLv2