Calling qmi from Python

Aleksander Morgado aleksander at aleksander.es
Thu Sep 3 11:41:31 UTC 2020


Hey Craig,

> > I'm trying to use the qmi interface via the Go introspection library, and having issues.
> > Some calls are reliable. The get_capabilities() in the simple-tester.py is stable. But get_ids is not. If I call it, and immediately call the unref(), all is good. If I access any of the members using the API - like get_imei() - then I get "double free detected in tcache 2" as soon as I call the unref(). It seems like it is trying to release the string twice. I get similar issues with get_system_info() which fails if I try to access the lte results.
> >
> > Any ideas?
> >
>
> Looks like we may need explicit (transfer none) labels in the output
> string parameters.
> Would you be able to test with this patch applied?
> https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/merge_requests/152
>

That patch is not needed, the output string is already considered
transfer-none implicitly.

The problem is that you're calling unref() explicitly, while you
shouldn't do that. The output bundle variable has proper context
lifecycle in the introspected program, and therefore the unref is
implicitly called for you when the variable scope is gone.

See https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/merge_requests/156
for the updated tester calling get_ids()


-- 
Aleksander
https://aleksander.es


More information about the libqmi-devel mailing list