aleksander/qmi-proxy

Aleksander Morgado aleksander at lanedo.com
Fri Aug 9 05:18:50 PDT 2013


Hey hey,

GUADEC has been pretty productive... :)

There's a new branch in upstream libqmi git repo called
'aleksander/qmi-proxy':

http://cgit.freedesktop.org/libqmi/log?h=aleksander%2Fqmi-proxy

This branch allows a QmiDevice to get opened with a new
QMI_DEVICE_OPEN_FLAGS_PROXY flag; which will automatically launch a
'qmi-proxy' daemon which takes care of talking to the actual QMI port.

qmicli has also a new '--device-open-proxy' option to force using the
'qmi-proxy'.

Internally, there are only a couple of special things to consider.
First, a new 'CTL Internal Proxy Open' request/response set that I made
up so that the user of the libqmi-glib library tells the proxy which
port it is interested in. Second, the communication between the proxy
and the clients is done through an abstract socket with a
well-known-name (\0qmi-proxy). All the messages between the proxy and
its clients are QMI messages. And last, the QmiClientCtl in the proxy is
shared between all remote clients, and the proxy takes care of fixing up
the transaction ID for each remote client when using the CTL service.

The 'qmi-proxy' will exit itself if there are 30s of inactivity (i.e. no
remote clients connected to it). If you want to debug the qmi-proxy
itself, you can run it manually (before any other application requested
to run it):

  $> sudo /usr/libexec/qmi-proxy --verbose

Each remote client will get the responses for its own requests only; and
the proxy will also take care of forwarding indications only to the
proper remote clients (e.g. matching service+cid or matching
service+broadcast).

If you want to test it, set this libqmi branch in place, and do this
simple change in ModemManager:

diff --git a/src/mm-qmi-port.c b/src/mm-qmi-port.c
index a26fdab..efecf2e 100644
--- a/src/mm-qmi-port.c
+++ b/src/mm-qmi-port.c
@@ -214,7 +214,7 @@ qmi_device_new_ready (GObject *unused,
                       PortOpenContext *ctx)
 {
     GError *error = NULL;
-    QmiDeviceOpenFlags flags = QMI_DEVICE_OPEN_FLAGS_VERSION_INFO;
+    QmiDeviceOpenFlags flags = (QMI_DEVICE_OPEN_FLAGS_VERSION_INFO |
QMI_DEVICE_OPEN_FLAGS_PROXY);

Once it's done, you will be able to run qmicli (with
'--device-open-proxy') even if MM is running; which leaves the door open
for applications which want to use QMI directly (got a couple of ideas
already floating around). Of course, if multiple apps use the same modem
at the same time in incompatible ways, bad things will happen :)

Comments and tests welcome!

-- 
Aleksander


More information about the libqmi-devel mailing list