build: new `--without-qmi' configure option

For those who don't care about the QMI support through libqmi-glib, or if you're
stuck with glib 2.30 (libqmi-glib requires 2.32), this configure switch allows
disabling the QMI support completely.

The logic to detect cdc-wdm ports is still in place, but the QMI probing is
never launched at them. Also, all QMI-related objects won't be compiled.
This commit is contained in:
Aleksander Morgado
2012-09-05 19:51:18 +02:00
parent bf1da3faea
commit 4804c37604
14 changed files with 180 additions and 26 deletions

View File

@@ -71,8 +71,7 @@ PKG_CHECK_MODULES(MM,
gmodule-2.0 gmodule-2.0
gobject-2.0 gobject-2.0
gio-2.0 gio-2.0
gio-unix-2.0 gio-unix-2.0)
qmi-glib)
AC_SUBST(MM_CFLAGS) AC_SUBST(MM_CFLAGS)
AC_SUBST(MM_LIBS) AC_SUBST(MM_LIBS)
@@ -170,6 +169,21 @@ case $with_tests in
;; ;;
esac esac
dnl QMI support (enabled by default)
AC_ARG_WITH(qmi, AS_HELP_STRING([--without-qmi], [Build without QMI support]), [], [with_qmi=yes])
AM_CONDITIONAL(WITH_QMI, test "x$with_qmi" = "xyes")
case $with_qmi in
yes)
PKG_CHECK_MODULES(QMI, qmi-glib)
AC_DEFINE(WITH_QMI, 1, [Define if you want QMI support])
AC_SUBST(QMI_CFLAGS)
AC_SUBST(QMI_LIBS)
;;
*)
with_qmi=no
;;
esac
dnl dnl
dnl Newest QMI commands dnl Newest QMI commands
dnl dnl
@@ -177,6 +191,10 @@ AC_ARG_WITH(newest_qmi_commands, AS_HELP_STRING([--with-newest-qmi-commands], [T
AM_CONDITIONAL(WITH_NEWEST_QMI_COMMANDS, test "x$with_newest_qmi_commands" = "xyes") AM_CONDITIONAL(WITH_NEWEST_QMI_COMMANDS, test "x$with_newest_qmi_commands" = "xyes")
case $with_newest_qmi_commands in case $with_newest_qmi_commands in
yes) yes)
if test "$with_qmi" = "xno" ; then
AC_ERROR([Cannot enable newest QMI commands if QMI support if disabled])
fi
AC_DEFINE(WITH_NEWEST_QMI_COMMANDS, 1, [Define if we enable new QMI commands support]) AC_DEFINE(WITH_NEWEST_QMI_COMMANDS, 1, [Define if we enable new QMI commands support])
with_newest_qmi_commands=yes with_newest_qmi_commands=yes
;; ;;
@@ -248,5 +266,6 @@ echo "
PPP-enabled tests: ${have_pppd_headers} PPP-enabled tests: ${have_pppd_headers}
PolicyKit support: ${with_polkit} PolicyKit support: ${with_polkit}
Documentation: ${with_docs} Documentation: ${with_docs}
QMI support: ${with_qmi}
Newest QMI commands: ${with_newest_qmi_commands} Newest QMI commands: ${with_newest_qmi_commands}
" "

View File

@@ -16,6 +16,10 @@ PLUGIN_COMMON_LINKER_FLAGS = \
-module \ -module \
-avoid-version -avoid-version
if WITH_QMI
PLUGIN_COMMON_COMPILER_FLAGS += $(QMI_CFLAGS)
endif
# UDev rules # UDev rules
udevrulesdir = $(UDEV_BASE_DIR)/rules.d udevrulesdir = $(UDEV_BASE_DIR)/rules.d
udevrules_DATA = udevrules_DATA =

View File

@@ -29,10 +29,13 @@
#include "mm-plugin-generic.h" #include "mm-plugin-generic.h"
#include "mm-broadband-modem.h" #include "mm-broadband-modem.h"
#include "mm-broadband-modem-qmi.h"
#include "mm-serial-parsers.h" #include "mm-serial-parsers.h"
#include "mm-log.h" #include "mm-log.h"
#if defined WITH_QMI
#include "mm-broadband-modem-qmi.h"
#endif
G_DEFINE_TYPE (MMPluginGeneric, mm_plugin_generic, MM_TYPE_PLUGIN) G_DEFINE_TYPE (MMPluginGeneric, mm_plugin_generic, MM_TYPE_PLUGIN)
int mm_plugin_major_version = MM_PLUGIN_MAJOR_VERSION; int mm_plugin_major_version = MM_PLUGIN_MAJOR_VERSION;
@@ -49,6 +52,7 @@ create_modem (MMPlugin *self,
GList *probes, GList *probes,
GError **error) GError **error)
{ {
#if defined WITH_QMI
if (mm_port_probe_list_has_qmi_port (probes)) { if (mm_port_probe_list_has_qmi_port (probes)) {
mm_dbg ("QMI-powered generic modem found..."); mm_dbg ("QMI-powered generic modem found...");
return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path, return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path,
@@ -57,6 +61,7 @@ create_modem (MMPlugin *self,
vendor, vendor,
product)); product));
} }
#endif
return MM_BASE_MODEM (mm_broadband_modem_new (sysfs_path, return MM_BASE_MODEM (mm_broadband_modem_new (sysfs_path,
drivers, drivers,

View File

@@ -20,10 +20,13 @@
#include <libmm-common.h> #include <libmm-common.h>
#include "mm-plugin-gobi.h" #include "mm-plugin-gobi.h"
#include "mm-broadband-modem-qmi.h"
#include "mm-broadband-modem-gobi.h" #include "mm-broadband-modem-gobi.h"
#include "mm-log.h" #include "mm-log.h"
#if defined WITH_QMI
#include "mm-broadband-modem-qmi.h"
#endif
G_DEFINE_TYPE (MMPluginGobi, mm_plugin_gobi, MM_TYPE_PLUGIN) G_DEFINE_TYPE (MMPluginGobi, mm_plugin_gobi, MM_TYPE_PLUGIN)
int mm_plugin_major_version = MM_PLUGIN_MAJOR_VERSION; int mm_plugin_major_version = MM_PLUGIN_MAJOR_VERSION;
@@ -40,6 +43,7 @@ create_modem (MMPlugin *self,
GList *probes, GList *probes,
GError **error) GError **error)
{ {
#if defined WITH_QMI
if (mm_port_probe_list_has_qmi_port (probes)) { if (mm_port_probe_list_has_qmi_port (probes)) {
mm_dbg ("QMI-powered Gobi modem found..."); mm_dbg ("QMI-powered Gobi modem found...");
return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path, return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path,
@@ -48,6 +52,7 @@ create_modem (MMPlugin *self,
vendor, vendor,
product)); product));
} }
#endif
return MM_BASE_MODEM (mm_broadband_modem_gobi_new (sysfs_path, return MM_BASE_MODEM (mm_broadband_modem_gobi_new (sysfs_path,
drivers, drivers,

View File

@@ -25,9 +25,12 @@
#include "mm-serial-enums-types.h" #include "mm-serial-enums-types.h"
#include "mm-log.h" #include "mm-log.h"
#include "mm-plugin-huawei.h" #include "mm-plugin-huawei.h"
#include "mm-broadband-modem-qmi.h"
#include "mm-broadband-modem-huawei.h" #include "mm-broadband-modem-huawei.h"
#if defined WITH_QMI
#include "mm-broadband-modem-qmi.h"
#endif
G_DEFINE_TYPE (MMPluginHuawei, mm_plugin_huawei, MM_TYPE_PLUGIN) G_DEFINE_TYPE (MMPluginHuawei, mm_plugin_huawei, MM_TYPE_PLUGIN)
int mm_plugin_major_version = MM_PLUGIN_MAJOR_VERSION; int mm_plugin_major_version = MM_PLUGIN_MAJOR_VERSION;
@@ -424,6 +427,7 @@ create_modem (MMPlugin *self,
{ {
propagate_port_mode_results (probes); propagate_port_mode_results (probes);
#if defined WITH_QMI
if (mm_port_probe_list_has_qmi_port (probes)) { if (mm_port_probe_list_has_qmi_port (probes)) {
mm_dbg ("QMI-powered Huawei modem found..."); mm_dbg ("QMI-powered Huawei modem found...");
return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path, return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path,
@@ -432,6 +436,7 @@ create_modem (MMPlugin *self,
vendor, vendor,
product)); product));
} }
#endif
return MM_BASE_MODEM (mm_broadband_modem_huawei_new (sysfs_path, return MM_BASE_MODEM (mm_broadband_modem_huawei_new (sysfs_path,
drivers, drivers,

View File

@@ -21,7 +21,10 @@
#include "mm-log.h" #include "mm-log.h"
#include "mm-plugin-pantech.h" #include "mm-plugin-pantech.h"
#include "mm-broadband-modem.h" #include "mm-broadband-modem.h"
#if defined WITH_QMI
#include "mm-broadband-modem-qmi.h" #include "mm-broadband-modem-qmi.h"
#endif
G_DEFINE_TYPE (MMPluginPantech, mm_plugin_pantech, MM_TYPE_PLUGIN) G_DEFINE_TYPE (MMPluginPantech, mm_plugin_pantech, MM_TYPE_PLUGIN)
@@ -39,6 +42,7 @@ create_modem (MMPlugin *self,
GList *probes, GList *probes,
GError **error) GError **error)
{ {
#if defined WITH_QMI
if (mm_port_probe_list_has_qmi_port (probes)) { if (mm_port_probe_list_has_qmi_port (probes)) {
mm_dbg ("QMI-powered Pantech modem found..."); mm_dbg ("QMI-powered Pantech modem found...");
return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path, return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path,
@@ -47,6 +51,7 @@ create_modem (MMPlugin *self,
vendor, vendor,
product)); product));
} }
#endif
return MM_BASE_MODEM (mm_broadband_modem_new (sysfs_path, return MM_BASE_MODEM (mm_broadband_modem_new (sysfs_path,
drivers, drivers,

View File

@@ -23,10 +23,13 @@
#include "mm-log.h" #include "mm-log.h"
#include "mm-plugin-sierra.h" #include "mm-plugin-sierra.h"
#include "mm-broadband-modem-qmi.h"
#include "mm-broadband-modem-sierra.h" #include "mm-broadband-modem-sierra.h"
#include "mm-broadband-modem-sierra-icera.h" #include "mm-broadband-modem-sierra-icera.h"
#if defined WITH_QMI
#include "mm-broadband-modem-qmi.h"
#endif
G_DEFINE_TYPE (MMPluginSierra, mm_plugin_sierra, MM_TYPE_PLUGIN) G_DEFINE_TYPE (MMPluginSierra, mm_plugin_sierra, MM_TYPE_PLUGIN)
int mm_plugin_major_version = MM_PLUGIN_MAJOR_VERSION; int mm_plugin_major_version = MM_PLUGIN_MAJOR_VERSION;
@@ -194,6 +197,7 @@ create_modem (MMPlugin *self,
GList *probes, GList *probes,
GError **error) GError **error)
{ {
#if defined WITH_QMI
if (mm_port_probe_list_has_qmi_port (probes)) { if (mm_port_probe_list_has_qmi_port (probes)) {
mm_dbg ("QMI-powered Sierra modem found..."); mm_dbg ("QMI-powered Sierra modem found...");
return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path, return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path,
@@ -202,6 +206,7 @@ create_modem (MMPlugin *self,
vendor, vendor,
product)); product));
} }
#endif
if (sierra_port_probe_list_is_icera (probes)) if (sierra_port_probe_list_is_icera (probes))
return MM_BASE_MODEM (mm_broadband_modem_sierra_icera_new (sysfs_path, return MM_BASE_MODEM (mm_broadband_modem_sierra_icera_new (sysfs_path,

View File

@@ -25,8 +25,6 @@ libmodem_helpers_la_SOURCES = \
mm-error-helpers.h \ mm-error-helpers.h \
mm-modem-helpers.c \ mm-modem-helpers.c \
mm-modem-helpers.h \ mm-modem-helpers.h \
mm-modem-helpers-qmi.c \
mm-modem-helpers-qmi.h \
mm-charsets.c \ mm-charsets.c \
mm-charsets.h \ mm-charsets.h \
mm-utils.c \ mm-utils.c \
@@ -34,6 +32,14 @@ libmodem_helpers_la_SOURCES = \
mm-sms-part.h \ mm-sms-part.h \
mm-sms-part.c mm-sms-part.c
# Additional QMI support in libmodem-helpers
if WITH_QMI
libmodem_helpers_la_SOURCES += \
mm-modem-helpers-qmi.c \
mm-modem-helpers-qmi.h
libmodem_helpers_la_CPPFLAGS += $(QMI_CFLAGS)
endif
# libserial specific enum types # libserial specific enum types
SERIAL_ENUMS = \ SERIAL_ENUMS = \
$(srcdir)/mm-port.h \ $(srcdir)/mm-port.h \
@@ -74,9 +80,15 @@ libserial_la_SOURCES = \
mm-qcdm-serial-port.c \ mm-qcdm-serial-port.c \
mm-qcdm-serial-port.h \ mm-qcdm-serial-port.h \
mm-gps-serial-port.c \ mm-gps-serial-port.c \
mm-gps-serial-port.h \ mm-gps-serial-port.h
# Additional QMI support in libmodem-helpers
if WITH_QMI
libserial_la_SOURCES += \
mm-qmi-port.c \ mm-qmi-port.c \
mm-qmi-port.h mm-qmi-port.h
libserial_la_CPPFLAGS += $(QMI_CFLAGS)
endif
# Daemon specific enum types # Daemon specific enum types
DAEMON_ENUMS = \ DAEMON_ENUMS = \
@@ -117,10 +129,6 @@ ModemManager_CPPFLAGS = \
-I$(top_builddir)/libmm-common \ -I$(top_builddir)/libmm-common \
-DPLUGINDIR=\"$(pkglibdir)\" -DPLUGINDIR=\"$(pkglibdir)\"
if WITH_POLKIT
ModemManager_CPPFLAGS += $(POLKIT_CFLAGS)
endif
ModemManager_LDADD = \ ModemManager_LDADD = \
$(MM_LIBS) \ $(MM_LIBS) \
$(GUDEV_LIBS) \ $(GUDEV_LIBS) \
@@ -128,10 +136,6 @@ ModemManager_LDADD = \
$(builddir)/libserial.la \ $(builddir)/libserial.la \
$(top_builddir)/libqcdm/src/libqcdm.la $(top_builddir)/libqcdm/src/libqcdm.la
if WITH_POLKIT
ModemManager_LDADD += $(POLKIT_LIBS)
endif
nodist_ModemManager_SOURCES = \ nodist_ModemManager_SOURCES = \
mm-marshal.h \ mm-marshal.h \
mm-marshal.c \ mm-marshal.c \
@@ -158,14 +162,10 @@ ModemManager_SOURCES = \
mm-plugin-manager.h \ mm-plugin-manager.h \
mm-sim.h \ mm-sim.h \
mm-sim.c \ mm-sim.c \
mm-sim-qmi.h \
mm-sim-qmi.c \
mm-bearer.h \ mm-bearer.h \
mm-bearer.c \ mm-bearer.c \
mm-broadband-bearer.h \ mm-broadband-bearer.h \
mm-broadband-bearer.c \ mm-broadband-bearer.c \
mm-bearer-qmi.h \
mm-bearer-qmi.c \
mm-bearer-list.h \ mm-bearer-list.h \
mm-bearer-list.c \ mm-bearer-list.c \
mm-base-modem-at.h \ mm-base-modem-at.h \
@@ -196,8 +196,6 @@ ModemManager_SOURCES = \
mm-iface-modem-time.c \ mm-iface-modem-time.c \
mm-broadband-modem.h \ mm-broadband-modem.h \
mm-broadband-modem.c \ mm-broadband-modem.c \
mm-broadband-modem-qmi.h \
mm-broadband-modem-qmi.c \
mm-serial-parsers.c \ mm-serial-parsers.c \
mm-serial-parsers.h \ mm-serial-parsers.h \
mm-port-probe.h \ mm-port-probe.h \
@@ -212,12 +210,29 @@ mm-bearer.c: mm-daemon-enums-types.h
mm-sms-list.c: mm-marshal.h mm-sms-list.c: mm-marshal.h
mm-sim.c: mm-marshal.h mm-sim.c: mm-marshal.h
# Additional Polkit support
if WITH_POLKIT if WITH_POLKIT
ModemManager_SOURCES += \ ModemManager_SOURCES += \
mm-auth-provider-polkit.c \ mm-auth-provider-polkit.c \
mm-auth-provider-polkit.h mm-auth-provider-polkit.h
ModemManager_LDADD += $(POLKIT_LIBS)
ModemManager_CPPFLAGS += $(POLKIT_CFLAGS)
endif endif
# Additional QMI support in ModemManager
if WITH_QMI
ModemManager_SOURCES += \
mm-sim-qmi.h \
mm-sim-qmi.c \
mm-bearer-qmi.h \
mm-bearer-qmi.c \
mm-broadband-modem-qmi.h \
mm-broadband-modem-qmi.c
ModemManager_CPPFLAGS += $(QMI_CFLAGS)
ModemManager_LDADD += $(QMI_LIBS)
endif
EXTRA_DIST = \ EXTRA_DIST = \
$(udevrules_DATA) \ $(udevrules_DATA) \
mm-marshal.list mm-marshal.list

View File

@@ -16,6 +16,7 @@
*/ */
#include <config.h> #include <config.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
@@ -85,8 +86,10 @@ struct _MMBaseModemPrivate {
MMAtSerialPort *gps_control; MMAtSerialPort *gps_control;
MMGpsSerialPort *gps; MMGpsSerialPort *gps;
#if defined WITH_QMI
/* QMI ports */ /* QMI ports */
GList *qmi; GList *qmi;
#endif
}; };
static gchar * static gchar *
@@ -237,8 +240,20 @@ mm_base_modem_grab_port (MMBaseModem *self,
/* QMI ports... */ /* QMI ports... */
else if (g_str_has_prefix (subsys, "usb") && else if (g_str_has_prefix (subsys, "usb") &&
g_str_has_prefix (name, "cdc-wdm")) { g_str_has_prefix (name, "cdc-wdm")) {
#if defined WITH_QMI
port = MM_PORT (mm_qmi_port_new (name)); port = MM_PORT (mm_qmi_port_new (name));
} else #else
g_set_error (error,
MM_CORE_ERROR,
MM_CORE_ERROR_UNSUPPORTED,
"Cannot add port '%s/%s', QMI support not available",
subsys,
name);
g_free (key);
return FALSE;
#endif
}
else
/* We already filter out before all non-tty, non-net, non-qmi ports */ /* We already filter out before all non-tty, non-net, non-qmi ports */
g_assert_not_reached(); g_assert_not_reached();
@@ -308,11 +323,13 @@ mm_base_modem_release_port (MMBaseModem *self,
if (port == (MMPort *)self->priv->gps) if (port == (MMPort *)self->priv->gps)
g_clear_object (&self->priv->gps); g_clear_object (&self->priv->gps);
#if defined WITH_QMI
l = g_list_find (self->priv->qmi, port); l = g_list_find (self->priv->qmi, port);
if (l) { if (l) {
g_object_unref (l->data); g_object_unref (l->data);
self->priv->qmi = g_list_delete_link (self->priv->qmi, l); self->priv->qmi = g_list_delete_link (self->priv->qmi, l);
} }
#endif
/* Remove it from the tracking HT */ /* Remove it from the tracking HT */
mm_dbg ("(%s/%s) type %s released from %s", mm_dbg ("(%s/%s) type %s released from %s",
@@ -512,6 +529,8 @@ mm_base_modem_peek_port_gps (MMBaseModem *self)
return self->priv->gps; return self->priv->gps;
} }
#if defined WITH_QMI
MMQmiPort * MMQmiPort *
mm_base_modem_get_port_qmi (MMBaseModem *self) mm_base_modem_get_port_qmi (MMBaseModem *self)
{ {
@@ -647,6 +666,8 @@ mm_base_modem_peek_port_qmi_for_data (MMBaseModem *self,
return found; return found;
} }
#endif /* WITH_QMI */
MMPort * MMPort *
mm_base_modem_get_best_data_port (MMBaseModem *self) mm_base_modem_get_best_data_port (MMBaseModem *self)
{ {
@@ -793,8 +814,10 @@ mm_base_modem_organize_ports (MMBaseModem *self,
MMGpsSerialPort *gps = NULL; MMGpsSerialPort *gps = NULL;
MMPort *data_primary = NULL; MMPort *data_primary = NULL;
GList *data = NULL; GList *data = NULL;
#if defined WITH_QMI
MMPort *qmi_primary = NULL; MMPort *qmi_primary = NULL;
GList *qmi = NULL; GList *qmi = NULL;
#endif
GList *l; GList *l;
g_return_val_if_fail (MM_IS_BASE_MODEM (self), FALSE); g_return_val_if_fail (MM_IS_BASE_MODEM (self), FALSE);
@@ -867,6 +890,7 @@ mm_base_modem_organize_ports (MMBaseModem *self,
gps = MM_GPS_SERIAL_PORT (candidate); gps = MM_GPS_SERIAL_PORT (candidate);
break; break;
#if defined WITH_QMI
case MM_PORT_TYPE_QMI: case MM_PORT_TYPE_QMI:
if (!qmi_primary) if (!qmi_primary)
qmi_primary = candidate; qmi_primary = candidate;
@@ -874,6 +898,7 @@ mm_base_modem_organize_ports (MMBaseModem *self,
/* All non-primary QMI ports get added to the list of QMI ports */ /* All non-primary QMI ports get added to the list of QMI ports */
qmi = g_list_append (qmi, candidate); qmi = g_list_append (qmi, candidate);
break; break;
#endif
default: default:
/* Ignore port */ /* Ignore port */
@@ -929,9 +954,11 @@ mm_base_modem_organize_ports (MMBaseModem *self,
log_port (self, MM_PORT (qcdm), "qcdm"); log_port (self, MM_PORT (qcdm), "qcdm");
log_port (self, MM_PORT (gps_control), "gps (control)"); log_port (self, MM_PORT (gps_control), "gps (control)");
log_port (self, MM_PORT (gps), "gps (nmea)"); log_port (self, MM_PORT (gps), "gps (nmea)");
#if defined WITH_QMI
log_port (self, MM_PORT (qmi_primary), "qmi (primary)"); log_port (self, MM_PORT (qmi_primary), "qmi (primary)");
for (l = qmi; l; l = g_list_next (l)) for (l = qmi; l; l = g_list_next (l))
log_port (self, MM_PORT (l->data), "qmi (secondary)"); log_port (self, MM_PORT (l->data), "qmi (secondary)");
#endif
/* We keep new refs to the objects here */ /* We keep new refs to the objects here */
self->priv->primary = g_object_ref (primary); self->priv->primary = g_object_ref (primary);
@@ -945,12 +972,14 @@ mm_base_modem_organize_ports (MMBaseModem *self,
g_list_foreach (data, (GFunc)g_object_ref, NULL); g_list_foreach (data, (GFunc)g_object_ref, NULL);
self->priv->data = g_list_concat (self->priv->data, data); self->priv->data = g_list_concat (self->priv->data, data);
#if defined WITH_QMI
/* Build the final list of QMI ports, primary port first */ /* Build the final list of QMI ports, primary port first */
if (qmi_primary) { if (qmi_primary) {
self->priv->qmi = g_list_append (self->priv->qmi, g_object_ref (qmi_primary)); self->priv->qmi = g_list_append (self->priv->qmi, g_object_ref (qmi_primary));
g_list_foreach (qmi, (GFunc)g_object_ref, NULL); g_list_foreach (qmi, (GFunc)g_object_ref, NULL);
self->priv->qmi = g_list_concat (self->priv->qmi, qmi); self->priv->qmi = g_list_concat (self->priv->qmi, qmi);
} }
#endif
/* As soon as we get the ports organized, we initialize the modem */ /* As soon as we get the ports organized, we initialize the modem */
mm_base_modem_initialize (self, mm_base_modem_initialize (self,
@@ -1226,8 +1255,10 @@ dispose (GObject *object)
g_clear_object (&self->priv->qcdm); g_clear_object (&self->priv->qcdm);
g_clear_object (&self->priv->gps_control); g_clear_object (&self->priv->gps_control);
g_clear_object (&self->priv->gps); g_clear_object (&self->priv->gps);
#if defined WITH_QMI
g_list_free_full (self->priv->qmi, g_object_unref); g_list_free_full (self->priv->qmi, g_object_unref);
self->priv->qmi = NULL; self->priv->qmi = NULL;
#endif
if (self->priv->ports) { if (self->priv->ports) {
g_hash_table_destroy (self->priv->ports); g_hash_table_destroy (self->priv->ports);

View File

@@ -18,6 +18,8 @@
#ifndef MM_BASE_MODEM_H #ifndef MM_BASE_MODEM_H
#define MM_BASE_MODEM_H #define MM_BASE_MODEM_H
#include "config.h"
#include <glib.h> #include <glib.h>
#include <glib-object.h> #include <glib-object.h>
@@ -28,7 +30,10 @@
#include "mm-at-serial-port.h" #include "mm-at-serial-port.h"
#include "mm-qcdm-serial-port.h" #include "mm-qcdm-serial-port.h"
#include "mm-gps-serial-port.h" #include "mm-gps-serial-port.h"
#if defined WITH_QMI
#include "mm-qmi-port.h" #include "mm-qmi-port.h"
#endif
#define MM_TYPE_BASE_MODEM (mm_base_modem_get_type ()) #define MM_TYPE_BASE_MODEM (mm_base_modem_get_type ())
#define MM_BASE_MODEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BASE_MODEM, MMBaseModem)) #define MM_BASE_MODEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BASE_MODEM, MMBaseModem))
@@ -117,8 +122,10 @@ MMAtSerialPort *mm_base_modem_peek_port_secondary (MMBaseModem *self);
MMQcdmSerialPort *mm_base_modem_peek_port_qcdm (MMBaseModem *self); MMQcdmSerialPort *mm_base_modem_peek_port_qcdm (MMBaseModem *self);
MMAtSerialPort *mm_base_modem_peek_port_gps_control (MMBaseModem *self); MMAtSerialPort *mm_base_modem_peek_port_gps_control (MMBaseModem *self);
MMGpsSerialPort *mm_base_modem_peek_port_gps (MMBaseModem *self); MMGpsSerialPort *mm_base_modem_peek_port_gps (MMBaseModem *self);
#if defined WITH_QMI
MMQmiPort *mm_base_modem_peek_port_qmi (MMBaseModem *self); MMQmiPort *mm_base_modem_peek_port_qmi (MMBaseModem *self);
MMQmiPort *mm_base_modem_peek_port_qmi_for_data (MMBaseModem *self, MMPort *data, GError **error); MMQmiPort *mm_base_modem_peek_port_qmi_for_data (MMBaseModem *self, MMPort *data, GError **error);
#endif
MMAtSerialPort *mm_base_modem_peek_best_at_port (MMBaseModem *self, GError **error); MMAtSerialPort *mm_base_modem_peek_best_at_port (MMBaseModem *self, GError **error);
MMPort *mm_base_modem_peek_best_data_port (MMBaseModem *self); MMPort *mm_base_modem_peek_best_data_port (MMBaseModem *self);
GList *mm_base_modem_peek_data_ports (MMBaseModem *self); GList *mm_base_modem_peek_data_ports (MMBaseModem *self);
@@ -128,8 +135,10 @@ MMAtSerialPort *mm_base_modem_get_port_secondary (MMBaseModem *self);
MMQcdmSerialPort *mm_base_modem_get_port_qcdm (MMBaseModem *self); MMQcdmSerialPort *mm_base_modem_get_port_qcdm (MMBaseModem *self);
MMAtSerialPort *mm_base_modem_get_port_gps_control (MMBaseModem *self); MMAtSerialPort *mm_base_modem_get_port_gps_control (MMBaseModem *self);
MMGpsSerialPort *mm_base_modem_get_port_gps (MMBaseModem *self); MMGpsSerialPort *mm_base_modem_get_port_gps (MMBaseModem *self);
#if defined WITH_QMI
MMQmiPort *mm_base_modem_get_port_qmi (MMBaseModem *self); MMQmiPort *mm_base_modem_get_port_qmi (MMBaseModem *self);
MMQmiPort *mm_base_modem_get_port_qmi_for_data (MMBaseModem *self, MMPort *data, GError **error); MMQmiPort *mm_base_modem_get_port_qmi_for_data (MMBaseModem *self, MMPort *data, GError **error);
#endif
MMAtSerialPort *mm_base_modem_get_best_at_port (MMBaseModem *self, GError **error); MMAtSerialPort *mm_base_modem_get_best_at_port (MMBaseModem *self, GError **error);
MMPort *mm_base_modem_get_best_data_port (MMBaseModem *self); MMPort *mm_base_modem_get_best_data_port (MMBaseModem *self);
GList *mm_base_modem_get_data_ports (MMBaseModem *self); GList *mm_base_modem_get_data_ports (MMBaseModem *self);

View File

@@ -15,6 +15,8 @@
* Copyright (C) 2011 Aleksander Morgado <aleksander@gnu.org> * Copyright (C) 2011 Aleksander Morgado <aleksander@gnu.org>
*/ */
#include "config.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -24,7 +26,6 @@
#include "mm-port-probe.h" #include "mm-port-probe.h"
#include "mm-log.h" #include "mm-log.h"
#include "mm-qmi-port.h"
#include "mm-at-serial-port.h" #include "mm-at-serial-port.h"
#include "mm-serial-port.h" #include "mm-serial-port.h"
#include "mm-serial-parsers.h" #include "mm-serial-parsers.h"
@@ -35,6 +36,10 @@
#include "mm-qcdm-serial-port.h" #include "mm-qcdm-serial-port.h"
#include "mm-daemon-enums-types.h" #include "mm-daemon-enums-types.h"
#if defined WITH_QMI
#include "mm-qmi-port.h"
#endif
/* /*
* Steps and flow of the Probing process: * Steps and flow of the Probing process:
* ----> AT Serial Open * ----> AT Serial Open
@@ -94,8 +99,11 @@ typedef struct {
void (* at_result_processor) (MMPortProbe *self, void (* at_result_processor) (MMPortProbe *self,
GVariant *result); GVariant *result);
#if defined WITH_QMI
/* ---- QMI probing specific context ---- */ /* ---- QMI probing specific context ---- */
MMQmiPort *qmi_port; MMQmiPort *qmi_port;
#endif
} PortProbeRunTask; } PortProbeRunTask;
struct _MMPortProbePrivate { struct _MMPortProbePrivate {
@@ -279,11 +287,13 @@ port_probe_run_task_free (PortProbeRunTask *task)
g_object_unref (task->serial); g_object_unref (task->serial);
} }
#if defined WITH_QMI
if (task->qmi_port) { if (task->qmi_port) {
if (mm_qmi_port_is_open (task->qmi_port)) if (mm_qmi_port_is_open (task->qmi_port))
mm_qmi_port_close (task->qmi_port); mm_qmi_port_close (task->qmi_port);
g_object_unref (task->qmi_port); g_object_unref (task->qmi_port);
} }
#endif
if (task->cancellable) if (task->cancellable)
g_object_unref (task->cancellable); g_object_unref (task->cancellable);
@@ -340,6 +350,8 @@ port_probe_run_is_cancelled (MMPortProbe *self)
return FALSE; return FALSE;
} }
#if defined WITH_QMI
static void static void
qmi_port_open_ready (MMQmiPort *qmi_port, qmi_port_open_ready (MMQmiPort *qmi_port,
GAsyncResult *res, GAsyncResult *res,
@@ -367,6 +379,8 @@ qmi_port_open_ready (MMQmiPort *qmi_port,
port_probe_run_task_complete (task, TRUE, NULL); port_probe_run_task_complete (task, TRUE, NULL);
} }
#endif /* WITH_QMI */
static gboolean static gboolean
wdm_probe_qmi (MMPortProbe *self) wdm_probe_qmi (MMPortProbe *self)
{ {
@@ -376,6 +390,7 @@ wdm_probe_qmi (MMPortProbe *self)
if (port_probe_run_is_cancelled (self)) if (port_probe_run_is_cancelled (self))
return FALSE; return FALSE;
#if defined WITH_QMI
mm_dbg ("(%s/%s) probing QMI...", mm_dbg ("(%s/%s) probing QMI...",
g_udev_device_get_subsystem (self->priv->port), g_udev_device_get_subsystem (self->priv->port),
g_udev_device_get_name (self->priv->port)); g_udev_device_get_name (self->priv->port));
@@ -386,6 +401,12 @@ wdm_probe_qmi (MMPortProbe *self)
NULL, NULL,
(GAsyncReadyCallback)qmi_port_open_ready, (GAsyncReadyCallback)qmi_port_open_ready,
self); self);
#else
/* If not compiled with QMI support, just assume we won't have any QMI port */
mm_port_probe_set_result_qmi (self, FALSE);
port_probe_run_task_complete (task, TRUE, NULL);
#endif /* WITH_QMI */
return FALSE; return FALSE;
} }
@@ -1234,10 +1255,12 @@ mm_port_probe_get_port_type (MMPortProbe *self)
if (g_str_equal (subsys, "net")) if (g_str_equal (subsys, "net"))
return MM_PORT_TYPE_NET; return MM_PORT_TYPE_NET;
#if defined WITH_QMI
if (g_str_has_prefix (subsys, "usb") && if (g_str_has_prefix (subsys, "usb") &&
g_str_has_prefix (name, "cdc-wdm") && g_str_has_prefix (name, "cdc-wdm") &&
self->priv->is_qmi) self->priv->is_qmi)
return MM_PORT_TYPE_QMI; return MM_PORT_TYPE_QMI;
#endif
if (self->priv->flags & MM_PORT_PROBE_QCDM && if (self->priv->flags & MM_PORT_PROBE_QCDM &&
self->priv->is_qcdm) self->priv->is_qcdm)

View File

@@ -16,6 +16,8 @@
#ifndef MM_PORT_PROBE_H #ifndef MM_PORT_PROBE_H
#define MM_PORT_PROBE_H #define MM_PORT_PROBE_H
#include "config.h"
#include <glib.h> #include <glib.h>
#include <glib-object.h> #include <glib-object.h>
#include <gio/gio.h> #include <gio/gio.h>

View File

@@ -16,6 +16,7 @@
#ifndef MM_PORT_H #ifndef MM_PORT_H
#define MM_PORT_H #define MM_PORT_H
#include <config.h>
#include <glib.h> #include <glib.h>
#include <glib-object.h> #include <glib-object.h>
@@ -36,7 +37,6 @@ typedef enum { /*< underscore_name=mm_port_type >*/
MM_PORT_TYPE_QCDM, MM_PORT_TYPE_QCDM,
MM_PORT_TYPE_GPS, MM_PORT_TYPE_GPS,
MM_PORT_TYPE_QMI, MM_PORT_TYPE_QMI,
MM_PORT_TYPE_LAST = MM_PORT_TYPE_QMI /*< skip >*/ MM_PORT_TYPE_LAST = MM_PORT_TYPE_QMI /*< skip >*/
} MMPortType; } MMPortType;

View File

@@ -22,6 +22,12 @@ test_modem_helpers_LDADD = \
$(top_builddir)/src/libmodem-helpers.la \ $(top_builddir)/src/libmodem-helpers.la \
$(MM_LIBS) $(MM_LIBS)
if WITH_QMI
test_modem_helpers_CPPFLAGS += $(QMI_CFLAGS)
test_modem_helpers_LDADD += $(QMI_LIBS)
endif
test_charsets_SOURCES = \ test_charsets_SOURCES = \
test-charsets.c test-charsets.c
@@ -38,6 +44,11 @@ test_charsets_LDADD = \
$(top_builddir)/src/libmodem-helpers.la \ $(top_builddir)/src/libmodem-helpers.la \
$(MM_LIBS) $(MM_LIBS)
if WITH_QMI
test_charsets_CPPFLAGS += $(QMI_CFLAGS)
test_charsets_LDADD += $(QMI_LIBS)
endif
test_qcdm_serial_port_SOURCES = \ test_qcdm_serial_port_SOURCES = \
test-qcdm-serial-port.c test-qcdm-serial-port.c
@@ -57,6 +68,11 @@ test_qcdm_serial_port_LDADD = \
$(top_builddir)/libqcdm/src/libqcdm.la \ $(top_builddir)/libqcdm/src/libqcdm.la \
-lutil -lutil
if WITH_QMI
test_qcdm_serial_port_CPPFLAGS += $(QMI_CFLAGS)
test_qcdm_serial_port_LDADD += $(QMI_LIBS)
endif
test_at_serial_port_SOURCES = \ test_at_serial_port_SOURCES = \
test-at-serial-port.c test-at-serial-port.c
@@ -71,6 +87,11 @@ test_at_serial_port_LDADD = \
$(top_builddir)/src/libmodem-helpers.la \ $(top_builddir)/src/libmodem-helpers.la \
-lutil -lutil
if WITH_QMI
test_at_serial_port_CPPFLAGS += $(QMI_CFLAGS)
test_at_serial_port_LDADD += $(QMI_LIBS)
endif
test_sms_part_SOURCES = \ test_sms_part_SOURCES = \
test-sms-part.c test-sms-part.c
@@ -87,6 +108,11 @@ test_sms_part_LDADD = \
$(top_builddir)/src/libmodem-helpers.la \ $(top_builddir)/src/libmodem-helpers.la \
$(MM_LIBS) $(MM_LIBS)
if WITH_QMI
test_sms_part_CPPFLAGS += $(QMI_CFLAGS)
test_sms_part_LDADD += $(QMI_LIBS)
endif
if WITH_TESTS if WITH_TESTS
check-local: test-modem-helpers test-charsets test-qcdm-serial-port test-sms-part check-local: test-modem-helpers test-charsets test-qcdm-serial-port test-sms-part