Modemmanager - Error handling.

Aleksander Morgado aleksander at aleksander.es
Mon Aug 24 10:11:50 PDT 2015


Hoola Carlos,

On Mon, Aug 24, 2015 at 6:32 PM, Carlos Fernández
<carlos.fernandez at edosoftfactory.com> wrote:
> I have some questions about Modem Manager errors which I didn't it find in
> API reference manual and I don't know how errors are reported in Modem
> Manager.

There are errors defined in the MM API here:
http://www.freedesktop.org/software/ModemManager/api/latest/ModemManager-Errors.html

Plus, I believe this is still true, for MBIM modems you may still get
libmbim errors:
http://www.freedesktop.org/software/libmbim/libmbim-glib/latest/libmbim-glib-Errors.html

And for QMI modems you may still get libqmi errors:
http://www.freedesktop.org/software/libqmi/libqmi-glib/latest/libqmi-glib-Errors.html

This shouldn't happen, though; ideally only ModemManager errors should
be reported through DBus to clients. I believe there was an open bug
to track that but I cannot find it anywhere now in a quick check.

> How does modemmanager/d-bus handle the errors?
> Where the errors values are returned? Is there any object/signal or value
> that is returned when a method finalizes successfully/unsuccessfully?

DBus methods have a built-in setup to return errors. So, when you call
a method 3 things may happen:
  * If the method signature has return values and the operation is
successful, you'll get the return values.
  * If the method signature doesn't have return values and the
operation is successful, you'll get the operation finished and no
return values.
  * If the operation fails, you'll get an error reported, regardless
of the outputs defined in the method signature.

An example; check the Connect() method in the Simple interface:
  http://www.freedesktop.org/software/ModemManager/api/latest/gdbus-org.freedesktop.ModemManager1.Modem.Simple.html#gdbus-method-org-freedesktop-ModemManager1-Modem-Simple.Connect
The DBus method receives a 'properties' dictionary and returns a
'bearer' dictionary. In our "libmm-glib" library which maps the DBus
API we now have a mm_modem_simple_connect() method which receives a
MMSimpleConnectProperties object:
  http://www.freedesktop.org/software/ModemManager/libmm-glib/latest/MMModemSimple.html#mm-modem-simple-connect
And the corresponding finish() method will return either a MMBearer
object, *or* NULL plus the GError set:
  http://www.freedesktop.org/software/ModemManager/libmm-glib/latest/MMModemSimple.html#mm-modem-simple-connect-finish


-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list