Skip to content

libqmi-glib,helpers: Check WWAN "type" attribute for Linux 5.14+

Stephan Gerhold requested to merge Stephan/libqmi:wwan-type-attribute into master

Recent changes in the WWAN framework in the kernel changed the WWAN port names from e.g. "wwan0p1AT" and "wwan0p2QMI" to "wwan0at0" and "wwan0qmi0" [1], [2]. This means that qmi_helpers_get_transport_type() now fails to detect the port type since AT/QMI are now lower-case.

However, recently additionally a "type" sysfs attribute was added for all WWAN ports [3], which makes it much more reliable to match the WWAN port names without relying on their exact device name.

To handle Linux 5.14+, add some additional code that attempts to read the "type" attribute first. Note that we still need to keep the old device naming matching since Linux 5.13 does not have the "type" attribute yet.

This is basically a port of ModemManager!551 (merged) for libqmi with hopefully not too bad glib code. :)

Cc: @loicpoulain

Merge request reports

Loading