mirror of git://git.sysmocom.de/ofono
NOT_FOR_MERGE: decode qmi messages with libqmi
This commit is contained in:
parent
f3217f6c70
commit
00b341c77f
|
@ -295,7 +295,8 @@ builtin_sources += $(qmi_sources) \
|
||||||
drivers/qmimodem/lte.c \
|
drivers/qmimodem/lte.c \
|
||||||
drivers/qmimodem/radio-settings.c \
|
drivers/qmimodem/radio-settings.c \
|
||||||
drivers/qmimodem/location-reporting.c \
|
drivers/qmimodem/location-reporting.c \
|
||||||
drivers/qmimodem/netmon.c
|
drivers/qmimodem/netmon.c \
|
||||||
|
drivers/qmimodem/qmibridge.c
|
||||||
|
|
||||||
builtin_modules += gobi
|
builtin_modules += gobi
|
||||||
builtin_sources += plugins/gobi.c
|
builtin_sources += plugins/gobi.c
|
||||||
|
@ -729,7 +730,7 @@ src_ofonod_SOURCES = $(builtin_sources) $(gatchat_sources) \
|
||||||
src/netmonagent.c src/netmonagent.h src/call-list.c
|
src/netmonagent.c src/netmonagent.h src/call-list.c
|
||||||
|
|
||||||
src_ofonod_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) $(ell_ldadd) \
|
src_ofonod_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) $(ell_ldadd) \
|
||||||
@GLIB_LIBS@ @DBUS_LIBS@ -ldl
|
@GLIB_LIBS@ @DBUS_LIBS@ -ldl -lqmi-glib
|
||||||
|
|
||||||
src_ofonod_LDFLAGS = -Wl,--export-dynamic \
|
src_ofonod_LDFLAGS = -Wl,--export-dynamic \
|
||||||
-Wl,--version-script=$(srcdir)/src/ofono.ver
|
-Wl,--version-script=$(srcdir)/src/ofono.ver
|
||||||
|
@ -752,7 +753,7 @@ AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ $(ell_cflags) $(builtin_cflags) \
|
||||||
|
|
||||||
AM_CPPFLAGS = -I$(builddir)/include -I$(builddir)/src -I$(srcdir)/src \
|
AM_CPPFLAGS = -I$(builddir)/include -I$(builddir)/src -I$(srcdir)/src \
|
||||||
-I$(srcdir)/gdbus -I$(srcdir)/gisi -I$(srcdir)/gatchat \
|
-I$(srcdir)/gdbus -I$(srcdir)/gisi -I$(srcdir)/gatchat \
|
||||||
-I$(srcdir)/btio -I$(srcdir)/gril
|
-I$(srcdir)/btio -I$(srcdir)/gril -I/usr/include/libqmi-glib
|
||||||
|
|
||||||
doc_files = doc/overview.txt doc/ofono-paper.txt doc/release-faq.txt \
|
doc_files = doc/overview.txt doc/ofono-paper.txt doc/release-faq.txt \
|
||||||
doc/manager-api.txt doc/modem-api.txt doc/network-api.txt \
|
doc/manager-api.txt doc/modem-api.txt doc/network-api.txt \
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
#include <ofono/log.h>
|
#include <ofono/log.h>
|
||||||
|
|
||||||
|
#include "qmibridge.h"
|
||||||
#include "qmi.h"
|
#include "qmi.h"
|
||||||
#include "ctl.h"
|
#include "ctl.h"
|
||||||
|
|
||||||
|
@ -664,6 +665,8 @@ static gboolean can_write_data(GIOChannel *channel, GIOCondition cond,
|
||||||
__debug_msg(' ', req->buf, bytes_written,
|
__debug_msg(' ', req->buf, bytes_written,
|
||||||
device->debug_func, device->debug_data);
|
device->debug_func, device->debug_data);
|
||||||
|
|
||||||
|
qmibridge_decode_req(req->buf, req->len);
|
||||||
|
|
||||||
hdr = req->buf;
|
hdr = req->buf;
|
||||||
|
|
||||||
if (hdr->service == QMI_SERVICE_CONTROL)
|
if (hdr->service == QMI_SERVICE_CONTROL)
|
||||||
|
@ -874,6 +877,7 @@ static gboolean received_data(GIOChannel *channel, GIOCondition cond,
|
||||||
__hexdump('<', buf, bytes_read,
|
__hexdump('<', buf, bytes_read,
|
||||||
device->debug_func, device->debug_data);
|
device->debug_func, device->debug_data);
|
||||||
|
|
||||||
|
qmibridge_decode_read(buf, bytes_read);
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
|
||||||
while (offset < bytes_read) {
|
while (offset < bytes_read) {
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
|
||||||
|
#include <libqmi-glib.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <ofono/log.h>
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
static void ask_qmi(const char *prefix, void *data, size_t len)
|
||||||
|
{
|
||||||
|
/* from osmo-qcdiag */
|
||||||
|
GByteArray *buffer;
|
||||||
|
GError *error = NULL;
|
||||||
|
QmiMessage *message;
|
||||||
|
gchar *printable;
|
||||||
|
|
||||||
|
buffer = g_byte_array_sized_new(len);
|
||||||
|
g_byte_array_append(buffer, data, len);
|
||||||
|
|
||||||
|
message = qmi_message_new_from_raw(buffer, &error);
|
||||||
|
if (!message) {
|
||||||
|
fprintf(stderr, "qmi_message_new_from_raw() returned NULL\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
printable = qmi_message_get_printable(message, "QMI ");
|
||||||
|
DBG("%s: %s", prefix, printable);
|
||||||
|
|
||||||
|
qmi_message_unref(message);
|
||||||
|
g_byte_array_free(buffer, TRUE);
|
||||||
|
g_free(printable);
|
||||||
|
}
|
||||||
|
void qmibridge_decode_read(void *data, size_t len)
|
||||||
|
{
|
||||||
|
ask_qmi("READ", data, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void qmibridge_decode_req(void *data, size_t len)
|
||||||
|
{
|
||||||
|
ask_qmi("_REQ", data, len);
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
void qmibridge_decode_read(void *data, size_t len);
|
||||||
|
void qmibridge_decode_req(void *data, size_t len);
|
Loading…
Reference in New Issue