[PATCH v2] reopen once if open device failed
by Caiwen Zhang
(1) Sometimes when open the data device, it may fail. If open the data device failed,
retry once one second later.
(2) Fix Huawei NDIS modem gprs doesn't work issue
---
plugins/huawei.c | 43 ++++++++++++++++++++++++++++++++++++++-----
1 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/plugins/huawei.c b/plugins/huawei.c
index e791718..6b2caa4 100644
--- a/plugins/huawei.c
+++ b/plugins/huawei.c
@@ -80,6 +80,7 @@ struct huawei_data {
gboolean ndis;
guint sim_poll_timeout;
guint sim_poll_count;
+ guint reopen_timeout;
};
#define MAX_SIM_POLL_COUNT 5
@@ -107,6 +108,11 @@ static void huawei_remove(struct ofono_modem *modem)
DBG("%p", modem);
+ if (data->reopen_timeout > 0) {
+ g_source_remove(data->reopen_timeout);
+ data->reopen_timeout = 0;
+ }
+
ofono_modem_set_data(modem, NULL);
if (data->modem)
@@ -465,6 +471,20 @@ static GAtChat *open_device(struct ofono_modem *modem,
return chat;
}
+static void huawei_disconnect(gpointer user_data);
+
+static gboolean reopen_callback(gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct huawei_data *data = ofono_modem_get_data(modem);
+
+ huawei_disconnect(user_data);
+
+ data->reopen_timeout = 0;
+
+ return FALSE;
+}
+
static void huawei_disconnect(gpointer user_data)
{
struct ofono_modem *modem = user_data;
@@ -476,8 +496,17 @@ static void huawei_disconnect(gpointer user_data)
data->modem = NULL;
data->modem = open_device(modem, "Modem", "Modem: ");
- if (data->modem == NULL)
+ /* retry once if failed */
+ if (data->modem == NULL) {
+ if (data->reopen_timeout == 0) {
+ data->reopen_timeout =
+ g_timeout_add_seconds(1, reopen_callback,
+ modem);
+
+ ofono_debug("open device failed, try to reopen it.");
+ }
return;
+ }
g_at_chat_set_disconnect_function(data->modem,
huawei_disconnect, modem);
@@ -559,6 +588,11 @@ static int huawei_disable(struct ofono_modem *modem)
DBG("%p", modem);
+ if (data->reopen_timeout > 0) {
+ g_source_remove(data->reopen_timeout);
+ data->reopen_timeout = 0;
+ }
+
if (data->sim_poll_timeout > 0) {
g_source_remove(data->sim_poll_timeout);
data->sim_poll_timeout = 0;
@@ -682,16 +716,15 @@ static void huawei_post_online(struct ofono_modem *modem)
ofono_ussd_create(modem, OFONO_VENDOR_QUALCOMM_MSM,
"atmodem", data->pcui);
- if ((data->sim_state == HUAWEI_SIM_STATE_VALID ||
- data->sim_state == HUAWEI_SIM_STATE_INVALID_CS) &&
- data->modem != NULL) {
+ if (data->sim_state == HUAWEI_SIM_STATE_VALID ||
+ data->sim_state == HUAWEI_SIM_STATE_INVALID_CS) {
data->gprs = ofono_gprs_create(modem, OFONO_VENDOR_HUAWEI,
"atmodem", data->pcui);
if (data->ndis == TRUE)
data->gc = ofono_gprs_context_create(modem, 0,
"huaweimodem", data->pcui);
- else
+ else if (data->modem != NULL)
data->gc = ofono_gprs_context_create(modem, 0,
"atmodem", data->modem);
--
1.7.5
11 years
[PATCH v2] voicecall: add +VTS support for HFP emulator
by Frédéric Dalleau
---
src/voicecall.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/src/voicecall.c b/src/voicecall.c
index 2ab67ac..0273ed6 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2421,6 +2421,10 @@ static void emulator_hfp_unregister(struct ofono_atom *atom)
OFONO_ATOM_TYPE_EMULATOR_HFP,
emulator_remove_handler,
"+CHLD");
+ __ofono_modem_foreach_registered_atom(modem,
+ OFONO_ATOM_TYPE_EMULATOR_HFP,
+ emulator_remove_handler,
+ "+VTS");
__ofono_modem_remove_atom_watch(modem, vc->hfp_watch);
}
@@ -2866,6 +2870,53 @@ fail:
ofono_emulator_send_final(em, &result);
}
+static void vts_tone_cb(int error, void *data)
+{
+ struct ofono_emulator *em = data;
+ struct ofono_error result;
+
+ result.error = 0;
+ result.type = error ? OFONO_ERROR_TYPE_FAILURE :
+ OFONO_ERROR_TYPE_NO_ERROR;
+
+ ofono_emulator_send_final(em, &result);
+}
+
+static void emulator_vts_cb(struct ofono_emulator *em,
+ struct ofono_emulator_request *req, void *userdata)
+{
+ struct ofono_voicecall *vc = userdata;
+ struct ofono_error result;
+ const char *str;
+
+ switch (ofono_emulator_request_get_type(req)) {
+ case OFONO_EMULATOR_REQUEST_TYPE_SET:
+ str = ofono_emulator_request_get_raw(req);
+ if (str == NULL)
+ break;
+
+ if (!g_ascii_isdigit(str[0]) && str[0] != '*' && str[0] != '#'
+ && (str[0] < 'A' || str[0] > 'D'))
+ break;
+
+ if (str[1] != '\0')
+ break;
+
+ if (__ofono_voicecall_tone_send(vc, str, vts_tone_cb, em) >= 0)
+ return;
+
+ break;
+
+ default:
+ break;
+ }
+
+ result.error = 0;
+ result.type = OFONO_ERROR_TYPE_FAILURE;
+
+ ofono_emulator_send_final(em, &result);
+}
+
static void emulator_hfp_watch(struct ofono_atom *atom,
enum ofono_atom_watch_condition cond,
void *data)
@@ -2881,6 +2932,7 @@ static void emulator_hfp_watch(struct ofono_atom *atom,
ofono_emulator_add_handler(em, "+CHUP", emulator_chup_cb, data, NULL);
ofono_emulator_add_handler(em, "+CLCC", emulator_clcc_cb, data, NULL);
ofono_emulator_add_handler(em, "+CHLD", emulator_chld_cb, data, NULL);
+ ofono_emulator_add_handler(em, "+VTS", emulator_vts_cb, data, NULL);
}
void ofono_voicecall_register(struct ofono_voicecall *vc)
--
1.7.1
11 years
[PATCH] doc: add hfp-overview.txt
by Frédéric Danis
---
doc/hfp-overview.txt | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 49 insertions(+), 0 deletions(-)
create mode 100644 doc/hfp-overview.txt
diff --git a/doc/hfp-overview.txt b/doc/hfp-overview.txt
new file mode 100644
index 0000000..3ca1213
--- /dev/null
+++ b/doc/hfp-overview.txt
@@ -0,0 +1,49 @@
+HandsFree Profile Audio Gateway diagram
+=======================================
+
+This diagram explains how oFono manages HFP AG.
+
+AT commands and unsolicited results are managed in their related atom (eg. ATA
+is managed in voicecall atom).
+The emulator atom is managing AT commands or unsolicited results that are not
+falling into a specific atom.
+
+1) HFP AG plugin registers a HFP AG server as soon as a voicecall atom exist.
+2) When a connection occurs on this server, HFP AG plugin creates and registers
+ an emulator atom.
+3) Emulator atom will start a GAtServer and registers non-atom-specific
+ AT commands to it.
+4) On emulator atom registration, voice call related atoms (voicecall, network
+ and sim) register AT callbacks they managed through emulator atom.
+
+
+*===========* *-----------------*
+| | Register | |
+| BlueZ |<---------------| HFP AG plugin |
+| | SDP record | |
+*===========* *-----------------*
+ |
+ | Start emulator on connection
+ |
+ V
+ *-----------------*
+ | |
+ *-------->| Emulator Atom |
+ | | |
+ | *-----------------*
+ | |
+ Register | | Register AT commands
+ AT | V
+ callbacks | *-----------------*
+ | | |
+ | | GAtServer |
+ | | |
+ | *-----------------*
+ |
+ *---------------------*-------------------*
+ | | |
+ *----------------* *--------------* *-------------*
+ | | | | | |
+ | Voicecall atom | | Network atom | | SIM atom |
+ | | | | | |
+ *----------------* *--------------* *-------------*
--
1.7.1
11 years
[PATCH 0/5] Add support of remote hangup
by Nicolas Bertrand
These patchs introduce the possibility of remote hangup
by selecting the call in the call table and use the new
button "hangup".
Nicolas Bertrand (5):
controlbase: Add hangup button
callmanager: Remote hangup slot
hardwaremanipulator: add hangup signal
control: Handle hangup call
phonesim: Connect hangup signal
src/callmanager.cpp | 23 +++++++++++++++++++++++
src/callmanager.h | 3 +++
src/control.cpp | 24 +++++++++++++++++++++++-
src/control.h | 2 ++
src/controlbase.ui | 7 +++++++
src/hardwaremanipulator.h | 1 +
src/phonesim.cpp | 2 ++
7 files changed, 61 insertions(+), 1 deletions(-)
11 years
[PATCH 1/7] sms: remove set but not used var
by Gustavo F. Padovan
---
src/sms.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/src/sms.c b/src/sms.c
index 2940762..323c5ad 100644
--- a/src/sms.c
+++ b/src/sms.c
@@ -754,9 +754,6 @@ static gboolean tx_next(gpointer user_data)
int send_mms = 0;
struct tx_queue_entry *entry = g_queue_peek_head(sms->txq);
struct pending_pdu *pdu = &entry->pdus[entry->cur_pdu];
- struct ofono_error error;
-
- error.type = OFONO_ERROR_TYPE_NO_ERROR;
DBG("tx_next: %p", entry);
--
1.7.5.1
11 years
[PATCH] emulator: fix dun_ath_cb() not to remove GAtServer io_disconnect() CB
by Guillaume Zajac
---
src/emulator.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/emulator.c b/src/emulator.c
index c17b901..251bed8 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -219,15 +219,19 @@ static void dun_ath_cb(GAtServer *server, GAtServerRequestType type,
if (val != 0)
goto error;
+ g_at_server_suspend(em->server);
g_at_ppp_unref(em->ppp);
em->ppp = NULL;
+ g_at_server_resume(em->server);
g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
break;
case G_AT_SERVER_REQUEST_TYPE_COMMAND_ONLY:
+ g_at_server_suspend(em->server);
g_at_ppp_unref(em->ppp);
em->ppp = NULL;
+ g_at_server_resume(em->server);
g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
break;
--
1.7.1
11 years
[PATCH] voicecall: add +VTS support for HFP emulator
by Frédéric Dalleau
---
src/voicecall.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/src/voicecall.c b/src/voicecall.c
index d46f463..846c1c4 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2421,6 +2421,10 @@ static void emulator_hfp_unregister(struct ofono_atom *atom)
OFONO_ATOM_TYPE_EMULATOR_HFP,
emulator_remove_handler,
"+CHLD");
+ __ofono_modem_foreach_registered_atom(modem,
+ OFONO_ATOM_TYPE_EMULATOR_HFP,
+ emulator_remove_handler,
+ "+VTS");
__ofono_modem_remove_atom_watch(modem, vc->hfp_watch);
}
@@ -2866,6 +2870,44 @@ fail:
ofono_emulator_send_final(em, &result);
}
+static void vts_tone_cb(int error, void *data)
+{
+ struct ofono_emulator *em = data;
+ struct ofono_error result;
+
+ result.error = 0;
+ result.type = error ? OFONO_ERROR_TYPE_FAILURE :
+ OFONO_ERROR_TYPE_NO_ERROR;
+
+ ofono_emulator_send_final(em, &result);
+}
+
+static void emulator_vts_cb(struct ofono_emulator *em,
+ struct ofono_emulator_request *req, void *userdata)
+{
+ struct ofono_voicecall *vc = userdata;
+ struct ofono_error result;
+ const char *str;
+
+ switch (ofono_emulator_request_get_type(req)) {
+ case OFONO_EMULATOR_REQUEST_TYPE_SET:
+ str = ofono_emulator_request_get_raw(req);
+
+ if (__ofono_voicecall_tone_send(vc, str, vts_tone_cb, em) < 0)
+ break;
+
+ return;
+
+ default:
+ break;
+ }
+
+ result.error = 0;
+ result.type = OFONO_ERROR_TYPE_FAILURE;
+
+ ofono_emulator_send_final(em, &result);
+}
+
static void emulator_hfp_watch(struct ofono_atom *atom,
enum ofono_atom_watch_condition cond,
void *data)
@@ -2881,6 +2923,7 @@ static void emulator_hfp_watch(struct ofono_atom *atom,
ofono_emulator_add_handler(em, "+CHUP", emulator_chup_cb, data, NULL);
ofono_emulator_add_handler(em, "+CLCC", emulator_clcc_cb, data, NULL);
ofono_emulator_add_handler(em, "+CHLD", emulator_chld_cb, data, NULL);
+ ofono_emulator_add_handler(em, "+VTS", emulator_vts_cb, data, NULL);
}
void ofono_voicecall_register(struct ofono_voicecall *vc)
--
1.7.1
11 years
[PATCH 0/4] Add dial support for HFP emulator
by Frédéric Danis
Create a generic dial function that can be called by DBus or emulator
Add support of ATD and AT+BLDN
Save last dialed number in /var/lib/ofono/<modem>/voicecall to be used
by AT+BLDN
Frédéric Danis (4):
voicecall: create generic dial function
voicecall: add ATD support for HFP emulator
voicecall: save last dialed number
voicecall: add +BLDN support for HFP emulator
src/voicecall.c | 274 +++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 247 insertions(+), 27 deletions(-)
11 years
Emulator not unregistered while sending ATH0
by Guillaume Zajac
Hi Denis,
I noticed that when I send +++ -> ATH0 during a PPP session the ppp
server is well unregistered.
However when the physical layer is removed (bluetooht or TCP), the
associated emulator is not unregistered.
As we used in gatutil.c set_close_on_unref(TRUE), it means there is
still on reference on the GIOChannel.
In the case the PPP session is ended normally, we call
ppp_ipcp_down_notify() to free the ppp_net interface.
Then the physical layer is removed and we got the emulator well
unregistered.
Do you have any idea about what is happening there?
Maybe I forgot to do something into dun_ath_cb().
Kind regards,
Guillaume
11 years
[PATCH] isimodem: Improper handling of missed call
by Arun Ravindran
---
drivers/isimodem/voicecall.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/isimodem/voicecall.c b/drivers/isimodem/voicecall.c
index 333f9b8..6979105 100644
--- a/drivers/isimodem/voicecall.c
+++ b/drivers/isimodem/voicecall.c
@@ -50,6 +50,7 @@ struct isi_call {
uint8_t id;
uint8_t call_id;
uint8_t status;
+ uint8_t prev_status;
uint8_t mode;
uint8_t mode_info;
uint8_t cause_type;
@@ -314,7 +315,7 @@ static void isi_call_status_sb_proc(struct isi_voicecall *ivc,
if (!g_isi_sb_iter_get_byte(sb, &status, 2))
return;
-
+ call->prev_status = call->status;
call->status = status;
}
@@ -401,10 +402,16 @@ static int isi_call_status_to_clcc(const struct isi_call *call)
return 5;
case CALL_STATUS_MO_RELEASE:
- case CALL_STATUS_MT_RELEASE:
- case CALL_STATUS_TERMINATED:
return 6;
+ case CALL_STATUS_MT_RELEASE:
+ if ((call->prev_status == CALL_STATUS_MT_ALERTING) ||
+ (call->prev_status == CALL_STATUS_COMING) ||
+ (call->prev_status == CALL_STATUS_WAITING))
+ return 4;
+ else
+ return 6;
+
case CALL_STATUS_ACTIVE:
case CALL_STATUS_HOLD_INITIATED:
return 0;
@@ -548,9 +555,14 @@ static void isi_call_notify(struct ofono_voicecall *ovc, struct isi_call *call)
case CALL_STATUS_MO_RELEASE:
case CALL_STATUS_MT_RELEASE:
+ isi_call_set_disconect_reason(call):
+ break;
+
case CALL_STATUS_TERMINATED:
isi_call_set_disconnect_reason(call);
- break;
+ DBG("State( CALL_STATUS_TERMINATED ) need not be reported to Core");
+ return;
+
case CALL_STATUS_ANSWERED:
DBG("State need not be reported to Core");
return;
--
1.7.1
11 years