From 2801fb42fd585bb82a54c053d5a27f62e8df9dfe Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 8 Feb 2017 19:20:49 +0100 Subject: libqmi-glib,device: ignore driver checking when no-file-check is set E.g. during the test fixtures in the unit tests, where we create QmiDevices for non-existent devices. --- src/libqmi-glib/qmi-device.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libqmi-glib/qmi-device.c b/src/libqmi-glib/qmi-device.c index 16be3cc..f01406a 100644 --- a/src/libqmi-glib/qmi-device.c +++ b/src/libqmi-glib/qmi-device.c @@ -2370,6 +2370,8 @@ device_open_context_step (DeviceOpenContext *ctx) ctx->driver = __qmi_utils_get_driver (ctx->self->priv->path); if (ctx->driver) g_debug ("[%s] loaded driver of cdc-wdm port: %s", ctx->self->priv->path_display, ctx->driver); + else if (!ctx->self->priv->no_file_check) + g_warning ("[%s] couldn't load driver of cdc-wdm port", ctx->self->priv->path_display); #if defined MBIM_QMUX_ENABLED @@ -2394,7 +2396,7 @@ device_open_context_step (DeviceOpenContext *ctx) /* MBIM mode requested? */ if (ctx->flags & QMI_DEVICE_OPEN_FLAGS_MBIM) { - if (!g_str_equal (ctx->driver, "cdc_mbim")) + if (g_strcmp0 (ctx->driver, "cdc_mbim")) g_warning ("[%s] requested MBIM mode but unexpected driver found: %s", ctx->self->priv->path_display, ctx->driver); goto next_step; } @@ -2408,8 +2410,9 @@ device_open_context_step (DeviceOpenContext *ctx) #endif /* MBIM_QMUX_ENABLED */ /* QMI mode requested? */ - if (!g_str_equal (ctx->driver, "qmi_wwan")) - g_warning ("[%s] requested QMI mode but unexpected driver found: %s", ctx->self->priv->path_display, ctx->driver); + if (g_strcmp0 (ctx->driver, "qmi_wwan") && !ctx->self->priv->no_file_check) + g_warning ("[%s] requested QMI mode but unexpected driver found: %s", + ctx->self->priv->path_display, ctx->driver ? ctx->driver : "unknown"); next_step: ctx->step++; -- cgit v1.1