Message "collection" support

Aleksander Morgado aleksander at aleksander.es
Wed Apr 15 19:56:04 UTC 2020


Hey!

I've prepared a branch that allows building "tailored" libqmi
libraries, i.e. selecting just a subset of all the available commands.
See:

https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/merge_requests/109

By default it would have 3 different collections: "minimal", with just
a few messages required for basic functionality (e.g. if you're going
to use qmi-network), "basic" if you need further functionalities like
qmi-firmware-update or integration with ModemManager, and "full" with
all current supported messages.

Users building their own systems can patch libqmi by adding a new
custom collection file under e.g. /data/qmi-collection-vendor.json,
and will then be able to configure using --enable-collection=vendor.

When a collection is selected, only the messages in the collection are
included in the library *and* in qmicli, this is, qmicli also gets
tailored for the custom message subset.

These are the minimal and basic collections included:
https://gitlab.freedesktop.org/aleksm/libqmi/-/blob/aleksander/collections/data/qmi-collection-minimal.json
https://gitlab.freedesktop.org/aleksm/libqmi/-/blob/aleksander/collections/data/qmi-collection-basic.json

The code in qmicli gets a bit polluted with #ifdefs but I believe that
the benefit is bigger than the maintenance burden it carries.

The main reasoning for this is that there are systems with limited
available memory or disk space, and libqmi is not really optimized in
that regard right now. In the build tests I've done in different
systems, I've seen a reduction of file size of up to 50% when using
the basic collection w.r.t. the full collection.

Standard distributions should definitely pick the "full" collection, though.

What do you all think?

-- 
Aleksander
https://aleksander.es


More information about the libqmi-devel mailing list