aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2010-02-20 12:49:22 -0800
committerDan Williams <dcbw@redhat.com>2010-02-20 12:49:22 -0800
commit9d8e892ffe602a123697a5f65393b5752129de09 (patch)
treec317a8cd05b62ec96f2dd7e10473ce1434e01f72
parentc916ea7b4b0bb56820a08b7d51f46f5357b27bfe (diff)
parent9185ce987d254aab07b0e8439a2788ce0670e59d (diff)
Merge remote branch 'origin/master' into qcdm
-rw-r--r--.gitignore5
-rw-r--r--Makefile.am17
-rwxr-xr-xautogen.sh1
-rw-r--r--configure.ac11
-rw-r--r--plugins/77-mm-ericsson-mbm.rules3
-rw-r--r--plugins/mm-modem-huawei-cdma.c10
-rw-r--r--plugins/mm-modem-sierra-gsm.c9
-rw-r--r--plugins/mm-modem-zte.c66
-rw-r--r--po/LINGUAS0
-rw-r--r--po/POTFILES.in5
-rw-r--r--policy/org.freedesktop.modem-manager.policy.in39
-rw-r--r--src/mm-generic-gsm.c39
-rw-r--r--src/mm-modem-base.c12
-rw-r--r--src/mm-modem-base.h2
-rw-r--r--src/tests/test-modem-helpers.c22
15 files changed, 229 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index e796e84c..9b8ee463 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@ configure
depcomp
install-sh
ltmain.sh
+intltool-*
missing
stamp-h1
*~
@@ -32,6 +33,10 @@ src/tests/test-modem-helpers
libqcdm/tests/test-qcdm
+po/Makefile.in.in
+po/POTFILES
+po/stamp-it
+
m4/gtk-doc.m4
m4/intltool.m4
m4/libtool.m4
diff --git a/Makefile.am b/Makefile.am
index 4711e9fb..0153b10e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,7 @@ all: $(GENERATED_FILES)
CLEANFILES = $(GENERATED_FILES)
endif
-SUBDIRS = marshallers libqcdm src plugins introspection test
+SUBDIRS = marshallers libqcdm src plugins introspection po policy test
dbusservicedir = $(DBUS_SYS_DIR)
dbusservice_DATA = org.freedesktop.ModemManager.conf
@@ -39,13 +39,22 @@ edit = @sed \
DISTCHECK_CONFIGURE_FLAGS = --with-udev-base-dir=$dc_install_base
-DISTCLEANFILES = \
- $(dbusactivation_DATA)
+INTLTOOL_FILES = \
+ intltool-extract.in \
+ intltool-merge.in \
+ intltool-update.in
+DISTCLEANFILES = \
+ $(dbusactivation_DATA) \
+ intltool-extract \
+ intltool-merge \
+ intltool-update \
+ po/.intltool-merge-cache
EXTRA_DIST = \
doc-generator.xsl \
$(dbusservice_DATA) \
- $(dbusactivation_in_files)
+ $(dbusactivation_in_files) \
+ $(INTLTOOL_FILES)
ACLOCAL_AMFLAGS = -I m4
diff --git a/autogen.sh b/autogen.sh
index d2ed9b58..62614d94 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -15,6 +15,7 @@ PKG_NAME=ModemManager
(cd $srcdir;
autoreconf --install --symlink &&
+ intltoolize --force &&
autoreconf &&
./configure --enable-maintainer-mode $@
)
diff --git a/configure.ac b/configure.ac
index 0f84a208..cc2f2f62 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,6 +14,15 @@ AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_LIBTOOL
+dnl
+dnl translation support
+dnl
+GETTEXT_PACKAGE=ModemManager
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
+IT_PROG_INTLTOOL([0.35.0])
+AM_GLIB_GNU_GETTEXT
+
PKG_CHECK_MODULES(MM, dbus-glib-1 >= 0.75 glib-2.0 >= 2.18 gmodule-2.0 gobject-2.0)
PKG_CHECK_MODULES(GUDEV, gudev-1.0)
@@ -96,6 +105,8 @@ src/tests/Makefile
plugins/Makefile
test/Makefile
introspection/Makefile
+po/Makefile.in
+policy/Makefile
])
AC_OUTPUT
diff --git a/plugins/77-mm-ericsson-mbm.rules b/plugins/77-mm-ericsson-mbm.rules
index 71dc6b87..4c60a7a3 100644
--- a/plugins/77-mm-ericsson-mbm.rules
+++ b/plugins/77-mm-ericsson-mbm.rules
@@ -20,6 +20,9 @@ ATTRS{idVendor}=="0bdb", ATTRS{idProduct}=="1909", ENV{ID_MM_ERICSSON_MBM}="1"
# Ericsson C3607w
ATTRS{idVendor}=="0bdb", ATTRS{idProduct}=="1049", ENV{ID_MM_ERICSSON_MBM}="1"
+# Ericsson C3607w v2
+ATTRS{idVendor}=="0bdb", ATTRS{idProduct}=="190b", ENV{ID_MM_ERICSSON_MBM}="1"
+
# Sony-Ericsson MD300
ATTRS{idVendor}=="0fce", ATTRS{idProduct}=="d0cf", ENV{ID_MM_ERICSSON_MBM}="1"
diff --git a/plugins/mm-modem-huawei-cdma.c b/plugins/mm-modem-huawei-cdma.c
index 3b63a486..19b731a8 100644
--- a/plugins/mm-modem-huawei-cdma.c
+++ b/plugins/mm-modem-huawei-cdma.c
@@ -41,16 +41,26 @@ mm_modem_huawei_cdma_new (const char *device,
gboolean evdo_rev0,
gboolean evdo_revA)
{
+ gboolean try_css = TRUE;
+
g_return_val_if_fail (device != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
g_return_val_if_fail (plugin != NULL, NULL);
+ /* Don't use AT+CSS on EVDO-capable hardware for determining registration
+ * status, because often the device will have only an EVDO connection and
+ * AT+CSS won't necessarily report EVDO registration status, only 1X.
+ */
+ if (evdo_rev0 || evdo_revA)
+ try_css = FALSE;
+
return MM_MODEM (g_object_new (MM_TYPE_MODEM_HUAWEI_CDMA,
MM_MODEM_MASTER_DEVICE, device,
MM_MODEM_DRIVER, driver,
MM_MODEM_PLUGIN, plugin,
MM_GENERIC_CDMA_EVDO_REV0, evdo_rev0,
MM_GENERIC_CDMA_EVDO_REVA, evdo_revA,
+ MM_GENERIC_CDMA_REGISTRATION_TRY_CSS, try_css,
NULL));
}
diff --git a/plugins/mm-modem-sierra-gsm.c b/plugins/mm-modem-sierra-gsm.c
index ee82234a..c2240908 100644
--- a/plugins/mm-modem-sierra-gsm.c
+++ b/plugins/mm-modem-sierra-gsm.c
@@ -117,9 +117,16 @@ grab_port (MMModem *modem,
port = mm_generic_gsm_grab_port (gsm, subsys, name, ptype, error);
- if (port && MM_IS_SERIAL_PORT (port))
+ if (port && MM_IS_SERIAL_PORT (port)) {
+ GRegex *regex;
+
g_object_set (G_OBJECT (port), MM_PORT_CARRIER_DETECT, FALSE, NULL);
+ regex = g_regex_new ("\\r\\n\\+PACSP0\\r\\n", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
+ mm_serial_port_add_unsolicited_msg_handler (MM_SERIAL_PORT (port), regex, NULL, NULL, NULL);
+ g_regex_unref (regex);
+ }
+
return !!port;
}
diff --git a/plugins/mm-modem-zte.c b/plugins/mm-modem-zte.c
index 92c23aeb..6198a60b 100644
--- a/plugins/mm-modem-zte.c
+++ b/plugins/mm-modem-zte.c
@@ -32,6 +32,8 @@ G_DEFINE_TYPE_EXTENDED (MMModemZte, mm_modem_zte, MM_TYPE_GENERIC_GSM, 0,
typedef struct {
gboolean init_retried;
+ guint32 cpms_tries;
+ guint cpms_timeout;
} MMModemZtePrivate;
MMModem *
@@ -54,6 +56,52 @@ mm_modem_zte_new (const char *device,
/* Modem class override functions */
/*****************************************************************************/
+static void cpms_try_done (MMSerialPort *port,
+ GString *response,
+ GError *error,
+ gpointer user_data);
+
+static gboolean
+cpms_timeout_cb (gpointer user_data)
+{
+ MMCallbackInfo *info = user_data;
+ MMModem *modem = info->modem;
+ MMModemZtePrivate *priv = MM_MODEM_ZTE_GET_PRIVATE (modem);
+ MMSerialPort *primary;
+
+ priv->cpms_timeout = 0;
+
+ primary = mm_generic_gsm_get_port (MM_GENERIC_GSM (modem), MM_PORT_TYPE_PRIMARY);
+ mm_serial_port_queue_command (primary, "+CPMS?", 10, cpms_try_done, info);
+ return FALSE;
+}
+
+static void
+cpms_try_done (MMSerialPort *port,
+ GString *response,
+ GError *error,
+ gpointer user_data)
+{
+ MMCallbackInfo *info = user_data;
+ MMModemZtePrivate *priv = MM_MODEM_ZTE_GET_PRIVATE (info->modem);
+
+ if (error && g_error_matches (error, MM_MOBILE_ERROR, MM_MOBILE_ERROR_SIM_BUSY)) {
+ if (priv->cpms_tries++ < 4) {
+ if (priv->cpms_timeout)
+ g_source_remove (priv->cpms_timeout);
+
+ /* Have to try a few times; sometimes the SIM is busy */
+ priv->cpms_timeout = g_timeout_add_seconds (2, cpms_timeout_cb, info);
+ return;
+ } else {
+ /* oh well, proceed... */
+ error = NULL;
+ }
+ }
+
+ mm_generic_gsm_enable_complete (MM_GENERIC_GSM (info->modem), error, info);
+}
+
static void
init_modem_done (MMSerialPort *port,
GString *response,
@@ -62,7 +110,12 @@ init_modem_done (MMSerialPort *port,
{
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
- mm_generic_gsm_enable_complete (MM_GENERIC_GSM (info->modem), error, info);
+ /* Attempt to disable floods of "+ZUSIMR:2" unsolicited responses that
+ * eventually fill up the device's buffers and make it crash. Normally
+ * done during probing, but if the device has a PIN enabled it won't
+ * accept the +CPMS? during the probe and we have to do it here.
+ */
+ mm_serial_port_queue_command (port, "+CPMS?", 10, cpms_try_done, info);
}
static void
@@ -222,6 +275,16 @@ mm_modem_zte_init (MMModemZte *self)
}
static void
+dispose (GObject *object)
+{
+ MMModemZte *self = MM_MODEM_ZTE (object);
+ MMModemZtePrivate *priv = MM_MODEM_ZTE_GET_PRIVATE (self);
+
+ if (priv->cpms_timeout)
+ g_source_remove (priv->cpms_timeout);
+}
+
+static void
mm_modem_zte_class_init (MMModemZteClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -230,6 +293,7 @@ mm_modem_zte_class_init (MMModemZteClass *klass)
mm_modem_zte_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (object_class, sizeof (MMModemZtePrivate));
+ object_class->dispose = dispose;
gsm_class->do_enable = do_enable;
}
diff --git a/po/LINGUAS b/po/LINGUAS
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/po/LINGUAS
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644
index 00000000..f97552d8
--- /dev/null
+++ b/po/POTFILES.in
@@ -0,0 +1,5 @@
+[encoding: UTF-8]
+# List of source files containing translatable strings.
+# Please keep this file sorted alphabetically.
+policy/org.freedesktop.modem-manager.policy.in
+
diff --git a/policy/org.freedesktop.modem-manager.policy.in b/policy/org.freedesktop.modem-manager.policy.in
new file mode 100644
index 00000000..1c6f214c
--- /dev/null
+++ b/policy/org.freedesktop.modem-manager.policy.in
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE policyconfig PUBLIC
+ "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
+
+<policyconfig>
+
+ <vendor>ModemManager</vendor>
+ <vendor_url>http://www.freedesktop.org/wiki/ModemManager</vendor_url>
+ <icon_name>modem-manager</icon_name>
+
+ <action id="org.freedesktop.ModemManager.Device">
+ <_description>Unlock and retrieve mobile broadband device information</_description>
+ <_message>System policy prevents unlocking the device or requesting information from it.</_message>
+ <defaults>
+ <allow_inactive>no</allow_inactive>
+ <allow_active>auth_self_keep</allow_active>
+ </defaults>
+ </action>
+
+ <action id="org.freedesktop.ModemManager.Contacts">
+ <_description>Add, modify, and delete mobile broadband contacts</_description>
+ <_message>System policy prevents adding, modifying, or deleteing this device's contacts.</_message>
+ <defaults>
+ <allow_inactive>no</allow_inactive>
+ <allow_active>auth_self_keep</allow_active>
+ </defaults>
+ </action>
+
+ <action id="org.freedesktop.ModemManager.SMS">
+ <_description>Send, save, modify, and delete text messages</_description>
+ <_message>System policy prevents sending or maniuplating this device's text messages.</_message>
+ <defaults>
+ <allow_inactive>no</allow_inactive>
+ <allow_active>auth_self_keep</allow_active>
+ </defaults>
+ </action>
+
+</policyconfig>
diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c
index 4718d6fc..d26f1171 100644
--- a/src/mm-generic-gsm.c
+++ b/src/mm-generic-gsm.c
@@ -51,6 +51,8 @@ typedef struct {
gboolean valid;
gboolean pin_checked;
+ guint32 pin_check_tries;
+ guint pin_check_timeout;
char *oper_code;
char *oper_name;
@@ -201,8 +203,8 @@ pin_check_done (MMSerialPort *port,
if (error)
info->error = g_error_copy (error);
- else if (g_str_has_prefix (response->str, "+CPIN: ")) {
- const char *str = response->str + 7;
+ else if (response && strstr (response->str, "+CPIN: ")) {
+ const char *str = strstr (response->str, "+CPIN: ") + 7;
if (g_str_has_prefix (str, "READY")) {
mm_modem_base_set_unlock_required (MM_MODEM_BASE (info->modem), NULL);
@@ -297,6 +299,20 @@ check_valid (MMGenericGsm *self)
mm_modem_base_set_valid (MM_MODEM_BASE (self), new_valid);
}
+
+static void initial_pin_check_done (MMModem *modem, GError *error, gpointer user_data);
+
+static gboolean
+pin_check_again (gpointer user_data)
+{
+ MMGenericGsm *self = MM_GENERIC_GSM (user_data);
+ MMGenericGsmPrivate *priv = MM_GENERIC_GSM_GET_PRIVATE (self);
+
+ priv->pin_check_timeout = 0;
+ mm_generic_gsm_check_pin (self, initial_pin_check_done, GUINT_TO_POINTER (TRUE));
+ return FALSE;
+}
+
static void
initial_pin_check_done (MMModem *modem, GError *error, gpointer user_data)
{
@@ -306,10 +322,20 @@ initial_pin_check_done (MMModem *modem, GError *error, gpointer user_data)
/* modem could have been removed before we get here, in which case
* 'modem' will be NULL.
*/
- if (modem) {
- g_return_if_fail (MM_IS_GENERIC_GSM (modem));
- priv = MM_GENERIC_GSM_GET_PRIVATE (modem);
+ if (!modem)
+ return;
+ g_return_if_fail (MM_IS_GENERIC_GSM (modem));
+ priv = MM_GENERIC_GSM_GET_PRIVATE (modem);
+
+ if ( error
+ && priv->pin_check_tries++ < 3
+ && !mm_modem_base_get_unlock_required (MM_MODEM_BASE (modem))) {
+ /* Try it again a few times */
+ if (priv->pin_check_timeout)
+ g_source_remove (priv->pin_check_timeout);
+ priv->pin_check_timeout = g_timeout_add_seconds (2, pin_check_again, modem);
+ } else {
priv->pin_checked = TRUE;
if (close_port)
mm_serial_port_close (priv->primary);
@@ -2284,6 +2310,9 @@ finalize (GObject *object)
mm_generic_gsm_pending_registration_stop (MM_GENERIC_GSM (object));
+ if (priv->pin_check_timeout)
+ g_source_remove (priv->pin_check_timeout);
+
g_free (priv->oper_code);
g_free (priv->oper_name);
diff --git a/src/mm-modem-base.c b/src/mm-modem-base.c
index 6e9ee75f..43ec6f84 100644
--- a/src/mm-modem-base.c
+++ b/src/mm-modem-base.c
@@ -170,7 +170,17 @@ mm_modem_base_get_valid (MMModemBase *self)
return MM_MODEM_BASE_GET_PRIVATE (self)->valid;
}
-void mm_modem_base_set_unlock_required (MMModemBase *self, const char *unlock_required)
+const char *
+mm_modem_base_get_unlock_required (MMModemBase *self)
+{
+ g_return_val_if_fail (self != NULL, NULL);
+ g_return_val_if_fail (MM_IS_MODEM_BASE (self), NULL);
+
+ return MM_MODEM_BASE_GET_PRIVATE (self)->unlock_required;
+}
+
+void
+mm_modem_base_set_unlock_required (MMModemBase *self, const char *unlock_required)
{
MMModemBasePrivate *priv;
const char *dbus_path;
diff --git a/src/mm-modem-base.h b/src/mm-modem-base.h
index 9078f3f2..db2b5fb6 100644
--- a/src/mm-modem-base.h
+++ b/src/mm-modem-base.h
@@ -60,6 +60,8 @@ void mm_modem_base_set_valid (MMModemBase *self,
gboolean mm_modem_base_get_valid (MMModemBase *self);
+const char *mm_modem_base_get_unlock_required (MMModemBase *self);
+
void mm_modem_base_set_unlock_required (MMModemBase *self,
const char *unlock_required);
diff --git a/src/tests/test-modem-helpers.c b/src/tests/test-modem-helpers.c
index 3d93423e..f5b4b6a8 100644
--- a/src/tests/test-modem-helpers.c
+++ b/src/tests/test-modem-helpers.c
@@ -409,6 +409,27 @@ test_cops_response_gobi (void *f, gpointer d)
}
static void
+test_cops_response_sek600i (void *f, gpointer d)
+{
+ /* Phone is stupid enough to support 3G but not report cell technology,
+ * mixing together 2G and 3G cells without any way of distinguishing
+ * which is which...
+ */
+ const char *reply = "+COPS: (2,\"blau\",\"\",\"26203\"),(2,\"blau\",\"\",\"26203\"),(3,\"\",\"\",\"26201\"),(3,\"\",\"\",\"26202\"),(3,\"\",\"\",\"26207\"),(3,\"\",\"\",\"26201\"),(3,\"\",\"\",\"26207\")";
+ static OperEntry expected[] = {
+ { "2", "blau", NULL, "26203", NULL },
+ { "2", "blau", NULL, "26203", NULL },
+ { "3", NULL, NULL, "26201", NULL },
+ { "3", NULL, NULL, "26202", NULL },
+ { "3", NULL, NULL, "26207", NULL },
+ { "3", NULL, NULL, "26201", NULL },
+ { "3", NULL, NULL, "26207", NULL },
+ };
+
+ test_results ("Sony-Ericsson K600i", reply, &expected[0], ARRAY_LEN (expected));
+}
+
+static void
test_cops_response_gsm_invalid (void *f, gpointer d)
{
const char *reply = "+COPS: (0,1,2,3),(1,2,3,4)";
@@ -470,6 +491,7 @@ int main (int argc, char **argv)
g_test_suite_add (suite, TESTCASE (test_cops_response_gtultraexpress, NULL));
g_test_suite_add (suite, TESTCASE (test_cops_response_n2720, NULL));
g_test_suite_add (suite, TESTCASE (test_cops_response_gobi, NULL));
+ g_test_suite_add (suite, TESTCASE (test_cops_response_sek600i, NULL));
g_test_suite_add (suite, TESTCASE (test_cops_response_gsm_invalid, NULL));
g_test_suite_add (suite, TESTCASE (test_cops_response_umts_invalid, NULL));