AT Commands for QMI based Dialing?

Michael Shell list1 at
Sun Dec 28 20:08:49 PST 2014

On Sun, 28 Dec 2014 09:53:56 +0100
Aleksander Morgado <aleksander at> wrote:

> The QMI network interface, AFAIK, needs to be activated via QMI
> protocol always.
> What's the issue with libqmi/qmicli? If you don't want to use them you
> also have other connection managers working with QMI (e.g. ofono or
> uqmi).

I've got libqmi and it works just fine for me, but does require some
dependencies others might not have (glib/gobject). 

Also, it is always nice to be able to walk through a minimal manual network
setup for diagnostic purposes - so one can easily then tell if there is a
hardware or network authorization issue rather than a problem with
libqmi/modem manager or their config.

I have installed uqmi and can start the network via:

uqmi --device=/dev/cdc-wdm0 --keep-client-id wds --start-network my.apn

I assume the return value is the Packet Data Handle (PDH), e.g., 33704704.
What exactly is a PDH number and what mechanism determines this unique
number when a QMI network connection is first started?

However, I cannot stop the network via:

uqmi --device=/dev/cdc-wdm0 wds --stop-network 33704704 --autoconnect
uqmi --device=/dev/cdc-wdm0 wds --stop-network 4294967295 --autoconnect

(the latter per )

I always get an

"Invalid handle"


Installing uqmi can be a real ordeal for most Linux users. The sources are
git only and it requires cmake as well as two components from libubox.

I've attached my build notes at the end of this message. I'm sure it'll
help someone out there out of a jam one day. I could not with a straight
face ask another person to go through all that.

In addition to the OpenWrt release of uqmi at;a=summary 
there seems to be another version of uqmi on google code that is GNU make

Click on tar.gz though and get a monster tar ball that exceeds 30MB because
this uqmi is embedded as part of a much larger wl500g project.

Getting just the uqmi directory is real tempting though because it is GNU
make based and includes a libubox subdir as part of the tree.

   Cheers and thank you,



installing uqmi from source, this example is for a LFS Linux system.

uqmi requires json-c, cmake and libubox
helpful URLs:

*** json-c ***
sed -i s/-Werror//
./configure --prefix=/usr --disable-static
make -j1
make install

*** cmake ***
./bootstrap --prefix=/usr       \
            --system-libs       \
            --mandir=/share/man \
make install

if get .... cmArchiveWrite.cxx:43:75: error: 'archive_entry_copy_sourcepath_w' was not declared in this scope


#define __LA_SSIZE_T ssize_t

after #include of Source/cmArchiveWrite.cxx

if get .... cmArchiveWrite.cxx:45:75: error: 'archive_entry_copy_sourcepath_w' was not declared in this scope

upgrade to libarchive 3.0.2 or greater
or invoke 
to use internal libarchive copy

*** libubox ****
git clone git:// libubox
cd libubox
mkdir build
cd build
cmake ..

  If get "-- checking for modules 'json-c;json'
          -- package 'json' not found"
  seems to be OK though (uses internal version?)

See note about potential path issue with blobmsg_json.h
as well as jshn.c in notes for uqmi below.

make ubox blobmsg_json
  valid targets include: ubox blobmsg_json jshn json_script
                         ubox-static uloop_lua all

  uloop_lua will not compile against lua 5.2, only 5.1
  "uloop.c:116:2: error: implicit declaration of function 'luaI_openlib'"
mkdir -p /usr/include/libubox
cp ../*.h /usr/include/libubox
cp /usr/lib
cp /usr/lib

*** uqmi ****;a=summary
select snapshot or
git clone git:// uqmi
cd uqmi
cmake CMakeLists.txt
make install
mv /usr/local/sbin/uqmi /usr/sbin/uqmi

If an error occurs, no way to make clean if not built in a
separate build directory, reunpack source tree and start over.

If get ... blobmsg_json.h:22:24: fatal error: json/json.h:
       No such file or directory

in libubox's blobmsg_json.h as well as jshn.c change

        #include <json/json.h>


        #include <json-c/json.h>

and then rebuild and reinstall libubox.

If get /usr/bin/ld: cannot find -lblobmsg_json
did not build and install blobmsg_json in libubox
and/or run ldconfig.


More information about the ModemManager-devel mailing list