ofono with sim5320 module
by David Ashley
Hello, I'm at my wits' end trying to get ofono working with the
sim5320 module. I'm using the plugins/sim900.c module as a starting
point. I think the issue has something to do with the difference
between the MUX functionality between the 900 and the 5320. The sim900
supports the elaborate parameters sent on the
AT+CMUX=0,x,x,x,x, etc.
but the SIM5320 only supports
AT+CMUX=0
There's that... but also the way the sim900 plugin creates a
SETUP_DLC, initiates muxing, then deletes the setup DLC and creates 4
new DLC's... it didn't work for the sim5320 until I remapped the DLC's
somewhat like this:
#define NUM_DLC 4
#define VOICE_DLC 2
#define NETREG_DLC 1
//#define SMS_DLC 2
#define GPRS_DLC 3
#define SETUP_DLC 0
static char *dlc_prefixes[NUM_DLC] = {
[VOICE_DLC]="Voice: ",
[NETREG_DLC]="Net: ",
// [SMS_DLC]= "SMS: ",
[GPRS_DLC]= "GPRS: " ,
[SETUP_DLC]= "Setup: ",
};
Note I have to eliminate the SMS_DLC usage later in sim5320_post_sim:
// ofono_sms_create(modem, OFONO_VENDOR_SIMCOM, "atmodem",
// data->dlcs[SMS_DLC]);
OK everything is *ALMOST* working. ofonod interacts fine with
connmand, connmand tells ofonod to activate the sim5320, which
actually establishes a ppp connection and sets up a ppp device:
ppp0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-0
inet addr:30.97.132.47 P-t-P:30.97.132.47 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 B) TX bytes:124 (124.0 B)
Here's the rub: No matter what I do, I never get any RX packets from
that ppp device, and even when it appears to TX packets (I'm trying to
ping out) the machine on the internet isn't actually receiving them.
I'm running on a beaglebone with a custom board with a sim5320 module on it.
I have no idea what to try... Any advice would be appreciated...
Thanks very much!!!!
-Dave
3 years, 2 months
[PATCH v2] qmimodem: include shutdown in callback cleanup queue
by Lukasz Nowak
From: Lukasz Nowak <lnowak(a)tycoint.com>
Changes since v1:
- fixed callback->timeout not being saved in qmi_device_shutdown()
Lukasz Nowak (1):
qmimodem: include shutdown in callback cleanup queue
drivers/qmimodem/qmi.c | 401 ++++++++++++++++++++++---------------------------
1 file changed, 180 insertions(+), 221 deletions(-)
--
2.7.4
3 years, 11 months
[RFC hwdb v1 00/28] USB interface labelling via udev
by Jonas Bonn
This series moves the labelling of USB modem interfaces to udev proper.
For most modems we are able to use the udev hwdb to do the labelling, and
for a few special cases we need to add udev rules.
Importantly, the OFONO_DRIVER and OFONO_LABEL properties are set on all
known interfaces. This saves the ofono udev handler from having to figure
these out from parsing udev device properties and doing table lookups.
The reason for doing this is:
i) ofono is currenly re-creating a lot of udev functionality when trying
figure out the driver and label to apply to interfaces
ii) the udev hwdb is an optimized path for setting device properties
iii) labelling interfaces via udev means it can be done for new devices
without code changes (and thus without rebuilding ofono)
iv) the udev implementation gets smaller and simpler; hopefully this
can be made so generic that every new modem won't require changes
to this module
This is an RFC because I'm not quite done with the conversion yet. There
are still some sysattr details to work out for the mbm and telit modems;
and the qmi modems still need to be put into their final form. A follow-up
series will be sent to this one but I wanted to get this sent out now for
some review.
Thanks,
Jonas
Jonas Bonn (28):
zte: remove unused qcdm property
zte: label interfaces via hwdb
novatel: label interfaces via hwdb
alcatel: label interfaces via hwdb
huawei: label interfaces via hwdb
simcom: label interfaces via hwdb
ublox: label interfaces via hwdb
gemalto: label interfaces via hwdb
speedup: label interfaces via hwdb
linktop: label interfaces via hwdb
udevng (hso): remove impossible condition
hso: label interfaces via udev rules
isiusb: label interfaces via udev rules
gobi: label interfaces via udev rules
option: label interfaces via hwdb
nokia: label interfaces via hwdb
samsung: label interfaces via udev rules and hwdb
sierra: label interfaces via udev rules
telitqmi: label interfaces via udev rules
telitqmi: drop unused device rule
telit: label interfaces via hwdb
icera: label interfaces via hwdb
quectel: label interfaces via hwdb
udevng: drop unused headers
mbm: use standard atom names
udevng: remove 'option' driver setup
udevng: push device existence check into drivers
udevng: consolidate setup functions for several USB devices
drivers/mbmmodem/location-reporting.c | 2 +-
plugins/alcatel.c | 9 +
plugins/gobi.c | 9 +
plugins/hso.c | 9 +
plugins/huawei.c | 9 +
plugins/icera.c | 9 +
plugins/linktop.c | 9 +
plugins/mbm.c | 15 +-
plugins/nokia.c | 9 +
plugins/novatel.c | 9 +
plugins/ofono-speedup.rules | 27 --
plugins/ofono.hwdb | 307 +++++++++++++++
plugins/ofono.rules | 51 +++
plugins/quectel.c | 9 +
plugins/speedup.c | 9 +
plugins/telit.c | 9 +
plugins/udevng.c | 687 +++++-----------------------------
plugins/zte.c | 9 +
18 files changed, 577 insertions(+), 620 deletions(-)
delete mode 100644 plugins/ofono-speedup.rules
create mode 100644 plugins/ofono.hwdb
--
2.9.3
3 years, 11 months
[PATCH] qmi: track discovery tasks so clean up is possible
by Denis Kenzior
There are various device & service discovery tasks that are initiated
based on a qmi_device object. qmi_device object does not currently
keep track of these tasks. Unfortunately the qmi_device object can
go away at any time, and these tasks can become orphaned.
The result of this can lead to crashes. E.g. a discovery task timeout fires
after the qmi_device object has been destroyed. Since the object is no
longer valid, any accesses to it will likely result in a SEGFAULT.
This patch attempts to track all discovery tasks on the qmi_device
object itself, so that they can be cleaned up properly. This patch does
not handle the qmi_device_shutdown functionality.
---
drivers/qmimodem/qmi.c | 149 ++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 124 insertions(+), 25 deletions(-)
diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c
index 39fbb19..9b80455 100644
--- a/drivers/qmimodem/qmi.c
+++ b/drivers/qmimodem/qmi.c
@@ -43,6 +43,11 @@
typedef void (*qmi_message_func_t)(uint16_t message, uint16_t length,
const void *buffer, void *user_data);
+struct discovery {
+ void *discover_data;
+ qmi_destroy_func_t destroy;
+};
+
struct qmi_device {
int ref_count;
int fd;
@@ -53,6 +58,7 @@ struct qmi_device {
GQueue *req_queue;
GQueue *control_queue;
GQueue *service_queue;
+ GQueue *discovery_queue;
uint8_t next_control_tid;
uint16_t next_service_tid;
qmi_debug_func_t debug_func;
@@ -213,6 +219,24 @@ static gint __request_compare(gconstpointer a, gconstpointer b)
return req->tid - tid;
}
+static void __discovery_free(gpointer data, gpointer user_data)
+{
+ struct discovery *d = data;
+ qmi_destroy_func_t destroy = d->destroy;
+
+ destroy(d->discover_data);
+}
+
+static gint __discovery_compare(gconstpointer a, gconstpointer b)
+{
+ const struct discovery *d = a;
+
+ if (d->discover_data == b)
+ return 0;
+
+ return 1;
+}
+
static void __notify_free(gpointer data, gpointer user_data)
{
struct qmi_notify *notify = data;
@@ -844,6 +868,37 @@ static void read_watch_destroy(gpointer user_data)
device->read_watch = 0;
}
+static void __qmi_device_discovery_started(struct qmi_device *device,
+ void *discover_data,
+ qmi_destroy_func_t destroy)
+{
+ struct discovery *d;
+
+ d = g_new0(struct discovery, 1);
+ d->discover_data = discover_data;
+ d->destroy = destroy;
+
+ g_queue_push_tail(device->discovery_queue, d);
+}
+
+static void __qmi_device_discovery_complete(struct qmi_device *device,
+ void *discover_data)
+{
+ GList *list;
+ struct discovery *d;
+
+ list = g_queue_find_custom(device->req_queue,
+ discover_data, __discovery_compare);
+ if (!list)
+ return;
+
+ d = list->data;
+ g_queue_delete_link(device->discovery_queue, list);
+
+ d->destroy(d->discover_data);
+ __discovery_free(d, NULL);
+}
+
static void service_destroy(gpointer data)
{
struct qmi_service *service = data;
@@ -897,6 +952,7 @@ struct qmi_device *qmi_device_new(int fd)
device->req_queue = g_queue_new();
device->control_queue = g_queue_new();
device->service_queue = g_queue_new();
+ device->discovery_queue = g_queue_new();
device->service_list = g_hash_table_new_full(g_direct_hash,
g_direct_equal, NULL, service_destroy);
@@ -933,6 +989,9 @@ void qmi_device_unref(struct qmi_device *device)
g_queue_foreach(device->req_queue, __request_free, NULL);
g_queue_free(device->req_queue);
+ g_queue_foreach(device->discovery_queue, __discovery_free, NULL);
+ g_queue_free(device->discovery_queue);
+
if (device->write_watch > 0)
g_source_remove(device->write_watch);
@@ -1000,6 +1059,21 @@ struct discover_data {
guint timeout;
};
+static void discover_data_free(gpointer user_data)
+{
+ struct discover_data *data = user_data;
+
+ if (data->timeout) {
+ g_source_remove(data->timeout);
+ data->timeout = 0;
+ }
+
+ if (data->destroy)
+ data->destroy(data->user_data);
+
+ g_free(data);
+}
+
static void discover_callback(uint16_t message, uint16_t length,
const void *buffer, void *user_data)
{
@@ -1013,8 +1087,6 @@ static void discover_callback(uint16_t message, uint16_t length,
uint8_t count;
unsigned int i;
- g_source_remove(data->timeout);
-
count = 0;
list = NULL;
@@ -1085,10 +1157,7 @@ done:
if (data->func)
data->func(count, list, data->user_data);
- if (data->destroy)
- data->destroy(data->user_data);
-
- g_free(data);
+ __qmi_device_discovery_complete(data->device, data);
}
static gboolean discover_reply(gpointer user_data)
@@ -1102,10 +1171,7 @@ static gboolean discover_reply(gpointer user_data)
data->func(device->version_count,
device->version_list, data->user_data);
- if (data->destroy)
- data->destroy(data->user_data);
-
- g_free(data);
+ __qmi_device_discovery_complete(data->device, data);
return FALSE;
}
@@ -1132,7 +1198,9 @@ bool qmi_device_discover(struct qmi_device *device, qmi_discover_func_t func,
data->destroy = destroy;
if (device->version_list) {
- g_timeout_add_seconds(0, discover_reply, data);
+ data->timeout = g_timeout_add_seconds(0, discover_reply, data);
+ __qmi_device_discovery_started(device, data,
+ discover_data_free);
return true;
}
@@ -1153,6 +1221,7 @@ bool qmi_device_discover(struct qmi_device *device, qmi_discover_func_t func,
__request_submit(device, req, hdr->transaction);
data->timeout = g_timeout_add_seconds(5, discover_reply, data);
+ __qmi_device_discovery_started(device, data, discover_data_free);
return true;
}
@@ -1714,16 +1783,29 @@ struct service_create_data {
guint timeout;
};
-static gboolean service_create_reply(gpointer user_data)
+static void service_create_data_free(gpointer user_data)
{
struct service_create_data *data = user_data;
- data->func(NULL, data->user_data);
+ if (data->timeout) {
+ g_source_remove(data->timeout);
+ data->timeout = 0;
+ }
if (data->destroy)
data->destroy(data->user_data);
g_free(data);
+}
+
+static gboolean service_create_reply(gpointer user_data)
+{
+ struct service_create_data *data = user_data;
+
+ data->timeout = 0;
+ data->func(NULL, data->user_data);
+
+ __qmi_device_discovery_complete(data->device, data);
return FALSE;
}
@@ -1739,8 +1821,6 @@ static void service_create_callback(uint16_t message, uint16_t length,
uint16_t len;
unsigned int hash_id;
- g_source_remove(data->timeout);
-
result_code = tlv_get(buffer, length, 0x02, &len);
if (!result_code)
goto done;
@@ -1782,13 +1862,9 @@ static void service_create_callback(uint16_t message, uint16_t length,
done:
data->func(service, data->user_data);
-
qmi_service_unref(service);
- if (data->destroy)
- data->destroy(data->user_data);
-
- g_free(data);
+ __qmi_device_discovery_complete(data->device, data);
}
static void service_create_discover(uint8_t count,
@@ -1819,7 +1895,10 @@ static void service_create_discover(uint8_t count,
if (data->timeout > 0)
g_source_remove(data->timeout);
- g_timeout_add_seconds(0, service_create_reply, data);
+ data->timeout = g_timeout_add_seconds(0,
+ service_create_reply, data);
+ __qmi_device_discovery_started(device, data,
+ service_create_data_free);
return;
}
@@ -1864,6 +1943,8 @@ static bool service_create(struct qmi_device *device, bool shared,
done:
data->timeout = g_timeout_add_seconds(8, service_create_reply, data);
+ __qmi_device_discovery_started(device, data,
+ service_create_data_free);
return true;
}
@@ -1883,16 +1964,21 @@ bool qmi_service_create(struct qmi_device *device,
struct service_create_shared_data {
struct qmi_service *service;
+ struct qmi_device *device;
qmi_create_func_t func;
void *user_data;
qmi_destroy_func_t destroy;
+ guint timeout;
};
-static gboolean service_create_shared_reply(gpointer user_data)
+static void service_create_shared_data_free(gpointer user_data)
{
struct service_create_shared_data *data = user_data;
- data->func(data->service, data->user_data);
+ if (data->timeout) {
+ g_source_remove(data->timeout);
+ data->timeout = 0;
+ }
qmi_service_unref(data->service);
@@ -1900,6 +1986,16 @@ static gboolean service_create_shared_reply(gpointer user_data)
data->destroy(data->user_data);
g_free(data);
+}
+
+static gboolean service_create_shared_reply(gpointer user_data)
+{
+ struct service_create_shared_data *data = user_data;
+
+ data->timeout = 0;
+ data->func(data->service, data->user_data);
+
+ __qmi_device_discovery_complete(data->device, data);
return FALSE;
}
@@ -1927,12 +2023,15 @@ bool qmi_service_create_shared(struct qmi_device *device,
return false;
data->service = qmi_service_ref(service);
-
+ data->device = device;
data->func = func;
data->user_data = user_data;
data->destroy = destroy;
- g_timeout_add(0, service_create_shared_reply, data);
+ data->timeout = g_timeout_add(0,
+ service_create_shared_reply, data);
+ __qmi_device_discovery_started(device, data,
+ service_create_shared_data_free);
return 0;
}
--
2.10.2
3 years, 11 months
[PATCH] qmimodem: include shutdown in callback cleanup queue
by Lukasz Nowak
From: Lukasz Nowak <lnowak(a)tycoint.com>
Create a unified callback_data structure, used for all timeout callbacks.
This allows to maintain a single callback_queue, which cancels any active
timeouts, and frees callback data memory when a usb device is hot unplugged.
---
drivers/qmimodem/qmi.c | 399 ++++++++++++++++++++++---------------------------
1 file changed, 178 insertions(+), 221 deletions(-)
diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c
index 9b80455..6e2b55f 100644
--- a/drivers/qmimodem/qmi.c
+++ b/drivers/qmimodem/qmi.c
@@ -43,11 +43,6 @@
typedef void (*qmi_message_func_t)(uint16_t message, uint16_t length,
const void *buffer, void *user_data);
-struct discovery {
- void *discover_data;
- qmi_destroy_func_t destroy;
-};
-
struct qmi_device {
int ref_count;
int fd;
@@ -58,7 +53,7 @@ struct qmi_device {
GQueue *req_queue;
GQueue *control_queue;
GQueue *service_queue;
- GQueue *discovery_queue;
+ GQueue *callback_queue;
uint8_t next_control_tid;
uint16_t next_service_tid;
qmi_debug_func_t debug_func;
@@ -154,6 +149,89 @@ void qmi_free(void *ptr)
free(ptr);
}
+struct discover_data {
+ qmi_discover_func_t func;
+};
+
+struct shutdown_data {
+ qmi_shutdown_func_t func;
+};
+
+struct service_create_data {
+ bool shared;
+ uint8_t type;
+ uint16_t major;
+ uint16_t minor;
+ qmi_create_func_t func;
+};
+
+struct service_create_shared_data {
+ struct qmi_service *service;
+ qmi_create_func_t func;
+};
+
+struct callback_data {
+ struct qmi_device *device;
+ void *user_data;
+ qmi_destroy_func_t user_destroy;
+ qmi_destroy_func_t callback_destroy;
+ guint timeout;
+ union {
+ struct discover_data discover;
+ struct shutdown_data shutdown;
+ struct service_create_data service_create;
+ struct service_create_shared_data service_create_shared;
+ } data;
+};
+
+static void callback_data_free(struct callback_data *callback)
+{
+ if (callback->timeout) {
+ g_source_remove(callback->timeout);
+ callback->timeout = 0;
+ }
+
+ if (callback->callback_destroy)
+ callback->callback_destroy(callback);
+
+ if (callback->user_destroy)
+ callback->user_destroy(callback->user_data);
+
+ g_free(callback);
+}
+
+static void service_create_shared_free(gpointer user_data)
+{
+ struct callback_data *callback = user_data;
+
+ qmi_service_unref(callback->data.service_create_shared.service);
+}
+
+static void __callback_started(struct callback_data *callback)
+{
+ struct qmi_device *device = callback->device;
+
+ g_queue_push_tail(device->callback_queue, callback);
+}
+
+static void __callback_complete(struct callback_data *callback)
+{
+ struct qmi_device *device = callback->device;
+ GList *list;
+
+ list = g_queue_find(device->callback_queue, callback);
+ if (!list)
+ return;
+
+ g_queue_delete_link(device->callback_queue, list);
+ callback_data_free(callback);
+}
+
+static void __callback_free(gpointer data, gpointer user_data)
+{
+ callback_data_free(data);
+}
+
static struct qmi_request *__request_alloc(uint8_t service,
uint8_t client, uint16_t message,
uint16_t headroom, const void *data,
@@ -219,24 +297,6 @@ static gint __request_compare(gconstpointer a, gconstpointer b)
return req->tid - tid;
}
-static void __discovery_free(gpointer data, gpointer user_data)
-{
- struct discovery *d = data;
- qmi_destroy_func_t destroy = d->destroy;
-
- destroy(d->discover_data);
-}
-
-static gint __discovery_compare(gconstpointer a, gconstpointer b)
-{
- const struct discovery *d = a;
-
- if (d->discover_data == b)
- return 0;
-
- return 1;
-}
-
static void __notify_free(gpointer data, gpointer user_data)
{
struct qmi_notify *notify = data;
@@ -868,37 +928,6 @@ static void read_watch_destroy(gpointer user_data)
device->read_watch = 0;
}
-static void __qmi_device_discovery_started(struct qmi_device *device,
- void *discover_data,
- qmi_destroy_func_t destroy)
-{
- struct discovery *d;
-
- d = g_new0(struct discovery, 1);
- d->discover_data = discover_data;
- d->destroy = destroy;
-
- g_queue_push_tail(device->discovery_queue, d);
-}
-
-static void __qmi_device_discovery_complete(struct qmi_device *device,
- void *discover_data)
-{
- GList *list;
- struct discovery *d;
-
- list = g_queue_find_custom(device->req_queue,
- discover_data, __discovery_compare);
- if (!list)
- return;
-
- d = list->data;
- g_queue_delete_link(device->discovery_queue, list);
-
- d->destroy(d->discover_data);
- __discovery_free(d, NULL);
-}
-
static void service_destroy(gpointer data)
{
struct qmi_service *service = data;
@@ -952,7 +981,7 @@ struct qmi_device *qmi_device_new(int fd)
device->req_queue = g_queue_new();
device->control_queue = g_queue_new();
device->service_queue = g_queue_new();
- device->discovery_queue = g_queue_new();
+ device->callback_queue = g_queue_new();
device->service_list = g_hash_table_new_full(g_direct_hash,
g_direct_equal, NULL, service_destroy);
@@ -989,8 +1018,8 @@ void qmi_device_unref(struct qmi_device *device)
g_queue_foreach(device->req_queue, __request_free, NULL);
g_queue_free(device->req_queue);
- g_queue_foreach(device->discovery_queue, __discovery_free, NULL);
- g_queue_free(device->discovery_queue);
+ g_queue_foreach(device->callback_queue, __callback_free, NULL);
+ g_queue_free(device->callback_queue);
if (device->write_watch > 0)
g_source_remove(device->write_watch);
@@ -1051,34 +1080,12 @@ static const void *tlv_get(const void *data, uint16_t size,
return NULL;
}
-struct discover_data {
- struct qmi_device *device;
- qmi_discover_func_t func;
- void *user_data;
- qmi_destroy_func_t destroy;
- guint timeout;
-};
-
-static void discover_data_free(gpointer user_data)
-{
- struct discover_data *data = user_data;
-
- if (data->timeout) {
- g_source_remove(data->timeout);
- data->timeout = 0;
- }
-
- if (data->destroy)
- data->destroy(data->user_data);
-
- g_free(data);
-}
-
static void discover_callback(uint16_t message, uint16_t length,
const void *buffer, void *user_data)
{
- struct discover_data *data = user_data;
- struct qmi_device *device = data->device;
+ struct callback_data *callback = user_data;
+ struct discover_data *data = &callback->data.discover;
+ struct qmi_device *device = callback->device;
const struct qmi_result_code *result_code;
const struct qmi_service_list *service_list;
const void *ptr;
@@ -1155,23 +1162,22 @@ done:
device->version_count = count;
if (data->func)
- data->func(count, list, data->user_data);
+ data->func(count, list, callback->user_data);
- __qmi_device_discovery_complete(data->device, data);
+ __callback_complete(callback);
}
static gboolean discover_reply(gpointer user_data)
{
- struct discover_data *data = user_data;
- struct qmi_device *device = data->device;
-
- data->timeout = 0;
+ struct callback_data *callback = user_data;
+ struct discover_data *data = &callback->data.discover;
+ struct qmi_device *device = callback->device;
if (data->func)
data->func(device->version_count,
- device->version_list, data->user_data);
+ device->version_list, callback->user_data);
- __qmi_device_discovery_complete(data->device, data);
+ __callback_complete(callback);
return FALSE;
}
@@ -1179,7 +1185,7 @@ static gboolean discover_reply(gpointer user_data)
bool qmi_device_discover(struct qmi_device *device, qmi_discover_func_t func,
void *user_data, qmi_destroy_func_t destroy)
{
- struct discover_data *data;
+ struct callback_data *callback;
struct qmi_request *req;
struct qmi_control_hdr *hdr;
@@ -1188,27 +1194,27 @@ bool qmi_device_discover(struct qmi_device *device, qmi_discover_func_t func,
__debug_device(device, "device %p discover", device);
- data = g_try_new0(struct discover_data, 1);
- if (!data)
+ callback = g_try_new0(struct callback_data, 1);
+ if (!callback)
return false;
- data->device = device;
- data->func = func;
- data->user_data = user_data;
- data->destroy = destroy;
+ callback->device = device;
+ callback->user_data = user_data;
+ callback->user_destroy = destroy;
+ callback->data.discover.func = func;
if (device->version_list) {
- data->timeout = g_timeout_add_seconds(0, discover_reply, data);
- __qmi_device_discovery_started(device, data,
- discover_data_free);
+ callback->timeout = g_timeout_add_seconds(0, discover_reply,
+ callback);
+ __callback_started(callback);
return true;
}
req = __request_alloc(QMI_SERVICE_CONTROL, 0x00,
QMI_CTL_GET_VERSION_INFO, QMI_CONTROL_HDR_SIZE,
- NULL, 0, discover_callback, data, (void **) &hdr);
+ NULL, 0, discover_callback, callback, (void **) &hdr);
if (!req) {
- g_free(data);
+ g_free(callback);
return false;
}
@@ -1220,8 +1226,8 @@ bool qmi_device_discover(struct qmi_device *device, qmi_discover_func_t func,
__request_submit(device, req, hdr->transaction);
- data->timeout = g_timeout_add_seconds(5, discover_reply, data);
- __qmi_device_discovery_started(device, data, discover_data_free);
+ callback->timeout = g_timeout_add_seconds(5, discover_reply, callback);
+ __callback_started(callback);
return true;
}
@@ -1252,39 +1258,34 @@ static void release_client(struct qmi_device *device,
__request_submit(device, req, hdr->transaction);
}
-struct shutdown_data {
- struct qmi_device *device;
- qmi_shutdown_func_t func;
- void *user_data;
- qmi_destroy_func_t destroy;
-};
-
static gboolean shutdown_reply(gpointer user_data)
{
- struct shutdown_data *data = user_data;
+ struct callback_data *callback = user_data;
+ struct shutdown_data *data = &callback->data.shutdown;
if (data->func)
- data->func(data->user_data);
+ data->func(callback->user_data);
- g_free(data);
+ __callback_complete(callback);
return FALSE;
}
static gboolean shutdown_timeout(gpointer user_data)
{
- struct shutdown_data *data = user_data;
- struct qmi_device *device = data->device;
+ struct callback_data *callback = user_data;
+ struct qmi_device *device = callback->device;
if (device->release_users > 0)
return TRUE;
- return shutdown_reply(data);
+ return shutdown_reply(callback);
}
bool qmi_device_shutdown(struct qmi_device *device, qmi_shutdown_func_t func,
void *user_data, qmi_destroy_func_t destroy)
{
+ struct callback_data *callback;
struct shutdown_data *data;
if (!device)
@@ -1292,19 +1293,22 @@ bool qmi_device_shutdown(struct qmi_device *device, qmi_shutdown_func_t func,
__debug_device(device, "device %p shutdown", device);
- data = g_try_new0(struct shutdown_data, 1);
- if (!data)
+ callback = g_try_new0(struct callback_data, 1);
+ if (!callback)
return false;
- data->device = device;
+ callback->device = device;
+ callback->user_data = user_data;
+ callback->user_destroy = destroy;
+ data = &callback->data.shutdown;
data->func = func;
- data->user_data = user_data;
- data->destroy = destroy;
if (device->release_users > 0)
- g_timeout_add_seconds(0, shutdown_timeout, data);
+ g_timeout_add_seconds(0, shutdown_timeout, callback);
else
- g_timeout_add_seconds(0, shutdown_reply, data);
+ g_timeout_add_seconds(0, shutdown_reply, callback);
+
+ __callback_started(callback);
return true;
}
@@ -1771,41 +1775,13 @@ bool qmi_result_get_uint64(struct qmi_result *result, uint8_t type,
return true;
}
-struct service_create_data {
- struct qmi_device *device;
- bool shared;
- uint8_t type;
- uint16_t major;
- uint16_t minor;
- qmi_create_func_t func;
- void *user_data;
- qmi_destroy_func_t destroy;
- guint timeout;
-};
-
-static void service_create_data_free(gpointer user_data)
-{
- struct service_create_data *data = user_data;
-
- if (data->timeout) {
- g_source_remove(data->timeout);
- data->timeout = 0;
- }
-
- if (data->destroy)
- data->destroy(data->user_data);
-
- g_free(data);
-}
-
static gboolean service_create_reply(gpointer user_data)
{
- struct service_create_data *data = user_data;
+ struct callback_data *callback = user_data;
- data->timeout = 0;
- data->func(NULL, data->user_data);
+ callback->data.service_create.func(NULL, callback->user_data);
- __qmi_device_discovery_complete(data->device, data);
+ __callback_complete(callback);
return FALSE;
}
@@ -1813,8 +1789,9 @@ static gboolean service_create_reply(gpointer user_data)
static void service_create_callback(uint16_t message, uint16_t length,
const void *buffer, void *user_data)
{
- struct service_create_data *data = user_data;
- struct qmi_device *device = data->device;
+ struct callback_data *callback = user_data;
+ struct service_create_data *data = &callback->data.service_create;
+ struct qmi_device *device = callback->device;
struct qmi_service *service = NULL;
const struct qmi_result_code *result_code;
const struct qmi_client_id *client_id;
@@ -1843,7 +1820,7 @@ static void service_create_callback(uint16_t message, uint16_t length,
goto done;
service->ref_count = 1;
- service->device = data->device;
+ service->device = callback->device;
service->shared = data->shared;
service->type = data->type;
@@ -1861,17 +1838,18 @@ static void service_create_callback(uint16_t message, uint16_t length,
GUINT_TO_POINTER(hash_id), service);
done:
- data->func(service, data->user_data);
+ data->func(service, callback->user_data);
qmi_service_unref(service);
- __qmi_device_discovery_complete(data->device, data);
+ __callback_complete(callback);
}
static void service_create_discover(uint8_t count,
const struct qmi_version *list, void *user_data)
{
- struct service_create_data *data = user_data;
- struct qmi_device *device = data->device;
+ struct callback_data *callback = user_data;
+ struct service_create_data *data = &callback->data.service_create;
+ struct qmi_device *device = callback->device;
struct qmi_request *req;
struct qmi_control_hdr *hdr;
unsigned char client_req[] = { 0x01, 0x01, 0x00, data->type };
@@ -1890,15 +1868,14 @@ static void service_create_discover(uint8_t count,
req = __request_alloc(QMI_SERVICE_CONTROL, 0x00,
QMI_CTL_GET_CLIENT_ID, QMI_CONTROL_HDR_SIZE,
client_req, sizeof(client_req),
- service_create_callback, data, (void **) &hdr);
+ service_create_callback, callback, (void **) &hdr);
if (!req) {
- if (data->timeout > 0)
- g_source_remove(data->timeout);
+ if (callback->timeout > 0)
+ g_source_remove(callback->timeout);
- data->timeout = g_timeout_add_seconds(0,
- service_create_reply, data);
- __qmi_device_discovery_started(device, data,
- service_create_data_free);
+ callback->timeout = g_timeout_add_seconds(0,
+ service_create_reply, callback);
+ __callback_started(callback);
return;
}
@@ -1915,36 +1892,39 @@ static bool service_create(struct qmi_device *device, bool shared,
uint8_t type, qmi_create_func_t func,
void *user_data, qmi_destroy_func_t destroy)
{
+ struct callback_data *callback;
struct service_create_data *data;
- data = g_try_new0(struct service_create_data, 1);
- if (!data)
+ callback = g_try_new0(struct callback_data, 1);
+ if (!callback)
return false;
- data->device = device;
+ callback->device = device;
+ callback->user_data = user_data;
+ callback->user_destroy = destroy;
+ data = &callback->data.service_create;
+ data->func = func;
data->shared = shared;
data->type = type;
- data->func = func;
- data->user_data = user_data;
- data->destroy = destroy;
if (device->version_list) {
service_create_discover(device->version_count,
- device->version_list, data);
+ device->version_list, callback);
goto done;
}
- if (qmi_device_discover(device, service_create_discover, data, NULL))
+ if (qmi_device_discover(device, service_create_discover, callback,
+ NULL))
goto done;
- g_free(data);
+ g_free(callback);
return false;
done:
- data->timeout = g_timeout_add_seconds(8, service_create_reply, data);
- __qmi_device_discovery_started(device, data,
- service_create_data_free);
+ callback->timeout = g_timeout_add_seconds(8, service_create_reply,
+ callback);
+ __callback_started(callback);
return true;
}
@@ -1962,40 +1942,15 @@ bool qmi_service_create(struct qmi_device *device,
return service_create(device, false, type, func, user_data, destroy);
}
-struct service_create_shared_data {
- struct qmi_service *service;
- struct qmi_device *device;
- qmi_create_func_t func;
- void *user_data;
- qmi_destroy_func_t destroy;
- guint timeout;
-};
-
-static void service_create_shared_data_free(gpointer user_data)
-{
- struct service_create_shared_data *data = user_data;
-
- if (data->timeout) {
- g_source_remove(data->timeout);
- data->timeout = 0;
- }
-
- qmi_service_unref(data->service);
-
- if (data->destroy)
- data->destroy(data->user_data);
-
- g_free(data);
-}
-
static gboolean service_create_shared_reply(gpointer user_data)
{
- struct service_create_shared_data *data = user_data;
+ struct callback_data *callback = user_data;
+ struct service_create_shared_data *data =
+ &callback->data.service_create_shared;
- data->timeout = 0;
- data->func(data->service, data->user_data);
+ data->func(data->service, callback->user_data);
- __qmi_device_discovery_complete(data->device, data);
+ __callback_complete(callback);
return FALSE;
}
@@ -2016,22 +1971,24 @@ bool qmi_service_create_shared(struct qmi_device *device,
service = g_hash_table_find(device->service_list,
__service_compare_shared, GUINT_TO_POINTER(type_val));
if (service) {
+ struct callback_data *callback;
struct service_create_shared_data *data;
- data = g_try_new0(struct service_create_shared_data, 1);
- if (!data)
+ callback = g_try_new0(struct callback_data, 1);
+ if (!callback)
return false;
+ callback->device = device;
+ callback->user_data = user_data;
+ callback->user_destroy = destroy;
+ callback->callback_destroy = service_create_shared_free;
+ data = &callback->data.service_create_shared;
data->service = qmi_service_ref(service);
- data->device = device;
data->func = func;
- data->user_data = user_data;
- data->destroy = destroy;
- data->timeout = g_timeout_add(0,
- service_create_shared_reply, data);
- __qmi_device_discovery_started(device, data,
- service_create_shared_data_free);
+ callback->timeout = g_timeout_add(0,
+ service_create_shared_reply, callback);
+ __callback_started(callback);
return 0;
}
--
2.7.4
3 years, 11 months
[PATCH v3] atmodem: telit - re-attach gprs automatically
by Lukasz Nowak
From: Lukasz Nowak <lnowak(a)tycoint.com>
Telit AT modem firmware (tested with UE910-EUR) generates
+CGREG: 0\r\n\r\n+CGEV: NW DETACH
after a context is de-activated and ppp connection closed.
Then, after a random amount of time (observed from a few seconds
to a few hours), an unsolicited +CGREG: 1 arrives.
Attempt to fix the problem, by sending AT+CGATT=1 once.
This does not re-activate the context, but if a network connection
is still correct, will generate an immediate +CGREG: 1.
---
drivers/atmodem/gprs.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
index 7ea9f00..9e4c6c9 100644
--- a/drivers/atmodem/gprs.c
+++ b/drivers/atmodem/gprs.c
@@ -50,6 +50,8 @@ struct gprs_data {
GAtChat *chat;
unsigned int vendor;
unsigned int last_auto_context_id;
+ gboolean telit_try_reattach;
+ int attached;
};
static void at_cgatt_cb(gboolean ok, GAtResult *result, gpointer user_data)
@@ -73,8 +75,10 @@ static void at_gprs_set_attached(struct ofono_gprs *gprs, int attached,
snprintf(buf, sizeof(buf), "AT+CGATT=%i", attached ? 1 : 0);
if (g_at_chat_send(gd->chat, buf, none_prefix,
- at_cgatt_cb, cbd, g_free) > 0)
+ at_cgatt_cb, cbd, g_free) > 0) {
+ gd->attached = attached;
return;
+ }
g_free(cbd);
@@ -194,6 +198,28 @@ static void cgreg_notify(GAtResult *result, gpointer user_data)
NULL, NULL, NULL, gd->vendor) == FALSE)
return;
+ /*
+ * Telit AT modem firmware (tested with UE910-EUR) generates
+ * +CGREG: 0\r\n\r\n+CGEV: NW DETACH
+ * after a context is de-activated and ppp connection closed.
+ * Then, after a random amount of time (observed from a few seconds
+ * to a few hours), an unsolicited +CGREG: 1 arrives.
+ * Attempt to fix the problem, by sending AT+CGATT=1 once.
+ * This does not re-activate the context, but if a network connection
+ * is still correct, will generate an immediate +CGREG: 1.
+ */
+ if (gd->vendor == OFONO_VENDOR_TELIT) {
+ if (gd->attached && !status && !gd->telit_try_reattach) {
+ DBG("Trying to re-attach gprs network");
+ gd->telit_try_reattach = TRUE;
+ g_at_chat_send(gd->chat, "AT+CGATT=1", none_prefix,
+ NULL, NULL, NULL);
+ return;
+ }
+
+ gd->telit_try_reattach = FALSE;
+ }
+
ofono_gprs_status_notify(gprs, status);
}
@@ -214,6 +240,11 @@ static void cgev_notify(GAtResult *result, gpointer user_data)
if (g_str_equal(event, "NW DETACH") ||
g_str_equal(event, "ME DETACH")) {
+ if (gd->vendor == OFONO_VENDOR_TELIT &&
+ gd->telit_try_reattach)
+ return;
+
+ gd->attached = FALSE;
ofono_gprs_detached_notify(gprs);
return;
} else if (g_str_has_prefix(event, "ME PDN ACT")) {
--
2.7.4
3 years, 11 months
[PATCH udev v3 0/5] Device handling cleanups
by Jonas Bonn
This is version 3 of the udev handling cleanups.
Changes since v2:
* Addressed comments from Denis
Changes since v1:
* Reworked patch 1/5 (was 11/15) to handle 'legacy' devices in a simpler
manner.
* Addressed comments from Denis
Original blurb follows:
This is a series of incremental cleanups to the libudev device handling
code.
- the early patches in the series are all good cleanups that can be
taken irregardless of whether the last patches are desired
- the last patches are more intrusive as they attempt to move the
functionality of udev.c into udevng.c
Somebody with access to old hardware really needs to take a look at
this series to see if the migration to udevng works properly. I do
not have any such hardware, myself. I suspect that there's not many
such devices in circulation; my hope is that this legacy code works
for now and can be ripped out in time.
In any case, if someone has such old hardware, hopefully these changes
are sufficiently correct that the last bugs can shake themselves out
easily... we'll see.
Jonas Bonn (5):
udevng: add serial device handling functions
udevng: match on the hsi subsystem for legacy devices
udevng: hook up legacy devices
udevng: get properties from interface
plugins: remove udev module
Makefile.am | 2 -
plugins/udev.c | 431 -------------------------------------------------------
plugins/udevng.c | 292 ++++++++++++++++++++++++++++++++++---
3 files changed, 272 insertions(+), 453 deletions(-)
delete mode 100644 plugins/udev.c
--
2.9.3
3 years, 11 months
[PATCH v2] qmimodem: add protection against modem_unregister
by Lukasz Nowak
From: Lukasz Nowak <lnowak(a)tycoint.com>
The qmimodem driver sets up numerous timeouts, passing internal
data structures to them as user_data. If a physical modem device
is removed, udev will call modem_unregister, which in turn will
call gobi_remove(). That function calls qmi_device_unref() which
frees all internal data structure memory inside qmidriver.
If a timeout is in progress while the usb device is removed,
the callback function will operate on already freed memory,
causing unpredicatble results. In some cases nothing bad will
happen, in others - segfault.
In order to solve this problem, store all created timeouts in
a list, and when the driver data is freed in qmi_device_unref()
remove all active timeout sources.
---
drivers/qmimodem/qmi.c | 60 +++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 54 insertions(+), 6 deletions(-)
diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c
index 39fbb19..b9260b1 100644
--- a/drivers/qmimodem/qmi.c
+++ b/drivers/qmimodem/qmi.c
@@ -64,6 +64,7 @@ struct qmi_device {
uint8_t version_count;
GHashTable *service_list;
unsigned int release_users;
+ GList *timeout_list;
};
struct qmi_service {
@@ -914,6 +915,11 @@ struct qmi_device *qmi_device_ref(struct qmi_device *device)
return device;
}
+static void timeout_remove(gpointer data)
+{
+ g_source_remove(GPOINTER_TO_UINT(data));
+}
+
void qmi_device_unref(struct qmi_device *device)
{
if (!device)
@@ -939,6 +945,8 @@ void qmi_device_unref(struct qmi_device *device)
if (device->read_watch > 0)
g_source_remove(device->read_watch);
+ g_list_free_full(device->timeout_list, timeout_remove);
+
if (device->close_on_unref)
close(device->fd);
@@ -1014,6 +1022,8 @@ static void discover_callback(uint16_t message, uint16_t length,
unsigned int i;
g_source_remove(data->timeout);
+ device->timeout_list = g_list_remove(device->timeout_list,
+ GUINT_TO_POINTER(data->timeout));
count = 0;
list = NULL;
@@ -1096,6 +1106,8 @@ static gboolean discover_reply(gpointer user_data)
struct discover_data *data = user_data;
struct qmi_device *device = data->device;
+ device->timeout_list = g_list_remove(device->timeout_list,
+ GUINT_TO_POINTER(data->timeout));
data->timeout = 0;
if (data->func)
@@ -1132,7 +1144,9 @@ bool qmi_device_discover(struct qmi_device *device, qmi_discover_func_t func,
data->destroy = destroy;
if (device->version_list) {
- g_timeout_add_seconds(0, discover_reply, data);
+ data->timeout = g_timeout_add_seconds(0, discover_reply, data);
+ device->timeout_list = g_list_append(device->timeout_list,
+ GUINT_TO_POINTER(data->timeout));
return true;
}
@@ -1153,6 +1167,8 @@ bool qmi_device_discover(struct qmi_device *device, qmi_discover_func_t func,
__request_submit(device, req, hdr->transaction);
data->timeout = g_timeout_add_seconds(5, discover_reply, data);
+ device->timeout_list = g_list_append(device->timeout_list,
+ GUINT_TO_POINTER(data->timeout));
return true;
}
@@ -1188,11 +1204,16 @@ struct shutdown_data {
qmi_shutdown_func_t func;
void *user_data;
qmi_destroy_func_t destroy;
+ guint timeout;
};
static gboolean shutdown_reply(gpointer user_data)
{
struct shutdown_data *data = user_data;
+ struct qmi_device *device = data->device;
+
+ device->timeout_list = g_list_remove(device->timeout_list,
+ GUINT_TO_POINTER(data->timeout));
if (data->func)
data->func(data->user_data);
@@ -1233,9 +1254,13 @@ bool qmi_device_shutdown(struct qmi_device *device, qmi_shutdown_func_t func,
data->destroy = destroy;
if (device->release_users > 0)
- g_timeout_add_seconds(0, shutdown_timeout, data);
+ data->timeout = g_timeout_add_seconds(0, shutdown_timeout,
+ data);
else
- g_timeout_add_seconds(0, shutdown_reply, data);
+ data->timeout = g_timeout_add_seconds(0, shutdown_reply, data);
+
+ device->timeout_list = g_list_append(device->timeout_list,
+ GUINT_TO_POINTER(data->timeout));
return true;
}
@@ -1717,6 +1742,10 @@ struct service_create_data {
static gboolean service_create_reply(gpointer user_data)
{
struct service_create_data *data = user_data;
+ struct qmi_device *device = data->device;
+
+ device->timeout_list = g_list_remove(device->timeout_list,
+ GUINT_TO_POINTER(data->timeout));
data->func(NULL, data->user_data);
@@ -1740,6 +1769,8 @@ static void service_create_callback(uint16_t message, uint16_t length,
unsigned int hash_id;
g_source_remove(data->timeout);
+ device->timeout_list = g_list_remove(device->timeout_list,
+ GUINT_TO_POINTER(data->timeout));
result_code = tlv_get(buffer, length, 0x02, &len);
if (!result_code)
@@ -1816,10 +1847,17 @@ static void service_create_discover(uint8_t count,
client_req, sizeof(client_req),
service_create_callback, data, (void **) &hdr);
if (!req) {
- if (data->timeout > 0)
+ if (data->timeout > 0) {
g_source_remove(data->timeout);
+ device->timeout_list =
+ g_list_remove(device->timeout_list,
+ GUINT_TO_POINTER(data->timeout));
+ }
- g_timeout_add_seconds(0, service_create_reply, data);
+ data->timeout = g_timeout_add_seconds(0, service_create_reply,
+ data);
+ device->timeout_list = g_list_append(device->timeout_list,
+ GUINT_TO_POINTER(data->timeout));
return;
}
@@ -1864,6 +1902,8 @@ static bool service_create(struct qmi_device *device, bool shared,
done:
data->timeout = g_timeout_add_seconds(8, service_create_reply, data);
+ device->timeout_list = g_list_append(device->timeout_list,
+ GUINT_TO_POINTER(data->timeout));
return true;
}
@@ -1886,11 +1926,16 @@ struct service_create_shared_data {
qmi_create_func_t func;
void *user_data;
qmi_destroy_func_t destroy;
+ guint timeout;
};
static gboolean service_create_shared_reply(gpointer user_data)
{
struct service_create_shared_data *data = user_data;
+ struct qmi_device *device = data->service->device;
+
+ device->timeout_list = g_list_remove(device->timeout_list,
+ GUINT_TO_POINTER(data->timeout));
data->func(data->service, data->user_data);
@@ -1932,7 +1977,10 @@ bool qmi_service_create_shared(struct qmi_device *device,
data->user_data = user_data;
data->destroy = destroy;
- g_timeout_add(0, service_create_shared_reply, data);
+ data->timeout = g_timeout_add(0, service_create_shared_reply,
+ data);
+ device->timeout_list = g_list_append(device->timeout_list,
+ GUINT_TO_POINTER(data->timeout));
return 0;
}
--
2.7.4
3 years, 11 months
[PATCH v2] atmodem: telit - re-attach gprs automatically
by Lukasz Nowak
From: Lukasz Nowak <lnowak(a)tycoint.com>
Telit AT modem firmware (tested with UE910-EUR) generates
+CGREG: 0\r\n\r\n+CGEV: NW DETACH
after a context is de-activated and ppp connection closed.
Then, after a random amount of time (observed from a few seconds
to a few hours), an unsolicited +CGREG: 1 arrives.
Attempt to fix the problem, by sending AT+CGATT=1 once.
This does not re-activate the context, but if a network connection
is still correct, will generate an immediate +CGREG: 1.
---
drivers/atmodem/gprs.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
index 7ea9f00..3a6364e 100644
--- a/drivers/atmodem/gprs.c
+++ b/drivers/atmodem/gprs.c
@@ -50,6 +50,8 @@ struct gprs_data {
GAtChat *chat;
unsigned int vendor;
unsigned int last_auto_context_id;
+ gboolean telit_try_reattach;
+ int attached;
};
static void at_cgatt_cb(gboolean ok, GAtResult *result, gpointer user_data)
@@ -73,8 +75,10 @@ static void at_gprs_set_attached(struct ofono_gprs *gprs, int attached,
snprintf(buf, sizeof(buf), "AT+CGATT=%i", attached ? 1 : 0);
if (g_at_chat_send(gd->chat, buf, none_prefix,
- at_cgatt_cb, cbd, g_free) > 0)
+ at_cgatt_cb, cbd, g_free) > 0) {
+ gd->attached = attached;
return;
+ }
g_free(cbd);
@@ -194,6 +198,28 @@ static void cgreg_notify(GAtResult *result, gpointer user_data)
NULL, NULL, NULL, gd->vendor) == FALSE)
return;
+ /*
+ * Telit AT modem firmware (tested with UE910-EUR) generates
+ * +CGREG: 0\r\n\r\n+CGEV: NW DETACH
+ * after a context is de-activated and ppp connection closed.
+ * Then, after a random amount of time (observed from a few seconds
+ * to a few hours), an unsolicited +CGREG: 1 arrives.
+ * Attempt to fix the problem, by sending AT+CGATT=1 once.
+ * This does not re-activate the context, but if a network connection
+ * is still correct, will generate an immediate +CGREG: 1.
+ */
+ if (gd->vendor == OFONO_VENDOR_TELIT) {
+ if (gd->attached && !status && !gd->telit_try_reattach) {
+ DBG("Trying to re-attach gprs network");
+ gd->telit_try_reattach = TRUE;
+ g_at_chat_send(gd->chat, "AT+CGATT=1", none_prefix,
+ NULL, NULL, NULL);
+ return;
+ }
+
+ gd->telit_try_reattach = FALSE;
+ }
+
ofono_gprs_status_notify(gprs, status);
}
@@ -214,6 +240,10 @@ static void cgev_notify(GAtResult *result, gpointer user_data)
if (g_str_equal(event, "NW DETACH") ||
g_str_equal(event, "ME DETACH")) {
+ if (gd->vendor == OFONO_VENDOR_TELIT &&
+ gd->telit_try_reattach)
+ return;
+
ofono_gprs_detached_notify(gprs);
return;
} else if (g_str_has_prefix(event, "ME PDN ACT")) {
--
2.7.4
3 years, 11 months
[PATCH] unit: rilmodem-test - add missing string.h
by Lukasz Nowak
From: Lukasz Nowak <lnowak(a)tycoint.com>
Remove warnings of undeclared memcpy, strncpy, etc.
---
unit/rilmodem-test-engine.c | 1 +
unit/rilmodem-test-server.c | 1 +
unit/test-rilmodem-cs.c | 1 +
unit/test-rilmodem-sms.c | 1 +
4 files changed, 4 insertions(+)
diff --git a/unit/rilmodem-test-engine.c b/unit/rilmodem-test-engine.c
index c569360..7cbc1ad 100644
--- a/unit/rilmodem-test-engine.c
+++ b/unit/rilmodem-test-engine.c
@@ -29,6 +29,7 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
+#include <string.h>
#include <ofono/types.h>
diff --git a/unit/rilmodem-test-server.c b/unit/rilmodem-test-server.c
index 17e5090..5a3b03a 100644
--- a/unit/rilmodem-test-server.c
+++ b/unit/rilmodem-test-server.c
@@ -28,6 +28,7 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
+#include <string.h>
#include <ofono/types.h>
diff --git a/unit/test-rilmodem-cs.c b/unit/test-rilmodem-cs.c
index bfa2a72..ae7abec 100644
--- a/unit/test-rilmodem-cs.c
+++ b/unit/test-rilmodem-cs.c
@@ -32,6 +32,7 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
+#include <string.h>
#include <ofono/modem.h>
#include <ofono/types.h>
diff --git a/unit/test-rilmodem-sms.c b/unit/test-rilmodem-sms.c
index 1ed1b51..70c7386 100644
--- a/unit/test-rilmodem-sms.c
+++ b/unit/test-rilmodem-sms.c
@@ -32,6 +32,7 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
+#include <string.h>
#include <ofono/modem.h>
#include <ofono/types.h>
--
2.7.4
3 years, 11 months