qmi_device_new doesn't work
aleksander at aleksander.es
Thu Jul 25 08:39:58 UTC 2019
> I am new to libqmi and want to start by opening a QmiDevice to communicate with it, But that doesn't work.
> The problem is that the callback function of qmi_device_new is never called. I tried to code it the same way as the gnome reference site ( https://developer.gnome.org/gio/stable/GAsyncResult.html ) but it is still not working
> I am using Ubuntu 19.04 and I installed libqmi ( http://www.linuxfromscratch.org/blfs/view/svn/general/libqmi.html ) and libmbim ( http://www.linuxfromscratch.org/blfs/view/svn/general/libmbim.html )
> udev and glib-2.0 are installed as well.
> You find the code and its output attached.
> I would be greatful if someone could give me a hint on how to make it work.
libqmi is based on GLib, and therefore it needs a "main loop of
events" to be running. The qmi_device_new() method will be completed
asynchronously, which means that the result of the operation will be
reported via an event in the main loop of events.
You should see the qmi_device_new() completing once you replace the
while(1) code with g_main_loop_new() and g_main_loop_run().
More information about the libqmi-devel