diff options
author | Thomas Haller <thaller@redhat.com> | 2022-01-28 21:26:05 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-01-29 16:26:02 +0100 |
commit | c0f9925de85de9590923488d9249b15bd65e8615 (patch) | |
tree | 11c072b2f0821027ac9a2d40cc8185683e5112f2 | |
parent | 64630f57a2f5cf48e1010d2976065dcd46427609 (diff) |
device/wwan: static assert that ModemManager and NM capabilities correspond
-rw-r--r-- | src/core/devices/wwan/nm-modem-broadband.c | 7 | ||||
-rw-r--r-- | src/libnm-core-public/nm-dbus-interface.h | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/core/devices/wwan/nm-modem-broadband.c b/src/core/devices/wwan/nm-modem-broadband.c index 775afa64ec..81f090c611 100644 --- a/src/core/devices/wwan/nm-modem-broadband.c +++ b/src/core/devices/wwan/nm-modem-broadband.c @@ -204,6 +204,13 @@ get_capabilities(NMModem *_self, MMModemCapability *supported; guint n_supported; + G_STATIC_ASSERT(MM_MODEM_CAPABILITY_POTS == (guint64) NM_DEVICE_MODEM_CAPABILITY_POTS); + G_STATIC_ASSERT(MM_MODEM_CAPABILITY_CDMA_EVDO + == (guint64) NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO); + G_STATIC_ASSERT(MM_MODEM_CAPABILITY_GSM_UMTS == (guint64) NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS); + G_STATIC_ASSERT(MM_MODEM_CAPABILITY_LTE == (guint64) NM_DEVICE_MODEM_CAPABILITY_LTE); + G_STATIC_ASSERT(MM_MODEM_CAPABILITY_5GNR == (guint64) NM_DEVICE_MODEM_CAPABILITY_5GNR); + /* For now, we don't care about the capability combinations, just merge all * combinations in a single mask */ if (mm_modem_get_supported_capabilities(self->_priv.modem_iface, &supported, &n_supported)) { diff --git a/src/libnm-core-public/nm-dbus-interface.h b/src/libnm-core-public/nm-dbus-interface.h index d676373273..fe2a6c09db 100644 --- a/src/libnm-core-public/nm-dbus-interface.h +++ b/src/libnm-core-public/nm-dbus-interface.h @@ -443,6 +443,8 @@ typedef enum { /*< flags >*/ NM_DEVICE_MODEM_CAPABILITY_LTE = 0x00000008, NM_DEVICE_MODEM_CAPABILITY_5GNR = 0x00000040, } NMDeviceModemCapabilities; +/* Note: the numeric values of NMDeviceModemCapabilities must be identical to the values + * in MMModemCapability. See the G_STATIC_ASSERT() in nm-modem-broadband.c's get_capabilities(). */ /** * NMWimaxNspNetworkType: |