Randomly SMS sent passes or fails
by Viallard Anthony
Hello,
I've a weird issue. I don't know what's going on...
I try to send SMS with a T-mobile SIM card in Germany. The SIM card
doesn't require PIN code. I can get the GSM network and I don't use GPRS.
Sometimes, I can send SMS, and another time, It fails. More precisely,
when I've got an ofono which can send SMS, I can send all the SMS I
want, it works. But if I restart ofono, either it works or not.
I added OFONO_AT_DEBUG=1 in my env, and tried to find some troubles in
the logs. I've got some errors but I don't think they are criticals and
anyway, they appeared when SMS working too :
-------------------------------
> AT+CPINR\r
< \r\nERROR\r\n
Querying remaining pin retries failed
[...]
Provisioning failed
-------------------------------
I can see some differences in time for "AT+CRSM" commands but, they are
in the same order. And, after many tests, I don't think the problem is here.
And, when the SMS send fails, the modem tells me :
-------------------------------
CMS ERROR: Unknown error\r\n
-------------------------------
Not very useful....
Also, at same time, I tested in Switzerland with SwissCom and I don't
have problem.
1 month ago, it worked well. I don't get it...
I've got a "SIMCOM_SIM5216E" modem. Using the driver g1 or the new
simcom driver I developped, with ofono 1.6 or 1.12, it's the same behavior.
Maybe have you already see this kind of things ? My brain is lost.
Regards,
avd.
--
.-------------------.-----------------------.-------------------.
| Viallard Anthony | Syscom Instruments SA | Embedded System |
| +41 024 455 24 82 | Rue de l'industrie 21 | Software Designer |
| ~~~~~~~~~~~~~~~~~ | 1450 Sainte-Croix | ~~~~~~~~~~~~~~~~~ |
'-------------------^-----------------------^-------------------^
7 years, 8 months
[PATCHv4 0/8] Nokia N9 specific quirks
by Timo Mueller
From: Timo Mueller <timo.mueller(a)bmw-carit.de>
Hi,
this is the same as v3 with the changes suggested by Denis.
v4 changes:
* Retry CLCC request on outgoing callsetup is now a N9 specific quirk
* Third patch has been split up according to HACKING rules
The idea of setting the vendor during runtime was to use the "Model"
string of the ofono_modem (analogous to what the wavecom modem
does). But as the Nokia N9 does not support the device ID profile and
the BT address has an OUI from Texas Instruments, I wasn't able to
determine that the hfpmodem is a Nokia N9. Maybe you have some
ideas on how this can be determined properly?
As currently there's no functionality to detect the vendor of a
hfpmodem on runtime the clcc quirk can be enabled for all vendors by
patching the needs_callheld_clcc_quirk method.
Regards,
Timo
Timo Mueller (8):
hfpmodem: Add modem vendor stub
hfpmodem: Add vendor header to makefile
hfpmodem: Add vendor information to voicecall data
hfp_hf_bluez4: Pass vendor on voicecall creation
hfp_hf_bluez5: Pass vendor on voicecall creation
hfpmodem: Add method to query if CLCC quirks are needed
hfpmodem: Add N9 quirk for outgoing callsetup
hfpmodem: Add N9 quirk for callheld=<2 or 3>
Makefile.am | 3 +-
drivers/hfpmodem/vendor.h | 26 +++++++++++++++
drivers/hfpmodem/voicecall.c | 77 +++++++++++++++++++++++++++++++++++++++++---
plugins/hfp_hf_bluez4.c | 4 ++-
plugins/hfp_hf_bluez5.c | 5 ++-
5 files changed, 107 insertions(+), 8 deletions(-)
create mode 100644 drivers/hfpmodem/vendor.h
--
1.7.11.7
7 years, 8 months
Re: SAGEM HiloNC v2 Driver
by Freedreamer
Hi Denis,
first of all thanks 4 your reply.
>
> 2013/3/26 Denis Kenzior <denkenz(a)gmail.com>
>
>> Hi Marco,
>>
>>
>> On 03/26/2013 04:07 AM, Freedreamer wrote:
>>
>>> Hi Everybody,
>>>
>>> I'm developing a driver for an embedded system which uses a sagem HiloNC
>>> v2 and I really should need your help. It's my will to commit everything
>>> when shall be ready and working.
>>> First of all I will tell you what i did..I created a plugin sagem.c
>>> ,added a new Vendor , modified makefile & other stuff and seems to work
>>> properly. I started from calypso driver 'cause the modem is based on a
>>> Uart and I needed the MUX over that.
>>> With a very raw/dirty code I was able to use PPP/SMS/net service over
>>> virtual com.. Very good work dude! :)
>>>
>>> Now I would like to clean up my code and get a better understanding of
>>> the stack. Unfortunately I saw that functions/modules are not always
>>> commented so I have to ask u a lot of questions (maybe also trivial):
>>>
>>> 1) AT cmds sent with "g_at_chat_send" are always async , is that right ?
>>> Is there any chance to get them sync ?
>>>
>>
>> There is not, we do not want to encourage any sort of blocking behavior
>> in the daemon. Remember there are potentially multiple modems being
>> operated on and we do not use threads.
>>
>
Ok get it, i thought there were pthreads somewhere.
>> 2) in enable fnc the modem is powered but The sim is not ready so
>>> sometimes It hangs up...Do I have to to poll the sim status until is
>>> ready , or the driver will do that by itself ?
>>>
>>
>> oFono never polls for anything. It is the driver's responsibility to do
>> that in the best possible way for the hardware. Also, powering on the
>> modem is separate from the sim being ready. The general flow is this:
>>
>> -Enable modem
>> -Wait for the modem to power on and use ofono_modem_set_powered when that
>> happens successfully / fails.
>> - Figure out if the SIM is inserted and signal using
>> ofono_sim_inserted_notify. Do this step only once the SIM is ready to be
>> queried for its PIN status and perform any I/O on SIM files that are always
>> accessible (e.g. ICCID)
>>
>
Ok. If Sim not "ready" , sending a signal prematurely could stuck anyhow
the stack ? 'cause it should explain a lot of thing..
>
>>
>> 3) could u explain me what should I really do in virtual fnc set_online
>>> / post_online ? i tried to stub them but they have not never been
>>> called...
>>>
>>
>> oFono has 3 basic states:
>> - Off
>> - Radio Off, Sim On
>> - Radio On, Sim On
>>
>> set_online turns radio on / off
>> post_online populates the atoms that are available in radio 'On' state.
>>
>>
>>
This is what i thought but I do not understand why I don't see the trace
log I put inside them...usually are called before pre_sim fn? are related
to any signal i have to manage/post ?
>
>> 4) unfortunately this modem has a SIM detection URC but it reset itself
>>> every time the status changes... so i should call the disable function
>>> and the enable again in order to have the MUX working... how can i do
>>> that?
>>>
>>
>> I'm not following. Care to elaborate?
>>
>>
>>
I've managing vendor URC for sim detection right now but i have
problems.For instance if I remove it when ofonod is ready the Hilonc sends
an URC to notify sim status changed but after that it reboots itself(2 sec
later)... what i did is to notify the stack that the SIM has been removed
and modem is powered off . I thought that after calling set_powered fnc the
stack should have called my driver virtual disable function in order to
properly close the MUX .. but it's not..
>
>
>> 5) I created and started the MUX as the first thing in enable fnc but is
>>> that right ? sometimes seems that the modem hangs up if just powered up.
>>> Put a delay but don't like it very much as a solution...moreover when I
>>> power up the modem all the URC have been lost 'cause the MUX has not
>>> been created yet..
>>>
>>
>> That is what we do for most devices with a MUX, put it into MUX state
>> right away after basic initialization. The devices we have can be queried
>> for their state in addition to URCs, so it works out very well.
>>
>>
right now i've been using custom URC in the first power up phase to
understand modem status. I manually set them but theoretically I should
check the values saved on the modem every power cycle. What I was thinking
was to test every time the values saved and enabling them if they were not
.After that I should call an AT+cfun=1,1 in order to reset the modem and
force it to send me again the needed URCs . What do u think ?
Thanks again
Marco
Regards,
>> -Denis
>
>
7 years, 9 months
[PATCH 1/5] hfp_hf_bluez5: Add a card driver for HFP 1.6
by Vinicius Costa Gomes
This is just the skeleton of a Handsfree Audio Card for the HF side of
HFP 1.6.
---
plugins/hfp_hf_bluez5.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index ff8afba..e2fa70c 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -60,6 +60,8 @@
#define HFP_EXT_PROFILE_PATH "/bluetooth/profile/hfp_hf"
+#define HFP16_HF_DRIVER "hfp16-hf-driver"
+
struct hfp {
struct hfp_slc_info info;
DBusMessage *msg;
@@ -310,6 +312,31 @@ static struct ofono_modem_driver hfp_driver = {
.post_sim = hfp_post_sim,
};
+static int hfp16_card_probe(struct ofono_handsfree_card *card,
+ unsigned int vendor, void *data)
+{
+ return 0;
+}
+
+static void hfp16_card_remove(struct ofono_handsfree_card *card)
+{
+
+}
+
+static void hfp16_card_connect(struct ofono_handsfree_card *card,
+ ofono_handsfree_card_connect_cb_t cb,
+ void *data)
+{
+
+}
+
+static struct ofono_handsfree_card_driver hfp16_hf_driver = {
+ .name = HFP16_HF_DRIVER,
+ .probe = hfp16_card_probe,
+ .remove = hfp16_card_remove,
+ .connect = hfp16_card_connect,
+};
+
static ofono_bool_t device_path_compare(struct ofono_modem *modem,
void *userdata)
{
@@ -616,6 +643,13 @@ static int hfp_init(void)
return -EIO;
}
+ err = ofono_handsfree_card_driver_register(&hfp16_hf_driver);
+ if (err < 0) {
+ g_dbus_unregister_interface(conn, HFP_EXT_PROFILE_PATH,
+ BLUEZ_PROFILE_INTERFACE);
+ return err;
+ }
+
err = ofono_modem_driver_register(&hfp_driver);
if (err < 0) {
g_dbus_unregister_interface(conn, HFP_EXT_PROFILE_PATH,
@@ -647,6 +681,9 @@ static void hfp_exit(void)
bt_unregister_profile(conn, HFP_EXT_PROFILE_PATH);
g_dbus_unregister_interface(conn, HFP_EXT_PROFILE_PATH,
BLUEZ_PROFILE_INTERFACE);
+
+ ofono_handsfree_card_driver_unregister(&hfp16_hf_driver);
+
ofono_modem_driver_unregister(&hfp_driver);
g_dbus_client_unref(bluez);
--
1.8.2
7 years, 9 months
[PATCH 00/13] Add support for BlueZ 5 Profile1 API to dundee
by Paulo Borges
This series implements support for BlueZ 5 to dundee. It uses the
org.bluez.Profile1 API to register an external profile.
While the interface between BlueZ and dundee has changed, the interfaces
"org.ofono.dundee.Device" and "org.ofono.dundee.Manager" remains
unchanged.
Paulo Borges (13):
dundee: Rename dundee BlueZ 4 support
dundee: Start BlueZ 5 support
bluez5: Add DUN_UUID
dundee: Initial GDBusClient for BlueZ 5
dundee: Add mechanism to store bluetooth devices
dundee: Add tracking of bluetooth devices
dundee: Listen to devices property changes
dundee: Add dundee device driver skeleton
dundee: Register/unregister dundee device
dundee: Add BlueZ Profile handler
dundee: Add support for driver connect
dundee: Add dundee disconnect function
dundee: Handle Profile connect and disconnect
Makefile.am | 16 +-
dundee/bluetooth.c | 297 -----------------------------------
dundee/bluez4.c | 297 +++++++++++++++++++++++++++++++++++
dundee/bluez5.c | 445 ++++++++++++++++++++++++++++++++++++++++++++++++++++
dundee/device.c | 14 +-
dundee/dundee.h | 5 +
plugins/bluez5.h | 1 +
7 files changed, 769 insertions(+), 306 deletions(-)
delete mode 100644 dundee/bluetooth.c
create mode 100644 dundee/bluez4.c
create mode 100644 dundee/bluez5.c
--
1.7.9.5
7 years, 9 months
[PATCH 1/2] modem: Support modem property "AlwaysOnline"
by Forest Bond
From: Forest Bond <forest.bond(a)rapidrollout.com>
This can be set by the modem driver to indicate that the device is
always in the online state when it is enabled. This is useful for
modem drivers that handle both CDMA and GSM devices.
---
src/modem.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/modem.c b/src/modem.c
index 0f12f5a..49913a9 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -595,6 +595,17 @@ static gboolean modem_has_sim(struct ofono_modem *modem)
return FALSE;
}
+static gboolean modem_is_always_online(struct ofono_modem *modem)
+{
+ if (modem->driver->set_online == NULL)
+ return TRUE;
+
+ if (ofono_modem_get_boolean(modem, "AlwaysOnline") == TRUE)
+ return TRUE;
+
+ return FALSE;
+}
+
static void common_online_cb(const struct ofono_error *error, void *data)
{
struct ofono_modem *modem = data;
@@ -702,11 +713,8 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *user)
case OFONO_SIM_STATE_READY:
modem_change_state(modem, MODEM_STATE_OFFLINE);
- /*
- * If we don't have the set_online method, also proceed
- * straight to the online state
- */
- if (modem->driver->set_online == NULL)
+ /* Modem is always online, proceed to online state. */
+ if (modem_is_always_online(modem) == TRUE)
set_online(modem, TRUE);
if (modem->online == TRUE)
@@ -745,7 +753,7 @@ static DBusMessage *set_property_online(struct ofono_modem *modem,
if (ofono_modem_get_emergency_mode(modem) == TRUE)
return __ofono_error_emergency_active(msg);
- if (driver->set_online == NULL)
+ if (modem_is_always_online(modem) == TRUE)
return __ofono_error_not_implemented(msg);
modem->pending = dbus_message_ref(msg);
--
1.7.0.4
7 years, 9 months
[PATCH 2/2] huawei: Use AlwaysOnline for CDMA modems
by Forest Bond
From: Forest Bond <forest.bond(a)rapidrollout.com>
---
plugins/huawei.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/plugins/huawei.c b/plugins/huawei.c
index 5d8875a..59995b3 100644
--- a/plugins/huawei.c
+++ b/plugins/huawei.c
@@ -447,6 +447,13 @@ static void sysinfo_enable_cb(gboolean ok, GAtResult *result,
g_at_chat_send(data->pcui, "AT^CVOICE=?", cvoice_prefix,
cvoice_support_cb, modem, NULL);
+ /* For CDMA we use AlwaysOnline so we leave the modem online. */
+ if (data->have_gsm == FALSE && data->have_cdma == TRUE) {
+ ofono_modem_set_boolean(modem, "AlwaysOnline", TRUE);
+ ofono_modem_set_powered(modem, TRUE);
+ return;
+ }
+
if (g_at_chat_send(data->pcui, data->offline_command, none_prefix,
cfun_offline, modem, NULL) > 0)
return;
--
1.7.0.4
7 years, 9 months
[PATCH 1/4] SIMCOM plugin driver
by Anthony Viallard
Add SIMCOM support.
Implemented using SIM5216E module and ofono 1.12.
- based on SIM5215_SIM5216_ATC_V1.18.pdf documentation ;
- SMS and GPRS work (in the same time) ;
- SIM card presence check ;
- use GSM charset ;
- use 115200bps, 8 bit data, no parity, 1 bit stop, no data stream control
for tty configuration ;
- flight mode support ;
- No voice part (because I can't test it).
--- ofono-1.12.orig/Makefile.am 2012-04-20 21:06:29.000000000 +0200
+++ ofono-1.12/Makefile.am 2013-01-21 17:17:48.089627277 +0100
@@ -371,6 +371,9 @@ builtin_sources += plugins/samsung.c
builtin_modules += sim900
builtin_sources += plugins/sim900.c
+builtin_modules += simcom
+builtin_sources += plugins/simcom.c
+
if BLUETOOTH
builtin_modules += bluetooth
builtin_sources += plugins/bluetooth.c plugins/bluetooth.h
--- /dev/null 2013-01-28 10:34:59.843091650 +0100
+++ ofono-1.12/plugins/simcom.c 2013-02-15 16:16:38.058552544 +0100
@@ -0,0 +1,434 @@
+/*
+ *
+ * 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 <glib.h>
+#include <gatchat.h>
+#include <gattty.h>
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include <ofono/plugin.h>
+#include <ofono/modem.h>
+#include <ofono/devinfo.h>
+#include <ofono/netreg.h>
+#include <ofono/sim.h>
+#include <ofono/cbs.h>
+#include <ofono/sms.h>
+#include <ofono/ussd.h>
+#include <ofono/gprs.h>
+#include <ofono/gprs-context.h>
+#include <ofono/radio-settings.h>
+#include <ofono/phonebook.h>
+#include <ofono/log.h>
+
+#include <drivers/atmodem/atutil.h>
+#include <drivers/atmodem/vendor.h>
+
+#define MAX_IGNITION_POOL_CALL 7
+
+#define CMEERR_SIMBUSY 14
+
+static const char *none_prefix[] = { NULL };
+
+struct simcom_data {
+ GAtChat *modem;
+ GAtChat *chat;
+ guint ignition_pool;
+ unsigned int ignition_pool_call;
+ unsigned int at_ignition_pending;
+ ofono_bool_t have_sim;
+};
+
+/* Callback and helpers functions */
+static void simcom_debug(const char *str, void *user_data)
+{
+ const char *prefix = user_data;
+
+ ofono_info("%s%s", prefix, str);
+}
+
+static gboolean simcom_ignition(gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct simcom_data *data = ofono_modem_get_data(modem);
+
+ ++data->ignition_pool_call;
+
+ if(data->at_ignition_pending > 0)
+ {
+ if(data->ignition_pool_call > MAX_IGNITION_POOL_CALL)
+ {
+ ofono_error("Ignition timeout");
+ return FALSE;
+ }
+
+ /* Waiting reply of AT commands */
+ DBG("Waiting AT reply...");
+ return TRUE;
+ }
+
+ ofono_modem_set_powered(modem, TRUE);
+
+ return FALSE;
+}
+
+static void simcom_sim_status(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct ofono_error error;
+ struct simcom_data *data = ofono_modem_get_data(modem);
+
+ --data->at_ignition_pending;
+
+ if(!ok)
+ {
+ decode_at_error(&error, g_at_result_final_response(result));
+ if(error.type == OFONO_ERROR_TYPE_CME)
+ {
+ if(error.error == CMEERR_SIMBUSY)
+ {
+ DBG("System is busy. Retry...");
+ g_at_chat_send(data->chat, "AT+CPIN?",
+ none_prefix,
+ simcom_sim_status, modem,
+ NULL);
+ ++data->at_ignition_pending;
+ return;
+ }
+ }
+
+ data->have_sim = FALSE;
+ return;
+ }
+
+ /* If doesn't have an "fatal" error on AT+CPIN request,
+ * we can guess there a SIM card ...
+ */
+ data->have_sim = TRUE;
+}
+
+static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct simcom_data *data = ofono_modem_get_data(modem);
+
+ DBG("");
+
+ if (!ok) {
+ g_at_chat_unref(data->modem);
+ data->modem = NULL;
+
+ g_at_chat_unref(data->chat);
+ data->chat = NULL;
+
+ ofono_modem_set_powered(modem, FALSE);
+ return;
+ }
+
+ /* Get model and sim card status */
+ data->at_ignition_pending = 0;
+
+ g_at_chat_send(data->chat, "AT+CPIN?", none_prefix,
+ simcom_sim_status, modem, NULL);
+ ++data->at_ignition_pending;
+
+ data->ignition_pool = g_timeout_add_seconds(1,
+ simcom_ignition,
+ modem);
+}
+
+static void cfun_disable(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct simcom_data *data = ofono_modem_get_data(modem);
+
+ DBG("");
+
+ g_at_chat_unref(data->chat);
+ data->chat = NULL;
+
+ if (ok)
+ ofono_modem_set_powered(modem, FALSE);
+}
+
+static void flightmode_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct cb_data *cbd = user_data;
+ ofono_modem_online_cb_t cb = cbd->cb;
+ struct ofono_error error;
+
+ decode_at_error(&error, g_at_result_final_response(result));
+ cb(&error, cbd->data);
+}
+
+static GAtChat *open_device(struct ofono_modem *modem,
+ const char *key,
+ char *debug)
+{
+ const char *device;
+ GIOChannel *channel;
+ GAtSyntax *syntax;
+ GAtChat *chat;
+ GHashTable *options;
+
+ device = ofono_modem_get_string(modem, key);
+ if (device == NULL)
+ {
+ ofono_error("Failed to get modem '%s'", key);
+ 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");
+ g_hash_table_insert(options, "Parity", "none");
+ g_hash_table_insert(options, "StopBits", "1");
+ g_hash_table_insert(options, "DataBits", "8");
+ g_hash_table_insert(options, "XonXoff", "off");
+
+ channel = g_at_tty_open(device, options);
+
+ /* g_hash_table_destroy(options); */
+
+ if (channel == NULL)
+ {
+ ofono_error("Failed to get tty for '%s'", key);
+ return NULL;
+ }
+
+ syntax = g_at_syntax_new_gsm_permissive();
+ chat = g_at_chat_new(channel, syntax);
+ g_at_syntax_unref(syntax);
+
+ g_io_channel_unref(channel);
+
+ if (chat == NULL)
+ {
+ ofono_error("Failed to get chat for '%s'", key);
+ return NULL;
+ }
+
+ if (getenv("OFONO_AT_DEBUG"))
+ g_at_chat_set_debug(chat, simcom_debug, debug);
+
+ return chat;
+}
+
+/* Modem interface function */
+static int simcom_probe(struct ofono_modem *modem)
+{
+ struct simcom_data *data;
+
+ DBG("%p", modem);
+
+ data = g_try_new0(struct simcom_data, 1);
+ if (data == NULL)
+ return -ENOMEM;
+
+ ofono_modem_set_data(modem, data);
+
+ return 0;
+}
+
+static void simcom_remove(struct ofono_modem *modem)
+{
+ struct simcom_data *data = ofono_modem_get_data(modem);
+
+ DBG("%p", modem);
+
+ if(data->ignition_pool > 0)
+ {
+ g_source_remove(data->ignition_pool);
+ data->ignition_pool = 0;
+ }
+
+ ofono_modem_set_data(modem, NULL);
+
+ /* Cleanup after hot-unplug */
+ g_at_chat_unref(data->chat);
+
+ g_free(data);
+}
+
+static int simcom_enable(struct ofono_modem *modem)
+{
+ struct simcom_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, "Data", "Data: ");
+ if (data->chat == NULL) {
+ g_at_chat_unref(data->modem);
+ data->modem = NULL;
+ return -EIO;
+ }
+
+ g_at_chat_set_slave(data->modem, data->chat);
+
+ g_at_chat_blacklist_terminator(data->chat,
+ G_AT_CHAT_TERMINATOR_NO_CARRIER);
+
+ /* Configure AT commands behavior */
+ g_at_chat_send(data->modem, "ATE0 +CMEE=1", NULL, NULL, NULL, NULL);
+ g_at_chat_send(data->chat, "ATE0 +CMEE=1", NULL, NULL, NULL, NULL);
+
+ /* Ensure that the modem is using GSM character set and not IRA */
+ g_at_chat_send(data->modem, "AT+CSCS=\"GSM\"", none_prefix,
+ NULL, NULL, NULL);
+ g_at_chat_send(data->chat, "AT+CSCS=\"GSM\"", none_prefix,
+ NULL, NULL, NULL);
+
+ /* Make it up */
+ g_at_chat_send(data->chat, "AT+CFUN=1", none_prefix,
+ cfun_enable, modem, NULL);
+
+ return -EINPROGRESS;
+}
+
+static int simcom_disable(struct ofono_modem *modem)
+{
+ struct simcom_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);
+
+ g_at_chat_send(data->chat, "AT+CFUN=4", none_prefix,
+ cfun_disable, modem, NULL);
+
+ return -EINPROGRESS;
+}
+
+static void simcom_set_online(struct ofono_modem *modem, ofono_bool_t online,
+ ofono_modem_online_cb_t cb, void *user_data)
+{
+ struct simcom_data *data = ofono_modem_get_data(modem);
+ struct cb_data *cbd = cb_data_new(cb, user_data);
+ char const *command = online ? "AT+CFUN=1" : "AT+CFUN=4";
+
+ DBG("modem %p %s", modem, online ? "online" : "offline");
+
+ if (g_at_chat_send(data->chat, command, none_prefix,
+ flightmode_cb, cbd, g_free) > 0)
+ return;
+
+ CALLBACK_WITH_FAILURE(cb, cbd->data);
+
+ g_free(cbd);
+}
+
+static void simcom_pre_sim(struct ofono_modem *modem)
+{
+ struct simcom_data *data = ofono_modem_get_data(modem);
+ struct ofono_sim *sim;
+
+ DBG("%p", modem);
+
+ ofono_devinfo_create(modem, 0, "atmodem", data->chat);
+ sim = ofono_sim_create(modem, OFONO_VENDOR_SIMCOM, "atmodem",
+ data->chat);
+
+ if (sim)
+ ofono_sim_inserted_notify(sim, data->have_sim);
+}
+
+static void simcom_post_sim(struct ofono_modem *modem)
+{
+ struct simcom_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_phonebook_create(modem, 0, "atmodem", data->chat);
+
+ ofono_sms_create(modem, OFONO_VENDOR_SIMCOM, "atmodem",
+ data->chat);
+
+ /* gprs things */
+ gprs = ofono_gprs_create(modem, 0, "atmodem", data->chat);
+ gc = ofono_gprs_context_create(modem, 0, "atmodem", data->modem);
+
+ if(gprs && gc)
+ {
+ ofono_gprs_add_context(gprs, gc);
+ }
+}
+
+static void simcom_post_online(struct ofono_modem *modem)
+{
+ struct simcom_data *data = ofono_modem_get_data(modem);
+
+ DBG("%p", modem);
+
+ ofono_netreg_create(modem, OFONO_VENDOR_SIMCOM, "atmodem", data->chat);
+ ofono_cbs_create(modem, 0, "atmodem", data->chat);
+ ofono_ussd_create(modem, 0, "atmodem", data->chat);
+}
+
+static struct ofono_modem_driver simcom_driver = {
+ .name = "simcom",
+ .probe = simcom_probe,
+ .remove = simcom_remove,
+ .enable = simcom_enable,
+ .disable = simcom_disable,
+ .set_online = simcom_set_online,
+ .pre_sim = simcom_pre_sim,
+ .post_sim = simcom_post_sim,
+ .post_online = simcom_post_online,
+};
+
+static int simcom_init(void)
+{
+ return ofono_modem_driver_register(&simcom_driver);
+}
+
+static void simcom_exit(void)
+{
+ ofono_modem_driver_unregister(&simcom_driver);
+}
+
+OFONO_PLUGIN_DEFINE(simcom, "SIMCOM modem driver", VERSION,
+ OFONO_PLUGIN_PRIORITY_DEFAULT,
+ simcom_init, simcom_exit)
7 years, 9 months
[PATCH v4 0/9] bluetooth: handsfree audio agent
by Frédéric Dalleau
Hello,
This is an handsfree audio agent written in C.
I could test CVSD and MSBC (patch v6) with it.
v4:
fixes an fd leak
improves mSBC playback which could be choppy
add an option for killing an agent that connects
supports 16 bits voice settings for SCO_OPTIONS (requires kernel patch v4).
v3:
fixes a bug by which only noise was sent to remote device.
handles defered socket with following code instead of using a dummy variable:
if (recv(thread->fd, NULL, 0, 0) < 0)
Best regards,
Frédéric
Frédéric Dalleau (9):
handsfree-audio: Initial DBUS code
handsfree-audio: Build handsfree-audio command line tool
handsfree-audio: Add Alsa dependancy
handsfree-audio: Link tool with Alsa
handsfree-audio: Implement alsa playback
handsfree-audio: Add SBC dependency
handsfree-audio: Link tool with SBC library
handsfree-audio: mSBC support
handsfree-audio: Add an option to kill incoming connections
Makefile.am | 6 +-
configure.ac | 10 +
tools/handsfree-audio.c | 979 +++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 994 insertions(+), 1 deletion(-)
create mode 100644 tools/handsfree-audio.c
--
1.7.9.5
7 years, 9 months
Re: [PATCH 2/3] Drop checking whether +CMER is supported.
by Etienne Mabille
Hi Christopher,
I am trying to setup the Telit HE910 with oFono-1.3, I adapted
a few files using the 1.12 version :
drivers/atmodem/sim.c
plugins/telit.c
plugins/udevng.c
I still have this CMER problem though, and I was wondering what patch
you are refering to in the previous message, so that I can apply it to
my version of oFono.
Thank you in advance,
Etienne
Here is the end of the log from oFono just in case :
ofonod[1680]: plugins/telit.c:telit_post_online() 0x88e8290
ofonod[1680]: Aux: > AT+CGREG=?\r
ofonod[1680]: Aux: < \r\n
ofonod[1680]: Aux: < +CGREG: (0-2)\r\n\r\nOK\r\n
ofonod[1680]: Aux: > AT+CRSM=192,28489\r
ofonod[1680]: Aux: < \r\n+CRSM: 148,4\r\n\r\nOK\r\n
ofonod[1680]: Aux: > AT+CREG=?\r
ofonod[1680]: Aux: < \r\n
ofonod[1680]: Aux: < +CREG: (0-2)\r\n\r\nOK\r\n
ofonod[1680]: Aux: > AT+CSCS?\r
ofonod[1680]: Aux: < \r\n+CSCS: "IRA"\r\n\r\nOK\r\n
ofonod[1680]: Aux: > AT+CUSD=1\r
ofonod[1680]: Aux: < \r\nOK\r\n
ofonod[1680]: Aux: > AT+CAOC=2\r
ofonod[1680]: Aux: < \r\nOK\r\n
ofonod[1680]: Aux: > AT+CCWE=1\r
ofonod[1680]: Aux: < \r\n+CME ERROR: 3\r\n
ofonod[1680]: Aux: > AT+CGREG=2\r
ofonod[1680]: Aux: < \r\nOK\r\n
ofonod[1680]: Aux: > AT+CGAUTO=0\r
ofonod[1680]: Aux: < \r\nERROR\r\n
ofonod[1680]: Aux: > AT+CGEREP=2,1\r
ofonod[1680]: Aux: < \r\nOK\r\n
ofonod[1680]: Aux: > AT+CRSM=192,20256\r
ofonod[1680]: Aux: < \r\n+CME ERROR: 4\r\n
ofonod[1680]: Aux: > AT+CREG=2\r
ofonod[1680]: Aux: < \r\nOK\r\n
ofonod[1680]: Aux: > AT+CPSB=1\r
ofonod[1680]: Aux: < \r\nERROR\r\n
ofonod[1680]: Aux: > AT+CRSM=192,28618\r
ofonod[1680]: Aux: < \r\n+CRSM: 148,4\r\n\r\nOK\r\n
ofonod[1680]: Unable to read waiting messages numbers from SIM
ofonod[1680]: Aux: > AT+CIND=?\r
ofonod[1680]: Aux: < \r\n+CIND:
(("battchg",(0-5,99)),("signal",(0-7,99)),("service",(0,1)),("sounder",(0,1)),("message",(0,1)),("call",(0,1)),("roam",(0,1)),("smsfull",(0,1)),("rssi",(0-5,99)))\r\n\r\nOK\r\n
ofonod[1680]: src/sim.c:ofono_sim_add_spn_watch() 0x88e7308
ofonod[1680]: src/network.c:__ofono_netreg_add_status_watch() 0x88eb670
ofonod[1680]: Aux: > AT+CRSM=192,28617\r
ofonod[1680]: Aux: < \r\n+CRSM: 148,4\r\n\r\nOK\r\n
ofonod[1680]: Unable to read mailbox identifies from SIM
ofonod[1680]: Aux: > AT+CMER=3,0,0,1\r
ofonod[1680]: Aux: < \r\n+CME ERROR: 14\r\n
ofonod[1680]: Aux: > AT+CREG?\r
ofonod[1680]: Aux: < \r\n+CREG: 2,2\r\n\r\nOK\r\n
ofonod[1680]: src/network.c:current_operator_callback() 0x88eb670, (nil)
ofonod[1680]: src/gprs.c:netreg_status_changed() 2
ofonod[1680]: Aux: > AT+CRSM=192,28433\r
ofonod[1680]: Aux: < \r\n+CRSM:
144,0,000000016F11040011005501010000\r\n\r\nOK\r\n
ofonod[1680]: drivers/atmodem/sim.c:at_crsm_info_cb() crsm_info_cb: 90, 00, 15
ofonod[1680]: Aux: > AT+CRSM=176,28433,0,0,1\r
ofonod[1680]: Aux: < \r\n+CRSM: 144,0,5A\r\n\r\nOK\r\n
ofonod[1680]: drivers/atmodem/sim.c:at_crsm_read_cb() crsm_read_cb: 90, 00, 1
ofonod[1680]: src/simfs.c:sim_fs_op_read_block_cb() bufoff: 0,
dataoff: 0, tocopy: 1
ofonod[1680]: Aux: > AT+CRSM=192,28435\r
ofonod[1680]: Aux: < \r\n+CRSM:
144,0,000000016F13040011005501010000\r\n\r\nOK\r\n
ofonod[1680]: drivers/atmodem/sim.c:at_crsm_info_cb() crsm_info_cb: 90, 00, 15
ofonod[1680]: Aux: > AT+CRSM=176,28435,0,0,1\r
ofonod[1680]: Aux: < \r\n+CRSM: 144,0,55\r\n\r\nOK\r\n
ofonod[1680]: drivers/atmodem/sim.c:at_crsm_read_cb() crsm_read_cb: 90, 00, 1
ofonod[1680]: src/simfs.c:sim_fs_op_read_block_cb() bufoff: 0,
dataoff: 0, tocopy: 1
ofonod[1680]: Aux: > AT+CRSM=192,28613\r
ofonod[1680]: Aux: < \r\n+CRSM: 148,4\r\n\r\nOK\r\n
ofonod[1680]: src/simfs.c:sim_fs_op_read_block() bufoff: 0, seekoff:
39, toread: 17
ofonod[1680]: EFspn read successfully, but couldn't parse
ofonod[1680]: Aux: > AT+CRSM=192,28621\r
ofonod[1680]: Aux: < \r\n+CME ERROR: 4\r\n
ofonod[1680]: 3GPP MBDN not provided, parsing CPHS..
ofonod[1680]: Aux: > AT+CRSM=192,28437\r
ofonod[1680]: Aux: < \r\n+CRSM: 148,4\r\n\r\nOK\r\n
ofonod[1680]: Modem: < \r\n#MWI: 1,1\r\n
ofonod[1680]: Aux: < \r\n#MWI: 1,1\r\n
ofonod[1680]: Aux: < \r\n#QSS: 3\r\n
ofonod[1680]: plugins/telit.c:telit_qss_notify() 0x88e8290
ofonod[1680]: plugins/telit.c:switch_sim_state_status() 0x88e8290, SIM status: 3
ofonod[1680]: Aux: > AT+CSCS=?\r
ofonod[1680]: Aux: < \r\n
ofonod[1680]: Aux: < +CSCS:
("GSM","IRA","8859-1","PCCP437","UCS2")\r\n\r\nOK\r\n
ofonod[1680]: Aux: > AT+CSMS=?\r
ofonod[1680]: Aux: < \r\n+CSMS: (0,1)\r\n\r\nOK\r\n
ofonod[1680]: drivers/atmodem/sms.c:at_csms_query_cb() CSMS query
parsed successfully
ofonod[1680]: Aux: > AT+CPBS=?\r
ofonod[1680]: Aux: < \r\n+CPBS:
("SM","FD","LD","MC","RC","MB","DC","ME")\r\n\r\nOK\r\n
ofonod[1680]: Aux: > AT+CSMS=1\r
ofonod[1680]: Aux: < \r\n+CSMS: 1,1,1\r\n\r\nOK\r\n
ofonod[1680]: Aux: > AT+CSMS?\r
ofonod[1680]: Aux: < \r\n+CSMS: 1,1,1,1\r\n\r\nOK\r\n
ofonod[1680]: Aux: > AT+CMGF=?\r
ofonod[1680]: Aux: < \r\n
ofonod[1680]: Aux: < +CMGF: (0,1)\r\n\r\nOK\r\n
ofonod[1680]: Aux: > AT+CPMS=?\r
ofonod[1680]: Aux: < \r\n+CPMS: ("SM"),("SM"),("SM")\r\n\r\nOK\r\n
ofonod[1680]: Aux: > AT+CMGF=0\r
ofonod[1680]: Aux: < \r\nOK\r\n
ofonod[1680]: Aux: > AT+CPMS="SM","SM","SM"\r
ofonod[1680]: Aux: < \r\n
ofonod[1680]: Aux: < +CPMS: 0,100,0,100,0,100\r\n\r\nOK\r\n
ofonod[1680]: Aux: > AT+CNMI=?\r
ofonod[1680]: Aux: < \r\n
ofonod[1680]: Aux: < +CNMI: (0-3),(0-3),(0,2),(0-2),(0,1)\r\n\r\nOK\r\n
ofonod[1680]: drivers/atmodem/sms.c:build_cnmi_string()
ofonod[1680]: drivers/atmodem/sms.c:construct_ack_pdu()
ofonod[1680]: Aux: > AT+CNMI=2,2,2,1,0\r
ofonod[1680]: Aux: < \r\nOK\r\n
ofonod[1680]: src/network.c:__ofono_netreg_add_status_watch() 0x88eb670
ofonod[1680]: src/sms.c:sms_restore_tx_queue()
ofonod[1680]: plugins/push-notification.c:sms_watch() registered
ofonod[1680]: plugins/smart-messaging.c:sms_watch() registered
ofonod[1680]: Aux: > AT+CMGL=4\r
ofonod[1680]: Aux: < \r\nOK\r\n
ofonod[1680]: drivers/atmodem/sms.c:at_cmgl_done()
ofonod[1680]: Aux: > AT+CGSMS=3\r
ofonod[1680]: Aux: < \r\nOK\r\n
ofonod[1680]: Modem: < AT+CREG?\r\r\n+CREG: 0,2\r\n\r\nOK\r\n
On 17/12/12 17:22, Mingli Wu wrote:
>* For Telit HE910, ofono always got "\r\n+CME ERROR: 14\r\n"*>* after issuing "AT+CMER=3,0,0,2\r" command. "CME ERROR: 14"*>* means that SIM is busy. Now we igonre the result of the*>* command "AT+CMER=3,0,0,2\r", and register network anyway.*>* ---*
I submitted some patches which will solve this problem.
You should not get CME ERROR: 14 anymore and hence
the netreg atom will not be removed.
There is not need to make changes in the network registration atom.
Telit supports +CMER but without waiting for the modem to be ready
the command will fail.
Regards,
Christopher
7 years, 9 months