Merge remote branch 'origin/master' into qcdm
This commit is contained in:
@@ -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
|
||||
|
||||
+13
-4
@@ -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
|
||||
|
||||
@@ -15,6 +15,7 @@ PKG_NAME=ModemManager
|
||||
|
||||
(cd $srcdir;
|
||||
autoreconf --install --symlink &&
|
||||
intltoolize --force &&
|
||||
autoreconf &&
|
||||
./configure --enable-maintainer-mode $@
|
||||
)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+65
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
+34
-5
@@ -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);
|
||||
|
||||
|
||||
+11
-1
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user