[PATCH] PPP: Optimize write buffer management
by Patrick Porlan
Replace modulo operations in ringbuffer.c by masking operations.
That's possible because the size of the ring buffers is always
a power of two, and yields a small performance improvement.
More importantly, extend the write buffer handling in gathdlc.c
to minimize stalling and process switching during large PPP transfers.
The single write buffer is replaced by a circular queue of buffers,
allowing for much larger emission windows without hugely impacting
memory consumption. This reduces the time required to send 50 MB
between a couple of local PPP interfaces on my laptop from 53s to 2.6s.
---
gatchat/gathdlc.c | 85 +++++++++++++++++++++++++++++++++++++-------------
gatchat/ringbuffer.c | 14 +++++---
2 files changed, 71 insertions(+), 28 deletions(-)
diff --git a/gatchat/gathdlc.c b/gatchat/gathdlc.c
index dd11043..9cc6a74 100644
--- a/gatchat/gathdlc.c
+++ b/gatchat/gathdlc.c
@@ -37,7 +37,9 @@
#include "gatio.h"
#include "gathdlc.h"
-#define BUFFER_SIZE 2048
+#define BUFFER_SIZE 4096
+#define MAX_BUFFERS 64 /* Maximum number of in-flight write buffers: this needs to be a power of 2 */
+#define HDLC_OVERHEAD 256 /* Rough estimate of HDLC protocol overhead for a frame */
#define HDLC_FLAG 0x7e /* Flag sequence */
#define HDLC_ESCAPE 0x7d /* Asynchronous control escape */
@@ -51,7 +53,9 @@
struct _GAtHDLC {
gint ref_count;
GAtIO *io;
- struct ring_buffer *write_buffer;
+ struct ring_buffer *wbuf_ring[MAX_BUFFERS]; /* Array of pointers to circular write buffers - itself managed as a ring */
+ gint wbuf_head; /* First unsent buffer index */
+ gint wbuf_tail; /* Last unsent buffer index */
unsigned char *decode_buffer;
guint decode_offset;
guint16 decode_fcs;
@@ -190,6 +194,7 @@ GAtHDLC *g_at_hdlc_new_from_io(GAtIO *io)
{
GAtHDLC *hdlc;
unsigned char *buf;
+ struct ring_buffer* write_buffer;
if (io == NULL)
return NULL;
@@ -207,16 +212,19 @@ GAtHDLC *g_at_hdlc_new_from_io(GAtIO *io)
hdlc->xmit_accm[3] = 0x60000000; /* 0x7d, 0x7e */
hdlc->recv_accm = ~0U;
- hdlc->write_buffer = ring_buffer_new(BUFFER_SIZE * 2);
- if (!hdlc->write_buffer)
+ write_buffer = ring_buffer_new(BUFFER_SIZE);
+ if (!write_buffer)
goto error;
+ hdlc->wbuf_head = hdlc->wbuf_tail = 0;
+ hdlc->wbuf_ring[0] = write_buffer;
+
/* Write an initial 0x7e as wakeup character */
- buf = ring_buffer_write_ptr(hdlc->write_buffer, 0);
+ buf = ring_buffer_write_ptr(write_buffer, 0);
*buf = HDLC_FLAG;
- ring_buffer_write_advance(hdlc->write_buffer, 1);
+ ring_buffer_write_advance(write_buffer, 1);
- hdlc->decode_buffer = g_try_malloc(BUFFER_SIZE * 2);
+ hdlc->decode_buffer = g_try_malloc(BUFFER_SIZE);
if (!hdlc->decode_buffer)
goto error;
@@ -228,8 +236,8 @@ GAtHDLC *g_at_hdlc_new_from_io(GAtIO *io)
return hdlc;
error:
- if (hdlc->write_buffer)
- ring_buffer_free(hdlc->write_buffer);
+ if (write_buffer)
+ ring_buffer_free(write_buffer);
if (hdlc->decode_buffer)
g_free(hdlc->decode_buffer);
@@ -266,6 +274,8 @@ GAtHDLC *g_at_hdlc_ref(GAtHDLC *hdlc)
void g_at_hdlc_unref(GAtHDLC *hdlc)
{
+ int i;
+
if (hdlc == NULL)
return;
@@ -280,7 +290,11 @@ void g_at_hdlc_unref(GAtHDLC *hdlc)
g_at_io_unref(hdlc->io);
hdlc->io = NULL;
- ring_buffer_free(hdlc->write_buffer);
+ for (i = hdlc->wbuf_head; i != hdlc->wbuf_tail; i = (i+1) % MAX_BUFFERS)
+ ring_buffer_free(hdlc->wbuf_ring[i]);
+
+ ring_buffer_free(hdlc->wbuf_ring[i]);
+
g_free(hdlc->decode_buffer);
if (hdlc->in_read_handler)
@@ -314,17 +328,26 @@ static gboolean can_write_data(gpointer data)
unsigned int len;
unsigned char *buf;
gsize bytes_written;
+ struct ring_buffer* write_buffer = hdlc->wbuf_ring[hdlc->wbuf_head];
- len = ring_buffer_len_no_wrap(hdlc->write_buffer);
- buf = ring_buffer_read_ptr(hdlc->write_buffer, 0);
+ len = ring_buffer_len_no_wrap(write_buffer);
+ buf = ring_buffer_read_ptr(write_buffer, 0);
bytes_written = g_at_io_write(hdlc->io, (gchar *) buf, len);
hdlc_record(hdlc->record_fd, FALSE, buf, bytes_written);
- ring_buffer_drain(hdlc->write_buffer, bytes_written);
+ ring_buffer_drain(write_buffer, bytes_written);
- if (ring_buffer_len(hdlc->write_buffer) > 0)
+ if (ring_buffer_len(write_buffer) > 0)
return TRUE;
+ /* We're done with this buffer : adjust head if there is at least another buffer in flight */
+ if (hdlc->wbuf_head != hdlc->wbuf_tail) {
+ ring_buffer_free(write_buffer);
+ hdlc->wbuf_head = (hdlc->wbuf_head + 1) % MAX_BUFFERS;
+
+ return TRUE;
+ }
+
return FALSE;
}
@@ -356,19 +379,37 @@ GAtIO *g_at_hdlc_get_io(GAtHDLC *hdlc)
gboolean g_at_hdlc_send(GAtHDLC *hdlc, const unsigned char *data, gsize size)
{
- unsigned int avail = ring_buffer_avail(hdlc->write_buffer);
- unsigned int wrap = ring_buffer_avail_no_wrap(hdlc->write_buffer);
- unsigned char *buf = ring_buffer_write_ptr(hdlc->write_buffer, 0);
+ struct ring_buffer* write_buffer = hdlc->wbuf_ring[hdlc->wbuf_tail];
+ unsigned int avail = ring_buffer_avail(write_buffer);
+ unsigned int wrap = ring_buffer_avail_no_wrap(write_buffer);
+ unsigned char *buf;
unsigned char tail[2];
unsigned int i = 0;
guint16 fcs = HDLC_INITFCS;
gboolean escape = FALSE;
gsize pos = 0;
- if (avail < size)
- return FALSE;
+ if (avail < size + HDLC_OVERHEAD) {
+ /* Switch to a new buffer */
+
+ if ((hdlc->wbuf_tail + 1) % MAX_BUFFERS == hdlc->wbuf_head)
+ return FALSE; /* Ring full */
+
+ write_buffer = ring_buffer_new(BUFFER_SIZE);
+
+ if (!write_buffer)
+ return FALSE;
+
+ hdlc->wbuf_tail = (hdlc->wbuf_tail + 1) % MAX_BUFFERS;
+ hdlc->wbuf_ring[hdlc->wbuf_tail] = write_buffer;
+
+ avail = ring_buffer_avail(write_buffer);
+ wrap = ring_buffer_avail_no_wrap(write_buffer);
+ buf = ring_buffer_write_ptr(write_buffer, 0);
+ }
i = 0;
+ buf = ring_buffer_write_ptr(write_buffer, 0);
while (pos < avail && i < size) {
if (escape == TRUE) {
@@ -387,7 +428,7 @@ gboolean g_at_hdlc_send(GAtHDLC *hdlc, const unsigned char *data, gsize size)
pos++;
if (pos == wrap)
- buf = ring_buffer_write_ptr(hdlc->write_buffer, pos);
+ buf = ring_buffer_write_ptr(write_buffer, pos);
}
if (i < size)
@@ -414,7 +455,7 @@ gboolean g_at_hdlc_send(GAtHDLC *hdlc, const unsigned char *data, gsize size)
pos++;
if (pos == wrap)
- buf = ring_buffer_write_ptr(hdlc->write_buffer, pos);
+ buf = ring_buffer_write_ptr(write_buffer, pos);
}
if (i < sizeof(tail))
@@ -426,7 +467,7 @@ gboolean g_at_hdlc_send(GAtHDLC *hdlc, const unsigned char *data, gsize size)
*buf = HDLC_FLAG;
pos++;
- ring_buffer_write_advance(hdlc->write_buffer, pos);
+ ring_buffer_write_advance(write_buffer, pos);
g_at_io_set_write_handler(hdlc->io, can_write_data, hdlc);
diff --git a/gatchat/ringbuffer.c b/gatchat/ringbuffer.c
index becd3f8..27be3a8 100644
--- a/gatchat/ringbuffer.c
+++ b/gatchat/ringbuffer.c
@@ -34,6 +34,7 @@
struct ring_buffer {
unsigned char *buffer;
unsigned int size;
+ unsigned int mask;
unsigned int in;
unsigned int out;
};
@@ -61,6 +62,7 @@ struct ring_buffer *ring_buffer_new(unsigned int size)
}
buffer->size = real_size;
+ buffer->mask = real_size - 1;
buffer->in = 0;
buffer->out = 0;
@@ -78,7 +80,7 @@ int ring_buffer_write(struct ring_buffer *buf, const void *data,
len = MIN(len, buf->size - buf->in + buf->out);
/* Determine how much to write before wrapping */
- offset = buf->in % buf->size;
+ offset = buf->in & buf->mask;
end = MIN(len, buf->size - offset);
memcpy(buf->buffer+offset, d, end);
@@ -93,12 +95,12 @@ int ring_buffer_write(struct ring_buffer *buf, const void *data,
unsigned char *ring_buffer_write_ptr(struct ring_buffer *buf,
unsigned int offset)
{
- return buf->buffer + (buf->in + offset) % buf->size;
+ return buf->buffer + ((buf->in + offset) & buf->mask);
}
int ring_buffer_avail_no_wrap(struct ring_buffer *buf)
{
- unsigned int offset = buf->in % buf->size;
+ unsigned int offset = buf->in & buf->mask;
unsigned int len = buf->size - buf->in + buf->out;
return MIN(len, buf->size - offset);
@@ -121,7 +123,7 @@ int ring_buffer_read(struct ring_buffer *buf, void *data, unsigned int len)
len = MIN(len, buf->in - buf->out);
/* Grab data from buffer starting at offset until the end */
- offset = buf->out % buf->size;
+ offset = buf->out & buf->mask;
end = MIN(len, buf->size - offset);
memcpy(d, buf->buffer + offset, end);
@@ -150,7 +152,7 @@ int ring_buffer_drain(struct ring_buffer *buf, unsigned int len)
int ring_buffer_len_no_wrap(struct ring_buffer *buf)
{
- unsigned int offset = buf->out % buf->size;
+ unsigned int offset = buf->out & buf->mask;
unsigned int len = buf->in - buf->out;
return MIN(len, buf->size - offset);
@@ -159,7 +161,7 @@ int ring_buffer_len_no_wrap(struct ring_buffer *buf)
unsigned char *ring_buffer_read_ptr(struct ring_buffer *buf,
unsigned int offset)
{
- return buf->buffer + (buf->out + offset) % buf->size;
+ return buf->buffer + ((buf->out + offset) & buf->mask);
}
int ring_buffer_len(struct ring_buffer *buf)
--
1.7.1
11 years, 3 months
[PATCH 0/5] Cell info for ISI modem
by Antti Paila
This series of patches brings the neighbor
cell info support for ISI modems.
Antti Paila (5):
isimodem: new enums declared for cell info
isimodem: Driver implementation
isimodem: cell info init and exit functions
isimodem: cell info creation to post_online
isimodem: Makefile modifications
Makefile.am | 13 +-
drivers/isimodem/cell-info.c | 375 ++++++++++++++++++++++++++++++++++++++++++
drivers/isimodem/debug.c | 5 +
drivers/isimodem/isimodem.c | 2 +
drivers/isimodem/isimodem.h | 3 +
drivers/isimodem/network.h | 8 +
plugins/isiusb.c | 3 +
7 files changed, 404 insertions(+), 5 deletions(-)
create mode 100644 drivers/isimodem/cell-info.c
11 years, 3 months
[PATCH 1/2] huawei: do not check for NULL pointer
by Lucas De Marchi
cb_data_new() uses g_new0(), hence there's no need to check the return
value being NULL.
---
plugins/huawei.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/plugins/huawei.c b/plugins/huawei.c
index 6f05677..afa804d 100644
--- a/plugins/huawei.c
+++ b/plugins/huawei.c
@@ -600,13 +600,9 @@ static void huawei_set_online(struct ofono_modem *modem, ofono_bool_t online,
DBG("modem %p %s", modem, online ? "online" : "offline");
- if (cbd == NULL)
- goto error;
-
if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free))
return;
-error:
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, cbd->data);
--
1.7.4.1
11 years, 3 months
[PATCH] Fix huawei_disconnect function issue
by martin.xu@intel.com
From: Martin Xu <martin.xu(a)intel.com>
huawei_disconnect is used to recovery the io and gprs context when
io error happends, see commit 39382730d7758b093ca6271f4e9dea875fa04b3a
However, io error not only happends at PPP disconnect, in theory it
can happends at any situation. I also observed that it happens when modem
go into offline mode at my Huawei EM770W modem. in this case, gprs should
not be reopened.
---
plugins/huawei.c | 49 +++++++++++++++++++++++++++++++++++--------------
1 files changed, 35 insertions(+), 14 deletions(-)
diff --git a/plugins/huawei.c b/plugins/huawei.c
index 6f05677..939509f 100644
--- a/plugins/huawei.c
+++ b/plugins/huawei.c
@@ -78,6 +78,7 @@ struct huawei_data {
struct ofono_gprs *gprs;
struct ofono_gprs_context *gc;
gboolean voice;
+ gboolean online;
gboolean ndis;
guint sim_poll_timeout;
guint sim_poll_count;
@@ -97,6 +98,7 @@ static int huawei_probe(struct ofono_modem *modem)
if (data == NULL)
return -ENOMEM;
+ data->online = FALSE;
ofono_modem_set_data(modem, data);
return 0;
@@ -470,10 +472,7 @@ static void huawei_disconnect(gpointer user_data)
struct ofono_modem *modem = user_data;
struct huawei_data *data = ofono_modem_get_data(modem);
- DBG("");
-
- if (data->gc)
- ofono_gprs_context_remove(data->gc);
+ DBG("data->online %d", data->online);
g_at_chat_unref(data->modem);
data->modem = NULL;
@@ -485,6 +484,13 @@ static void huawei_disconnect(gpointer user_data)
g_at_chat_set_disconnect_function(data->modem,
huawei_disconnect, modem);
+ /* reopen GPRS context channel only at online state */
+ if (data->online == FALSE)
+ return;
+
+ if (data->gc)
+ ofono_gprs_context_remove(data->gc);
+
if (data->sim_state == HUAWEI_SIM_STATE_VALID ||
data->sim_state == HUAWEI_SIM_STATE_INVALID_CS) {
ofono_info("Reopened GPRS context channel");
@@ -579,15 +585,25 @@ static int huawei_disable(struct ofono_modem *modem)
return -EINPROGRESS;
}
+struct huawei_cb_data {
+ struct cb_data *cbd;
+ ofono_bool_t online;
+ struct ofono_modem *modem;
+};
+
static void set_online_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
- struct cb_data *cbd = user_data;
- ofono_modem_online_cb_t cb = cbd->cb;
+ struct huawei_cb_data *online_cbd = user_data;
+ ofono_modem_online_cb_t cb = online_cbd->cbd->cb;
+ struct huawei_data *data = ofono_modem_get_data(online_cbd->modem);
- if (ok)
- CALLBACK_WITH_SUCCESS(cb, cbd->data);
+ if (ok) {
+ data->online = online_cbd->online;
+
+ CALLBACK_WITH_SUCCESS(cb, online_cbd->cbd->data);
+ }
else
- CALLBACK_WITH_FAILURE(cb, cbd->data);
+ CALLBACK_WITH_FAILURE(cb, online_cbd->cbd->data);
}
static void huawei_set_online(struct ofono_modem *modem, ofono_bool_t online,
@@ -595,21 +611,26 @@ static void huawei_set_online(struct ofono_modem *modem, ofono_bool_t online,
{
struct huawei_data *data = ofono_modem_get_data(modem);
GAtChat *chat = data->pcui;
- struct cb_data *cbd = cb_data_new(cb, user_data);
+ struct huawei_cb_data *online_cbd;
char const *command = online ? "AT+CFUN=1" : "AT+CFUN=5";
DBG("modem %p %s", modem, online ? "online" : "offline");
- if (cbd == NULL)
+ online_cbd = g_try_new0(struct huawei_cb_data, 1);
+ online_cbd->cbd = cb_data_new(cb, user_data);
+ if (online_cbd->cbd == NULL)
goto error;
+ online_cbd->online = online;
+ online_cbd->modem = modem;
- if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free))
+ if (g_at_chat_send(chat, command, NULL, set_online_cb,
+ online_cbd, g_free))
return;
error:
- g_free(cbd);
+ g_free(online_cbd);
- CALLBACK_WITH_FAILURE(cb, cbd->data);
+ CALLBACK_WITH_FAILURE(cb, user_data);
}
static void huawei_pre_sim(struct ofono_modem *modem)
--
1.6.1.3
11 years, 3 months
[PATCH 0/3] Voice call SS notifications (3rd version)
by Andras Domokos
Implementation proposal for handling some of the voice call
related Supplementary Services (SS) notifications.
Implementation details:
- removed SSN atom
- (re)implemented voice call SS notification handling framework
- added voice call SS notification handling to AT modem driver
(+CSSU and +CSSI notifications)
Andras Domokos (3):
ssn: remove SSN atom completely
voicecall: add SSN handling functions
atmodem: add SSN handling
Makefile.am | 6 +-
drivers/atmodem/atmodem.c | 2 -
drivers/atmodem/atmodem.h | 3 -
drivers/atmodem/ssn.c | 147 -------------------------
drivers/atmodem/voicecall.c | 61 +++++++++++
drivers/isimodem/isimodem.c | 2 -
drivers/isimodem/isimodem.h | 3 -
drivers/isimodem/ssn.c | 95 -----------------
include/ssn.h | 61 -----------
include/types.h | 2 +
include/voicecall.h | 6 +
plugins/calypso.c | 2 -
plugins/g1.c | 2 -
plugins/huawei.c | 2 -
plugins/ifx.c | 2 -
plugins/isiusb.c | 2 -
plugins/linktop.c | 2 -
plugins/n900.c | 2 -
plugins/phonesim.c | 2 -
plugins/ste.c | 2 -
plugins/tc65.c | 2 -
plugins/u8500.c | 2 -
plugins/wavecom.c | 2 -
src/ofono.h | 17 ---
src/ssn.c | 247 -------------------------------------------
src/voicecall.c | 156 +++++++++++++++++++++++++++
26 files changed, 227 insertions(+), 605 deletions(-)
delete mode 100644 drivers/atmodem/ssn.c
delete mode 100644 drivers/isimodem/ssn.c
delete mode 100644 include/ssn.h
delete mode 100644 src/ssn.c
11 years, 3 months
[PATCH] gisi: M6 coding style violation corrections
by Antti Paila
---
gisi/iter.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/gisi/iter.c b/gisi/iter.c
index f3f6f5a..8308c00 100644
--- a/gisi/iter.c
+++ b/gisi/iter.c
@@ -56,7 +56,7 @@ void g_isi_sb_iter_init_full(GIsiSubBlockIter *iter, const GIsiMessage *msg,
len = used = 0;
iter->cursor = longhdr ? 4 : 2;
- iter->start = (uint8_t *)data + used;
+ iter->start = (uint8_t *) data + used;
iter->end = iter->start + len;
iter->longhdr = longhdr;
iter->sub_blocks = len > used ? sub_blocks : 0;
@@ -72,7 +72,7 @@ void g_isi_sb_iter_init(GIsiSubBlockIter *iter, const GIsiMessage *msg,
len = used = 0;
iter->cursor = 2;
- iter->start = (uint8_t *)data + used;
+ iter->start = (uint8_t *) data + used;
iter->end = iter->start + len;
iter->longhdr = FALSE;
iter->sub_blocks = len > used ? iter->start[-1] : 0;
@@ -147,18 +147,18 @@ size_t g_isi_sb_iter_get_len(const GIsiSubBlockIter *iter)
gboolean g_isi_sb_iter_get_data(const GIsiSubBlockIter *restrict iter,
void **data, unsigned pos)
{
- if ((size_t)pos > g_isi_sb_iter_get_len(iter)
+ if ((size_t) pos > g_isi_sb_iter_get_len(iter)
|| iter->start + pos > iter->end)
return FALSE;
- *data = (void *)iter->start + pos;
+ *data = (void *) iter->start + pos;
return TRUE;
}
gboolean g_isi_sb_iter_get_byte(const GIsiSubBlockIter *restrict iter,
uint8_t *byte, unsigned pos)
{
- if ((size_t)pos > g_isi_sb_iter_get_len(iter)
+ if ((size_t) pos > g_isi_sb_iter_get_len(iter)
|| iter->start + pos > iter->end)
return FALSE;
@@ -257,8 +257,8 @@ gboolean g_isi_sb_iter_get_alpha_tag(const GIsiSubBlockIter *restrict iter,
if (ucs2 + len > iter->end)
return FALSE;
- *utf8 = g_convert((const char *)ucs2, len, "UTF-8//TRANSLIT", "UCS-2BE",
- NULL, NULL, NULL);
+ *utf8 = g_convert((const char *) ucs2, len, "UTF-8//TRANSLIT",
+ "UCS-2BE", NULL, NULL, NULL);
return *utf8 != NULL;
}
@@ -290,7 +290,7 @@ gboolean g_isi_sb_iter_get_latin_tag(const GIsiSubBlockIter *restrict iter,
if (str + len > iter->end)
return FALSE;
- *latin = g_strndup((char *)str, len);
+ *latin = g_strndup((char *) str, len);
return *latin != NULL;
}
--
1.7.1
11 years, 3 months
[PATCH] mbmmodem: don't let chat open after fd is sent
by Lucas De Marchi
Instead of using a GAtChat, just use a GIOChannel and close it as soon
as its fd is sent to core.
---
drivers/mbmmodem/location-reporting.c | 32 +++++++++++++++-----------------
1 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/drivers/mbmmodem/location-reporting.c b/drivers/mbmmodem/location-reporting.c
index 941fac4..b76a5c2 100644
--- a/drivers/mbmmodem/location-reporting.c
+++ b/drivers/mbmmodem/location-reporting.c
@@ -94,13 +94,13 @@ static void mbm_location_reporting_disable(struct ofono_location_reporting *lr,
g_free(cbd);
}
-static int mbm_create_data_chat(struct ofono_location_reporting *lr)
+static int enable_data_stream(struct ofono_location_reporting *lr)
{
- struct gps_data *gd = ofono_location_reporting_get_data(lr);
struct ofono_modem *modem;
const char *gps_dev;
- GAtSyntax *syntax;
GIOChannel *channel;
+ GIOStatus status;
+ gsize written;
int fd;
modem = ofono_location_reporting_get_modem(lr);
@@ -110,15 +110,18 @@ static int mbm_create_data_chat(struct ofono_location_reporting *lr)
if (channel == NULL)
return -1;
- syntax = g_at_syntax_new_gsm_permissive();
- gd->data_chat = g_at_chat_new(channel, syntax);
fd = g_io_channel_unix_get_fd(channel);
+ status = g_io_channel_write_chars(channel, "AT*E2GPSNPD\r\n", -1,
+ &written, NULL);
- g_at_syntax_unref(syntax);
+ g_io_channel_set_close_on_unref(channel, FALSE);
g_io_channel_unref(channel);
- if (gd->data_chat == NULL)
+ if (status != G_IO_STATUS_NORMAL || written != 13) {
+ close(fd);
+
return -1;
+ }
return fd;
}
@@ -129,7 +132,6 @@ static void mbm_e2gpsctl_enable_cb(gboolean ok, GAtResult *result,
struct cb_data *cbd = user_data;
ofono_location_reporting_enable_cb_t cb = cbd->cb;
struct ofono_location_reporting *lr = cbd->user;
- struct gps_data *gd = ofono_location_reporting_get_data(lr);
struct ofono_error error;
int fd;
@@ -143,20 +145,16 @@ static void mbm_e2gpsctl_enable_cb(gboolean ok, GAtResult *result,
return;
}
- fd = mbm_create_data_chat(lr);
+ fd = enable_data_stream(lr);
- if (fd < 0)
- goto out;
-
- if (g_at_chat_send(gd->data_chat, "AT*E2GPSNPD", NULL, NULL, NULL,
- NULL) > 0) {
- cb(&error, fd, cbd->data);
+ if (fd < 0) {
+ CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
return;
}
-out:
- CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
+ cb(&error, fd, cbd->data);
+ close(fd);
}
static void mbm_location_reporting_enable(struct ofono_location_reporting *lr,
--
1.7.4.1
11 years, 3 months
[PATCH 0/5 v4] Neighbor Cell Info Atom
by Antti Paila
This series of patches implements an interface for client
applications to fetch the ECID information of neighboring
cells using DBUS. Since the 1st version the DBUS api has
been refactored to use new naming for method and to use
flat data format for the cell information. Also, the
internal datatypes have been optimized. Since the 2nd
version MNC and MCC are converted to strings and CPICH-RSCP
re-typed. Since 3rd version multiradio support is added and
interfaces are renamed.
Antti Paila (5):
cell-info: CellInfo DBUS interface definition
cell-info: Header files for neighbor cell info
cell-info: Atom for neighbor cell info
cell-info: New files included in compilation
cell-info: Documentation
Makefile.am | 9 +-
doc/cell-info.txt | 122 +++++++++++++
include/cell-info.h | 126 ++++++++++++++
include/dbus.h | 1 +
src/cell-info.c | 475 +++++++++++++++++++++++++++++++++++++++++++++++++++
src/ofono.h | 1 +
6 files changed, 731 insertions(+), 3 deletions(-)
create mode 100644 doc/cell-info.txt
create mode 100644 include/cell-info.h
create mode 100644 src/cell-info.c
11 years, 3 months
[PATCH v2] isimodem: removed unused NETWORK_TIMEOUT
by George Matveev
---
drivers/isimodem/network.h | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/drivers/isimodem/network.h b/drivers/isimodem/network.h
index 822440c..a9c8a93 100644
--- a/drivers/isimodem/network.h
+++ b/drivers/isimodem/network.h
@@ -28,7 +28,6 @@ extern "C" {
#define PN_NETWORK 0x0A
#define PN_MODEM_NETWORK 0xC8
-#define NETWORK_TIMEOUT 5
#define NETWORK_SCAN_TIMEOUT 180
#define NETWORK_SET_TIMEOUT 240
#define NET_INVALID_TIME 0x64
--
1.7.2.3
11 years, 3 months
[PATCH] ste: enable multiple oFono runs without restarting the oFono
by Jussi Kangas
---
Hi,
This enables SIM detection in workstation after disabling and enabling the
modem without rebooting the oFono.
Br,
Jussi
plugins/ste.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/plugins/ste.c b/plugins/ste.c
index b786571..d2a6cc1 100644
--- a/plugins/ste.c
+++ b/plugins/ste.c
@@ -184,6 +184,7 @@ static gboolean init_sim_reporting(gpointer user_data)
{
struct ofono_modem *modem = user_data;
struct ste_data *data = ofono_modem_get_data(modem);
+ data->have_sim = FALSE;
g_at_chat_send(data->chat, "AT*ESIMSR=1;*ESIMSR?", NULL,
handle_sim_state,
--
1.7.1
11 years, 3 months