From 7fdacfc89bb233ee0018a9ae64ce1ffa5a23f5d3 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 8 Feb 2010 11:45:50 -0800 Subject: [PATCH 01/10] test: add SE K600i COPS response testcase --- src/tests/test-modem-helpers.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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 @@ -408,6 +408,27 @@ test_cops_response_gobi (void *f, gpointer d) test_results ("Qualcomm Gobi", reply, &expected[0], ARRAY_LEN (expected)); } +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) { @@ -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)); From 33c63a6681f439012524e5a68f6aa7220f38d120 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 8 Feb 2010 12:37:06 -0800 Subject: [PATCH 02/10] zte: quite ZUSIMR messages for PIN-enabled devices too Normally this would get done by the prober, but if the device has a PIN enabled it'll reject almost all commands so the +CPMS? in the prober will fail. Thus we have to do it after we've unlocked the device. --- plugins/mm-modem-zte.c | 66 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) 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 @@ -221,6 +274,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) { @@ -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; } From 953095466d210b76d785175957af0cb686fc5c04 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 9 Feb 2010 22:14:06 -0800 Subject: [PATCH 03/10] sierra: ignore +PACSP0 on GSM devices --- plugins/mm-modem-sierra-gsm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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; } From 95dd4b5be1ebb0408be6e282eb20e2c45df1f253 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 9 Feb 2010 22:58:44 -0800 Subject: [PATCH 04/10] gsm: try initial PIN check a few times in case SIM is busy --- src/mm-generic-gsm.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c index 4718d6fc..fb141915 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; @@ -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,18 @@ 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) { + /* 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 +2308,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); From d8ea5ea003f6e06520ec1254d89ec5fec5438d18 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 9 Feb 2010 23:44:23 -0800 Subject: [PATCH 05/10] gsm: fix initial PIN checking for devices that echo by default If the modem echoed commands by default (since we may not have initialized the modem yet), the echoed command would confuse the PIN check reply parser. --- src/mm-generic-gsm.c | 8 +++++--- src/mm-modem-base.c | 12 +++++++++++- src/mm-modem-base.h | 2 ++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c index fb141915..d26f1171 100644 --- a/src/mm-generic-gsm.c +++ b/src/mm-generic-gsm.c @@ -203,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); @@ -328,7 +328,9 @@ initial_pin_check_done (MMModem *modem, GError *error, gpointer user_data) g_return_if_fail (MM_IS_GENERIC_GSM (modem)); priv = MM_GENERIC_GSM_GET_PRIVATE (modem); - if (error && priv->pin_check_tries++ < 3) { + 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); 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); From 1a7be4a379e95a0ceb5ed1d30540eaf75354f27f Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 11 Feb 2010 08:12:41 -0800 Subject: [PATCH 06/10] huawei: ignore CSS on EVDO-capable modems (rh #553199) Since CSS doesn't reliably determine EVDO-only registration state. --- plugins/mm-modem-huawei-cdma.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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)); } From 9c958c99bc7621fc800617246e5a9fa4bc4d48c8 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 16 Feb 2010 11:03:16 -0800 Subject: [PATCH 07/10] build: add intltool support for PolicyKit policy translations --- .gitignore | 5 +++++ Makefile.am | 17 +++++++++++++---- autogen.sh | 1 + configure.ac | 10 ++++++++++ po/LINGUAS | 0 po/POTFILES.in | 4 ++++ 6 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 po/LINGUAS create mode 100644 po/POTFILES.in diff --git a/.gitignore b/.gitignore index e9173005..eebc928a 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ configure depcomp install-sh ltmain.sh +intltool-* missing stamp-h1 *~ @@ -30,6 +31,10 @@ callouts/mm-modem-probe test/lsudev src/tests/test-modem-helpers +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 915f82e5..f271b9cb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,7 +19,7 @@ all: $(GENERATED_FILES) CLEANFILES = $(GENERATED_FILES) endif -SUBDIRS = marshallers src plugins introspection test +SUBDIRS = marshallers src plugins introspection po 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 0e37ddd8..ae37fdcd 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) @@ -93,6 +102,7 @@ src/tests/Makefile plugins/Makefile test/Makefile introspection/Makefile +po/Makefile.in ]) AC_OUTPUT diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 00000000..e69de29b diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 00000000..ac2f4e43 --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,4 @@ +[encoding: UTF-8] +# List of source files containing translatable strings. +# Please keep this file sorted alphabetically. + From dcedb5273c059476813dc68d0617210d0835710b Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 19 Feb 2010 11:34:47 -0800 Subject: [PATCH 08/10] mbm: add new C3607w device ID --- plugins/77-mm-ericsson-mbm.rules | 3 +++ 1 file changed, 3 insertions(+) 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" From 16b2f40f1cd83ab37eb079b41a0f35bbcf877c93 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 19 Feb 2010 18:21:07 -0800 Subject: [PATCH 09/10] policy: add basic PolicyKit authorizations --- Makefile.am | 2 +- configure.ac | 1 + .../org.freedesktop.modem-manager.policy.in | 39 +++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 policy/org.freedesktop.modem-manager.policy.in diff --git a/Makefile.am b/Makefile.am index f271b9cb..860956bf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,7 +19,7 @@ all: $(GENERATED_FILES) CLEANFILES = $(GENERATED_FILES) endif -SUBDIRS = marshallers src plugins introspection po test +SUBDIRS = marshallers src plugins introspection po policy test dbusservicedir = $(DBUS_SYS_DIR) dbusservice_DATA = org.freedesktop.ModemManager.conf diff --git a/configure.ac b/configure.ac index ae37fdcd..db885dc0 100644 --- a/configure.ac +++ b/configure.ac @@ -103,6 +103,7 @@ plugins/Makefile test/Makefile introspection/Makefile po/Makefile.in +policy/Makefile ]) AC_OUTPUT 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 @@ + + + + + + ModemManager + http://www.freedesktop.org/wiki/ModemManager + modem-manager + + + <_description>Unlock and retrieve mobile broadband device information + <_message>System policy prevents unlocking the device or requesting information from it. + + no + auth_self_keep + + + + + <_description>Add, modify, and delete mobile broadband contacts + <_message>System policy prevents adding, modifying, or deleteing this device's contacts. + + no + auth_self_keep + + + + + <_description>Send, save, modify, and delete text messages + <_message>System policy prevents sending or maniuplating this device's text messages. + + no + auth_self_keep + + + + From 9185ce987d254aab07b0e8439a2788ce0670e59d Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 19 Feb 2010 18:23:19 -0800 Subject: [PATCH 10/10] po: add translatable --- po/POTFILES.in | 1 + 1 file changed, 1 insertion(+) diff --git a/po/POTFILES.in b/po/POTFILES.in index ac2f4e43..f97552d8 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,4 +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