aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2016-09-30 09:25:01 -0500
committerDan Williams <dcbw@redhat.com>2016-09-30 09:25:01 -0500
commit4d373376b65d77cf30f6d534fa9b059a43ec6539 (patch)
treec1965d860d965c44f785065dd881ba590c696ac4
parent66de6130abf2707b53b9ec2c0d55660b0324cbd5 (diff)
qmi-device: assume reasonable DMS version if WDS is high enough
Some devices (Quectel EC21) lie about their supported DMS version, so assume a reasonable DMS version if the WDS version is high enough.
-rw-r--r--src/libqmi-glib/qmi-device.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/libqmi-glib/qmi-device.c b/src/libqmi-glib/qmi-device.c
index 5cee156..ef636f0 100644
--- a/src/libqmi-glib/qmi-device.c
+++ b/src/libqmi-glib/qmi-device.c
@@ -485,8 +485,10 @@ check_message_supported (QmiDevice *self,
GError **error)
{
const QmiMessageCtlGetVersionInfoOutputServiceListService *info;
- guint major = 0;
- guint minor = 0;
+ guint message_major = 0;
+ guint message_minor = 0;
+ guint device_major = 0;
+ guint device_minor = 0;
/* If we didn't check supported services, just assume it is supported */
if (!self->priv->supported_services)
@@ -498,7 +500,7 @@ check_message_supported (QmiDevice *self,
/* If we cannot get in which version this message was introduced, we'll just
* assume it's supported */
- if (!qmi_message_get_version_introduced (message, &major, &minor))
+ if (!qmi_message_get_version_introduced (message, &message_major, &message_minor))
return TRUE;
/* Get version info. It MUST exist because we allowed creating a client
@@ -506,18 +508,34 @@ check_message_supported (QmiDevice *self,
info = find_service_version_info (self, qmi_message_get_service (message));
g_assert (info != NULL);
g_assert (info->service == qmi_message_get_service (message));
+ device_major = info->major_version;
+ device_minor = info->minor_version;
+
+ /* Some device firmware versions (Quectel EC21) lie about their supported
+ * DMS version, so assume a reasonable DMS version if the WDS version is
+ * high enough */
+ if (info->service == QMI_SERVICE_DMS && device_major == 1 && device_minor == 0) {
+ const QmiMessageCtlGetVersionInfoOutputServiceListService *wds;
+
+ wds = find_service_version_info (self, QMI_SERVICE_WDS);
+ g_assert (wds != NULL);
+ if (wds->major_version >= 1 && wds->minor_version >= 9) {
+ device_major = 1;
+ device_minor = 3;
+ }
+ }
/* If the version of the message is greater than the version of the service,
* report unsupported */
- if (major > info->major_version ||
- (major == info->major_version &&
- minor > info->minor_version)) {
+ if (message_major > device_major ||
+ (message_major == device_major &&
+ message_minor > device_minor)) {
g_set_error (error,
QMI_CORE_ERROR,
QMI_CORE_ERROR_UNSUPPORTED,
"QMI service '%s' version '%u.%u' required, got version '%u.%u'",
qmi_service_get_string (qmi_message_get_service (message)),
- major, minor,
+ message_major, message_minor,
info->major_version,
info->minor_version);
return FALSE;