qmi_device_new doesn't work

Electronics Guy senorelectronics at gmail.com
Thu Jul 25 08:23:33 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libqmi-devel/attachments/20190725/539e1578/attachment.html>
-------------- next part --------------
#include <iostream>
#include <libqmi-glib/libqmi-glib.h>
#include <gio/gio.h>
#include <glib/gprintf.h>

using namespace std;

void device_create_start(const char* device_file);
static void device_create_stop(GObject* obj, GAsyncResult* res, gpointer data);

int something = 0;

int main()
	g_printf ("Start\n");

	cout << "DEBUG: Something: " << something << "\n";


	cout << "Stop\n";

	return 0;
void device_create_start(const char* device_file)
	GFile* file = g_file_new_for_path(device_file);

		cout << "INFO: qmi_device_new starting!\n";
		qmi_device_new(file, NULL, device_create_stop, NULL);
		cout << "INFO: qmi_device_new started!\n";
		something = 1;
		cout << "ERROR: Could not create device!\n";
static void device_create_stop(GObject* obj, GAsyncResult* res, gpointer data)
	g_printf ("Hurray!\n");
	something = 2;

-------------- next part --------------
INFO: qmi_device_new starting!
INFO: qmi_device_new started!
DEBUG: Something: 1

More information about the libqmi-devel mailing list