summary refs log tree commit diff
path: root/src/modem-manager
diff options
context:
space:
mode:
Diffstat (limited to 'src/modem-manager')
-rw-r--r--src/modem-manager/Makefile.am35
-rw-r--r--src/modem-manager/Makefile.in611
-rw-r--r--src/modem-manager/nm-modem-cdma.c351
-rw-r--r--src/modem-manager/nm-modem-cdma.h56
-rw-r--r--src/modem-manager/nm-modem-gsm.c554
-rw-r--r--src/modem-manager/nm-modem-gsm.h56
-rw-r--r--src/modem-manager/nm-modem-manager.c443
-rw-r--r--src/modem-manager/nm-modem-manager.h53
-rw-r--r--src/modem-manager/nm-modem-types.h111
-rw-r--r--src/modem-manager/nm-modem.c1147
-rw-r--r--src/modem-manager/nm-modem.h157
11 files changed, 3574 insertions, 0 deletions
diff --git a/src/modem-manager/Makefile.am b/src/modem-manager/Makefile.am
new file mode 100644
index 00000000..a0f65c1b
--- /dev/null
+++ b/src/modem-manager/Makefile.am
@@ -0,0 +1,35 @@
+INCLUDES = \
+	-I${top_srcdir}/src \
+	-I${top_srcdir}/src/logging \
+	-I${top_srcdir}/include \
+	-I${top_srcdir}/libnm-util \
+	-I${top_builddir}/marshallers
+
+noinst_LTLIBRARIES = libmodem-manager.la
+
+libmodem_manager_la_SOURCES = \
+	nm-modem.c \
+	nm-modem.h \
+	nm-modem-cdma.c \
+	nm-modem-cdma.h \
+	nm-modem-gsm.c \
+	nm-modem-gsm.h \
+	nm-modem-manager.h \
+	nm-modem-manager.c \
+	nm-modem-types.h
+
+libmodem_manager_la_CPPFLAGS = \
+	$(DBUS_CFLAGS)
+
+libmodem_manager_la_LIBADD = \
+	$(top_builddir)/marshallers/libmarshallers.la \
+	$(top_builddir)/src/logging/libnm-logging.la \
+	$(DBUS_LIBS)
+
+nm-serial-device-glue.h: $(top_srcdir)/introspection/nm-device-serial.xml
+	dbus-binding-tool --prefix=nm_serial_device --mode=glib-server --output=$@ $<
+
+BUILT_SOURCES = \
+	nm-serial-device-glue.h
+
+CLEANFILES = $(BUILT_SOURCES)
diff --git a/src/modem-manager/Makefile.in b/src/modem-manager/Makefile.in
new file mode 100644
index 00000000..26e67a1d
--- /dev/null
+++ b/src/modem-manager/Makefile.in
@@ -0,0 +1,611 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = src/modem-manager
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \
+	$(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/intltool.m4 \
+	$(top_srcdir)/m4/libnl-check.m4 $(top_srcdir)/m4/libtool.m4 \
+	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libmodem_manager_la_DEPENDENCIES =  \
+	$(top_builddir)/marshallers/libmarshallers.la \
+	$(top_builddir)/src/logging/libnm-logging.la \
+	$(am__DEPENDENCIES_1)
+am_libmodem_manager_la_OBJECTS = libmodem_manager_la-nm-modem.lo \
+	libmodem_manager_la-nm-modem-cdma.lo \
+	libmodem_manager_la-nm-modem-gsm.lo \
+	libmodem_manager_la-nm-modem-manager.lo
+libmodem_manager_la_OBJECTS = $(am_libmodem_manager_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(libmodem_manager_la_SOURCES)
+DIST_SOURCES = $(libmodem_manager_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
+ALL_LINGUAS = @ALL_LINGUAS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIRNAME = @DATADIRNAME@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DBUS_SYS_DIR = @DBUS_SYS_DIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DHCLIENT_PATH = @DHCLIENT_PATH@
+DHCPCD_PATH = @DHCPCD_PATH@
+DISABLE_DEPRECATED = @DISABLE_DEPRECATED@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GIO_CFLAGS = @GIO_CFLAGS@
+GIO_LIBS = @GIO_LIBS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GMODULE_CFLAGS = @GMODULE_CFLAGS@
+GMODULE_LIBS = @GMODULE_LIBS@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
+GREP = @GREP@
+GTKDOC_CHECK = @GTKDOC_CHECK@
+GTKDOC_MKPDF = @GTKDOC_MKPDF@
+GTKDOC_REBASE = @GTKDOC_REBASE@
+GUDEV_CFLAGS = @GUDEV_CFLAGS@
+GUDEV_LIBS = @GUDEV_LIBS@
+HTML_DIR = @HTML_DIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INSTOBJEXT = @INSTOBJEXT@
+INTLLIBS = @INTLLIBS@
+INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
+INTLTOOL_MERGE = @INTLTOOL_MERGE@
+INTLTOOL_PERL = @INTLTOOL_PERL@
+INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
+IPTABLES_PATH = @IPTABLES_PATH@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDL = @LIBDL@
+LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+LIBM = @LIBM@
+LIBNL_CFLAGS = @LIBNL_CFLAGS@
+LIBNL_LIBS = @LIBNL_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+MSGFMT_OPTS = @MSGFMT_OPTS@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NSS_CFLAGS = @NSS_CFLAGS@
+NSS_LIBS = @NSS_LIBS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+POFILES = @POFILES@
+POLKIT_CFLAGS = @POLKIT_CFLAGS@
+POLKIT_LIBS = @POLKIT_LIBS@
+POSUB = @POSUB@
+PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
+PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
+PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@
+RANLIB = @RANLIB@
+RESOLVCONF_PATH = @RESOLVCONF_PATH@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+SYSTEM_CA_PATH = @SYSTEM_CA_PATH@
+UDEV_BASE_DIR = @UDEV_BASE_DIR@
+USE_NLS = @USE_NLS@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+INCLUDES = \
+	-I${top_srcdir}/src \
+	-I${top_srcdir}/src/logging \
+	-I${top_srcdir}/include \
+	-I${top_srcdir}/libnm-util \
+	-I${top_builddir}/marshallers
+
+noinst_LTLIBRARIES = libmodem-manager.la
+libmodem_manager_la_SOURCES = \
+	nm-modem.c \
+	nm-modem.h \
+	nm-modem-cdma.c \
+	nm-modem-cdma.h \
+	nm-modem-gsm.c \
+	nm-modem-gsm.h \
+	nm-modem-manager.h \
+	nm-modem-manager.c \
+	nm-modem-types.h
+
+libmodem_manager_la_CPPFLAGS = \
+	$(DBUS_CFLAGS)
+
+libmodem_manager_la_LIBADD = \
+	$(top_builddir)/marshallers/libmarshallers.la \
+	$(top_builddir)/src/logging/libnm-logging.la \
+	$(DBUS_LIBS)
+
+BUILT_SOURCES = \
+	nm-serial-device-glue.h
+
+CLEANFILES = $(BUILT_SOURCES)
+all: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/modem-manager/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu src/modem-manager/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libmodem-manager.la: $(libmodem_manager_la_OBJECTS) $(libmodem_manager_la_DEPENDENCIES) 
+	$(LINK)  $(libmodem_manager_la_OBJECTS) $(libmodem_manager_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmodem_manager_la-nm-modem-cdma.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmodem_manager_la-nm-modem-gsm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmodem_manager_la-nm-modem-manager.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmodem_manager_la-nm-modem.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+libmodem_manager_la-nm-modem.lo: nm-modem.c
+@am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmodem_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmodem_manager_la-nm-modem.lo -MD -MP -MF $(DEPDIR)/libmodem_manager_la-nm-modem.Tpo -c -o libmodem_manager_la-nm-modem.lo `test -f 'nm-modem.c' || echo '$(srcdir)/'`nm-modem.c
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libmodem_manager_la-nm-modem.Tpo $(DEPDIR)/libmodem_manager_la-nm-modem.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='nm-modem.c' object='libmodem_manager_la-nm-modem.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmodem_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmodem_manager_la-nm-modem.lo `test -f 'nm-modem.c' || echo '$(srcdir)/'`nm-modem.c
+
+libmodem_manager_la-nm-modem-cdma.lo: nm-modem-cdma.c
+@am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmodem_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmodem_manager_la-nm-modem-cdma.lo -MD -MP -MF $(DEPDIR)/libmodem_manager_la-nm-modem-cdma.Tpo -c -o libmodem_manager_la-nm-modem-cdma.lo `test -f 'nm-modem-cdma.c' || echo '$(srcdir)/'`nm-modem-cdma.c
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libmodem_manager_la-nm-modem-cdma.Tpo $(DEPDIR)/libmodem_manager_la-nm-modem-cdma.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='nm-modem-cdma.c' object='libmodem_manager_la-nm-modem-cdma.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmodem_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmodem_manager_la-nm-modem-cdma.lo `test -f 'nm-modem-cdma.c' || echo '$(srcdir)/'`nm-modem-cdma.c
+
+libmodem_manager_la-nm-modem-gsm.lo: nm-modem-gsm.c
+@am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmodem_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmodem_manager_la-nm-modem-gsm.lo -MD -MP -MF $(DEPDIR)/libmodem_manager_la-nm-modem-gsm.Tpo -c -o libmodem_manager_la-nm-modem-gsm.lo `test -f 'nm-modem-gsm.c' || echo '$(srcdir)/'`nm-modem-gsm.c
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libmodem_manager_la-nm-modem-gsm.Tpo $(DEPDIR)/libmodem_manager_la-nm-modem-gsm.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='nm-modem-gsm.c' object='libmodem_manager_la-nm-modem-gsm.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmodem_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmodem_manager_la-nm-modem-gsm.lo `test -f 'nm-modem-gsm.c' || echo '$(srcdir)/'`nm-modem-gsm.c
+
+libmodem_manager_la-nm-modem-manager.lo: nm-modem-manager.c
+@am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmodem_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmodem_manager_la-nm-modem-manager.lo -MD -MP -MF $(DEPDIR)/libmodem_manager_la-nm-modem-manager.Tpo -c -o libmodem_manager_la-nm-modem-manager.lo `test -f 'nm-modem-manager.c' || echo '$(srcdir)/'`nm-modem-manager.c
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libmodem_manager_la-nm-modem-manager.Tpo $(DEPDIR)/libmodem_manager_la-nm-modem-manager.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='nm-modem-manager.c' object='libmodem_manager_la-nm-modem-manager.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmodem_manager_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmodem_manager_la-nm-modem-manager.lo `test -f 'nm-modem-manager.c' || echo '$(srcdir)/'`nm-modem-manager.c
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+install: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+
+nm-serial-device-glue.h: $(top_srcdir)/introspection/nm-device-serial.xml
+	dbus-binding-tool --prefix=nm_serial_device --mode=glib-server --output=$@ $<
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/modem-manager/nm-modem-cdma.c b/src/modem-manager/nm-modem-cdma.c
new file mode 100644
index 00000000..c32c1822
--- /dev/null
+++ b/src/modem-manager/nm-modem-cdma.c
@@ -0,0 +1,351 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2009 - 2010 Red Hat, Inc.
+ * Copyright (C) 2009 Novell, Inc.
+ */
+
+#include <string.h>
+
+#include "nm-dbus-glib-types.h"
+#include "nm-modem-cdma.h"
+#include "nm-modem-types.h"
+#include "nm-device.h"
+#include "nm-dbus-manager.h"
+#include "nm-setting-connection.h"
+#include "nm-setting-cdma.h"
+#include "NetworkManagerUtils.h"
+#include "nm-logging.h"
+
+G_DEFINE_TYPE (NMModemCdma, nm_modem_cdma, NM_TYPE_MODEM)
+
+#define NM_MODEM_CDMA_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_MODEM_CDMA, NMModemCdmaPrivate))
+
+typedef struct {
+	DBusGProxyCall *call;
+
+	GHashTable *connect_properties;
+} NMModemCdmaPrivate;
+
+
+typedef enum {
+	NM_CDMA_ERROR_CONNECTION_NOT_CDMA = 0,
+	NM_CDMA_ERROR_CONNECTION_INVALID,
+	NM_CDMA_ERROR_CONNECTION_INCOMPATIBLE,
+} NMCdmaError;
+
+#define NM_CDMA_ERROR (nm_cdma_error_quark ())
+#define NM_TYPE_CDMA_ERROR (nm_cdma_error_get_type ())
+
+static GQuark
+nm_cdma_error_quark (void)
+{
+	static GQuark quark = 0;
+	if (!quark)
+		quark = g_quark_from_static_string ("nm-cdma-error");
+	return quark;
+}
+
+/* This should really be standard. */
+#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
+
+static GType
+nm_cdma_error_get_type (void)
+{
+	static GType etype = 0;
+
+	if (etype == 0) {
+		static const GEnumValue values[] = {
+			/* Connection was not a CDMA connection. */
+			ENUM_ENTRY (NM_CDMA_ERROR_CONNECTION_NOT_CDMA, "ConnectionNotCdma"),
+			/* Connection was not a valid CDMA connection. */
+			ENUM_ENTRY (NM_CDMA_ERROR_CONNECTION_INVALID, "ConnectionInvalid"),
+			/* Connection does not apply to this device. */
+			ENUM_ENTRY (NM_CDMA_ERROR_CONNECTION_INCOMPATIBLE, "ConnectionIncompatible"),
+			{ 0, 0, 0 }
+		};
+		etype = g_enum_register_static ("NMCdmaError", values);
+	}
+	return etype;
+}
+
+
+NMModem *
+nm_modem_cdma_new (const char *path,
+                   const char *device,
+                   const char *data_device,
+                   guint32 ip_method)
+{
+	g_return_val_if_fail (path != NULL, NULL);
+	g_return_val_if_fail (device != NULL, NULL);
+	g_return_val_if_fail (data_device != NULL, NULL);
+
+	return (NMModem *) g_object_new (NM_TYPE_MODEM_CDMA,
+	                                 NM_MODEM_PATH, path,
+	                                 NM_MODEM_DEVICE, device,
+	                                 NM_MODEM_IFACE, data_device,
+	                                 NM_MODEM_IP_METHOD, ip_method,
+	                                 NULL);
+}
+
+static void
+stage1_prepare_done (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
+{
+	NMModemCdma *self = NM_MODEM_CDMA (user_data);
+	NMModemCdmaPrivate *priv = NM_MODEM_CDMA_GET_PRIVATE (self);
+	GError *error = NULL;
+
+	priv->call = NULL;
+
+	if (priv->connect_properties) {
+		g_hash_table_destroy (priv->connect_properties);
+		priv->connect_properties = NULL;
+	}
+
+	if (dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID))
+		g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, TRUE, NM_DEVICE_STATE_REASON_NONE);
+	else {
+		nm_log_warn (LOGD_MB, "CDMA connection failed: (%d) %s",
+		             error ? error->code : -1,
+		             error && error->message ? error->message : "(unknown)");
+		g_error_free (error);
+		g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, FALSE, NM_DEVICE_STATE_REASON_NONE);
+	}
+}
+
+static void
+do_connect (NMModemCdma *self)
+{
+	NMModemCdmaPrivate *priv = NM_MODEM_CDMA_GET_PRIVATE (self);
+	DBusGProxy *proxy;
+
+	proxy = nm_modem_get_proxy (NM_MODEM (self), MM_DBUS_INTERFACE_MODEM_SIMPLE);
+	priv->call = dbus_g_proxy_begin_call_with_timeout (proxy,
+	                                                   "Connect", stage1_prepare_done,
+	                                                   self, NULL, 120000,
+	                                                   DBUS_TYPE_G_MAP_OF_VARIANT, priv->connect_properties,
+	                                                   G_TYPE_INVALID);
+}
+
+static void
+stage1_enable_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
+{
+	NMModemCdma *self = NM_MODEM_CDMA (user_data);
+	GError *error = NULL;
+
+	if (dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_INVALID))
+		do_connect (self);
+	else {
+		nm_log_warn (LOGD_MB, "CDMA modem enable failed: (%d) %s",
+		             error ? error->code : -1,
+		             error && error->message ? error->message : "(unknown)");
+		g_error_free (error);
+		g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, FALSE, NM_DEVICE_STATE_REASON_MODEM_INIT_FAILED);
+	}
+}
+
+static GHashTable *
+create_connect_properties (NMConnection *connection)
+{
+	NMSettingCdma *setting;
+	GHashTable *properties;
+	const char *str;
+
+	setting = NM_SETTING_CDMA (nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA));
+	properties = value_hash_create ();
+
+	str = nm_setting_cdma_get_number (setting);
+	if (str)
+		value_hash_add_str (properties, "number", str);
+
+	return properties;
+}
+
+static NMActStageReturn
+real_act_stage1_prepare (NMModem *modem,
+                         NMActRequest *req,
+                         GPtrArray **out_hints,
+                         const char **out_setting_name,
+                         NMDeviceStateReason *reason)
+{
+	NMModemCdma *self = NM_MODEM_CDMA (modem);
+	NMModemCdmaPrivate *priv = NM_MODEM_CDMA_GET_PRIVATE (self);
+	NMConnection *connection;
+
+	connection = nm_act_request_get_connection (req);
+	g_assert (connection);
+
+	*out_setting_name = nm_connection_need_secrets (connection, out_hints);
+	if (!*out_setting_name) {
+		gboolean enabled = nm_modem_get_mm_enabled (modem);
+		DBusGProxy *proxy;
+
+		if (priv->connect_properties)
+			g_hash_table_destroy (priv->connect_properties);
+		priv->connect_properties = create_connect_properties (connection);
+
+		if (enabled)
+			do_connect (self);
+		else {
+			proxy = nm_modem_get_proxy (modem, MM_DBUS_INTERFACE_MODEM);
+			dbus_g_proxy_begin_call_with_timeout (proxy,
+			                                      "Enable", stage1_enable_done,
+			                                      modem, NULL, 20000,
+			                                      G_TYPE_BOOLEAN, TRUE,
+			                                      G_TYPE_INVALID);
+		}
+	} else {
+		/* NMModem will handle requesting secrets... */
+	}
+
+	return NM_ACT_STAGE_RETURN_POSTPONE;
+}
+
+static NMConnection *
+real_get_best_auto_connection (NMModem *modem,
+							   GSList *connections,
+							   char **specific_object)
+{
+	GSList *iter;
+
+	for (iter = connections; iter; iter = g_slist_next (iter)) {
+		NMConnection *connection = NM_CONNECTION (iter->data);
+		NMSettingConnection *s_con;
+
+		s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
+		g_assert (s_con);
+
+		if (!nm_setting_connection_get_autoconnect (s_con))
+			continue;
+
+		if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_CDMA_SETTING_NAME))
+			continue;
+
+		return connection;
+	}
+	return NULL;
+}
+
+static gboolean
+real_check_connection_compatible (NMModem *modem,
+                                  NMConnection *connection,
+                                  GError **error)
+{
+	NMSettingConnection *s_con;
+	NMSettingCdma *s_cdma;
+
+	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
+	g_assert (s_con);
+
+	if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_CDMA_SETTING_NAME)) {
+		g_set_error (error,
+		             NM_CDMA_ERROR, NM_CDMA_ERROR_CONNECTION_NOT_CDMA,
+		             "The connection was not a CDMA connection.");
+		return FALSE;
+	}
+
+	s_cdma = NM_SETTING_CDMA (nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA));
+	if (!s_cdma) {
+		g_set_error (error,
+		             NM_CDMA_ERROR, NM_CDMA_ERROR_CONNECTION_INVALID,
+		             "The connection was not a valid CDMA connection.");
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+static gboolean
+real_get_user_pass (NMModem *modem,
+                    NMConnection *connection,
+                    const char **user,
+                    const char **pass)
+{
+	NMSettingCdma *s_cdma;
+
+	s_cdma = (NMSettingCdma *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA);
+	if (!s_cdma)
+		return FALSE;
+
+	if (user)
+		*user = nm_setting_cdma_get_username (s_cdma);
+	if (pass)
+		*pass = nm_setting_cdma_get_password (s_cdma);
+
+	return TRUE;
+}
+
+static const char *
+real_get_setting_name (NMModem *modem)
+{
+	return NM_SETTING_CDMA_SETTING_NAME;
+}
+
+static void
+real_deactivate_quickly (NMModem *modem, NMDevice *device)
+{
+	NMModemCdmaPrivate *priv = NM_MODEM_CDMA_GET_PRIVATE (modem);
+
+	if (priv->call) {
+		DBusGProxy *proxy;
+
+		proxy = nm_modem_get_proxy (modem, MM_DBUS_INTERFACE_MODEM_SIMPLE);
+		dbus_g_proxy_cancel_call (proxy, priv->call);
+		priv->call = NULL;
+	}
+
+	NM_MODEM_CLASS (nm_modem_cdma_parent_class)->deactivate_quickly (modem, device);	
+}
+
+/*****************************************************************************/
+
+static void
+nm_modem_cdma_init (NMModemCdma *self)
+{
+}
+
+static void
+dispose (GObject *object)
+{
+	NMModemCdma *self = NM_MODEM_CDMA (object);
+	NMModemCdmaPrivate *priv = NM_MODEM_CDMA_GET_PRIVATE (self);
+
+	if (priv->connect_properties)
+		g_hash_table_destroy (priv->connect_properties);
+
+	G_OBJECT_CLASS (nm_modem_cdma_parent_class)->dispose (object);
+}
+
+static void
+nm_modem_cdma_class_init (NMModemCdmaClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	NMModemClass *modem_class = NM_MODEM_CLASS (klass);
+
+	g_type_class_add_private (object_class, sizeof (NMModemCdmaPrivate));
+
+	/* Virtual methods */
+	object_class->dispose = dispose;
+	modem_class->get_user_pass = real_get_user_pass;
+	modem_class->get_setting_name = real_get_setting_name;
+	modem_class->get_best_auto_connection = real_get_best_auto_connection;
+	modem_class->check_connection_compatible = real_check_connection_compatible;
+	modem_class->act_stage1_prepare = real_act_stage1_prepare;
+	modem_class->deactivate_quickly = real_deactivate_quickly;
+
+	dbus_g_error_domain_register (NM_CDMA_ERROR, NULL, NM_TYPE_CDMA_ERROR);
+}
diff --git a/src/modem-manager/nm-modem-cdma.h b/src/modem-manager/nm-modem-cdma.h
new file mode 100644
index 00000000..0abe4e0c
--- /dev/null
+++ b/src/modem-manager/nm-modem-cdma.h
@@ -0,0 +1,56 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ * Copyright (C) 2009 Novell, Inc.
+ */
+
+#ifndef NM_MODEM_CDMA_H
+#define NM_MODEM_CDMA_H
+
+#include <nm-modem.h>
+
+G_BEGIN_DECLS
+
+#define NM_TYPE_MODEM_CDMA			  (nm_modem_cdma_get_type ())
+#define NM_MODEM_CDMA(obj)			  (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_MODEM_CDMA, NMModemCdma))
+#define NM_MODEM_CDMA_CLASS(klass)	  (G_TYPE_CHECK_CLASS_CAST ((klass),  NM_TYPE_MODEM_CDMA, NMModemCdmaClass))
+#define NM_IS_MODEM_CDMA(obj)		  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_MODEM_CDMA))
+#define NM_IS_MODEM_CDMA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  NM_TYPE_MODEM_CDMA))
+#define NM_MODEM_CDMA_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  NM_TYPE_MODEM_CDMA, NMModemCdmaClass))
+
+typedef struct {
+	NMModem parent;
+} NMModemCdma;
+
+typedef struct {
+	NMModemClass parent;
+
+	/* Signals */
+	void (*signal_quality) (NMModemCdma *self, guint32 quality);
+} NMModemCdmaClass;
+
+GType nm_modem_cdma_get_type (void);
+
+NMModem *nm_modem_cdma_new (const char *path,
+                            const char *device,
+                            const char *data_device,
+                            guint32 ip_method);
+
+G_END_DECLS
+
+#endif /* NM_MODEM_CDMA_H */
diff --git a/src/modem-manager/nm-modem-gsm.c b/src/modem-manager/nm-modem-gsm.c
new file mode 100644
index 00000000..abb96db1
--- /dev/null
+++ b/src/modem-manager/nm-modem-gsm.c
@@ -0,0 +1,554 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2009 - 2010 Red Hat, Inc.
+ * Copyright (C) 2009 Novell, Inc.
+ */
+
+#include <string.h>
+#include "nm-dbus-glib-types.h"
+#include "nm-modem-gsm.h"
+#include "nm-device.h"
+#include "nm-setting-connection.h"
+#include "nm-setting-gsm.h"
+#include "nm-modem-types.h"
+#include "nm-logging.h"
+#include "NetworkManagerUtils.h"
+
+typedef enum {
+    MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_ANY = 0,
+    MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_GPRS,
+    MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_EDGE,
+    MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_UMTS,
+    MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_HSDPA,
+    MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_2G_PREFERRED,
+    MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_3G_PREFERRED,
+    MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_2G_ONLY,
+    MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_3G_ONLY,
+    MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_HSUPA,
+    MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_HSPA,
+
+    MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_LAST = MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_HSPA
+} MMModemDeprecatedMode;
+
+typedef enum {
+    MM_MODEM_GSM_ALLOWED_MODE_ANY          = 0,
+    MM_MODEM_GSM_ALLOWED_MODE_2G_PREFERRED = 1,
+    MM_MODEM_GSM_ALLOWED_MODE_3G_PREFERRED = 2,
+    MM_MODEM_GSM_ALLOWED_MODE_2G_ONLY      = 3,
+    MM_MODEM_GSM_ALLOWED_MODE_3G_ONLY      = 4,
+
+    MM_MODEM_GSM_ALLOWED_MODE_LAST = MM_MODEM_GSM_ALLOWED_MODE_3G_ONLY
+} MMModemGsmAllowedMode;
+
+
+G_DEFINE_TYPE (NMModemGsm, nm_modem_gsm, NM_TYPE_MODEM)
+
+#define NM_MODEM_GSM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_MODEM_GSM, NMModemGsmPrivate))
+
+typedef struct {
+	DBusGProxyCall *call;
+
+	GHashTable *connect_properties;
+	guint32 pin_tries;
+} NMModemGsmPrivate;
+
+
+typedef enum {
+	NM_GSM_ERROR_CONNECTION_NOT_GSM = 0,
+	NM_GSM_ERROR_CONNECTION_INVALID,
+	NM_GSM_ERROR_CONNECTION_INCOMPATIBLE,
+} NMGsmError;
+
+#define NM_GSM_ERROR (nm_gsm_error_quark ())
+#define NM_TYPE_GSM_ERROR (nm_gsm_error_get_type ())
+
+static GQuark
+nm_gsm_error_quark (void)
+{
+	static GQuark quark = 0;
+	if (!quark)
+		quark = g_quark_from_static_string ("nm-gsm-error");
+	return quark;
+}
+
+/* This should really be standard. */
+#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
+
+static GType
+nm_gsm_error_get_type (void)
+{
+	static GType etype = 0;
+
+	if (etype == 0) {
+		static const GEnumValue values[] = {
+			/* Connection was not a GSM connection. */
+			ENUM_ENTRY (NM_GSM_ERROR_CONNECTION_NOT_GSM, "ConnectionNotGsm"),
+			/* Connection was not a valid GSM connection. */
+			ENUM_ENTRY (NM_GSM_ERROR_CONNECTION_INVALID, "ConnectionInvalid"),
+			/* Connection does not apply to this device. */
+			ENUM_ENTRY (NM_GSM_ERROR_CONNECTION_INCOMPATIBLE, "ConnectionIncompatible"),
+			{ 0, 0, 0 }
+		};
+		etype = g_enum_register_static ("NMGsmError", values);
+	}
+	return etype;
+}
+
+
+NMModem *
+nm_modem_gsm_new (const char *path,
+                  const char *device,
+                  const char *data_device,
+                  guint32 ip_method)
+{
+	g_return_val_if_fail (path != NULL, NULL);
+	g_return_val_if_fail (device != NULL, NULL);
+	g_return_val_if_fail (data_device != NULL, NULL);
+
+	return (NMModem *) g_object_new (NM_TYPE_MODEM_GSM,
+	                                 NM_MODEM_PATH, path,
+	                                 NM_MODEM_DEVICE, device,
+	                                 NM_MODEM_IFACE, data_device,
+	                                 NM_MODEM_IP_METHOD, ip_method,
+	                                 NULL);
+}
+
+static NMDeviceStateReason
+translate_mm_error (GError *error)
+{
+	NMDeviceStateReason reason;
+
+	if (dbus_g_error_has_name (error, MM_MODEM_CONNECT_ERROR_NO_CARRIER))
+		reason = NM_DEVICE_STATE_REASON_MODEM_NO_CARRIER;
+	if (dbus_g_error_has_name (error, MM_MODEM_CONNECT_ERROR_NO_DIALTONE))
+		reason = NM_DEVICE_STATE_REASON_MODEM_DIAL_TIMEOUT;
+	if (dbus_g_error_has_name (error, MM_MODEM_CONNECT_ERROR_BUSY))
+		reason = NM_DEVICE_STATE_REASON_MODEM_BUSY;
+	if (dbus_g_error_has_name (error, MM_MODEM_CONNECT_ERROR_NO_ANSWER))
+		reason = NM_DEVICE_STATE_REASON_MODEM_DIAL_TIMEOUT;
+	if (dbus_g_error_has_name (error, MM_MODEM_ERROR_NETWORK_NOT_ALLOWED))
+		reason = NM_DEVICE_STATE_REASON_GSM_REGISTRATION_DENIED;
+	if (dbus_g_error_has_name (error, MM_MODEM_ERROR_NETWORK_TIMEOUT))
+		reason = NM_DEVICE_STATE_REASON_GSM_REGISTRATION_TIMEOUT;
+	if (dbus_g_error_has_name (error, MM_MODEM_ERROR_NO_NETWORK))
+		reason = NM_DEVICE_STATE_REASON_GSM_REGISTRATION_NOT_SEARCHING;
+
+	/* FIXME: We have only GSM error messages here, and we have no idea which 
+	   activation state failed. Reasons like:
+	   NM_DEVICE_STATE_REASON_MODEM_DIAL_FAILED,
+	   NM_DEVICE_STATE_REASON_MODEM_INIT_FAILED,
+	   NM_DEVICE_STATE_REASON_GSM_APN_FAILED,
+	   NM_DEVICE_STATE_REASON_GSM_REGISTRATION_FAILED,
+	   NM_DEVICE_STATE_REASON_GSM_PIN_CHECK_FAILED
+	   are not used.
+	*/
+	else
+		reason = NM_DEVICE_STATE_REASON_UNKNOWN;
+
+	return reason;
+}
+
+static void
+ask_for_pin (NMModemGsm *self, gboolean always_ask)
+{
+	NMModemGsmPrivate *priv;
+	guint32 tries = 0;
+
+	g_return_if_fail (self != NULL);
+	g_return_if_fail (NM_IS_MODEM_GSM (self));
+
+	priv = NM_MODEM_GSM_GET_PRIVATE (self);
+
+	if (!always_ask)
+		tries = priv->pin_tries++;
+
+	g_signal_emit_by_name (self, NM_MODEM_NEED_AUTH,
+	                       NM_SETTING_GSM_SETTING_NAME,
+	                       (tries || always_ask) ? TRUE : FALSE,
+	                       SECRETS_CALLER_MOBILE_BROADBAND,
+	                       NM_SETTING_GSM_PIN,
+	                       NULL);
+}
+
+static void
+stage1_prepare_done (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
+{
+	NMModemGsm *self = NM_MODEM_GSM (user_data);
+	NMModemGsmPrivate *priv = NM_MODEM_GSM_GET_PRIVATE (self);
+	GError *error = NULL;
+
+	priv->call = NULL;
+
+	if (priv->connect_properties) {
+		g_hash_table_destroy (priv->connect_properties);
+		priv->connect_properties = NULL;
+	}
+
+	if (dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID))
+		g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, TRUE, NM_DEVICE_STATE_REASON_NONE);
+	else {
+		if (dbus_g_error_has_name (error, MM_MODEM_ERROR_SIM_PIN))
+			ask_for_pin (self, FALSE);
+		else if (dbus_g_error_has_name (error, MM_MODEM_ERROR_SIM_WRONG))
+			ask_for_pin (self, TRUE);
+		else {
+			nm_log_warn (LOGD_MB, "GSM connection failed: (%d) %s",
+			             error ? error->code : -1,
+			             error && error->message ? error->message : "(unknown)");
+
+			g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, FALSE, translate_mm_error (error));
+		}
+
+		g_error_free (error);
+	}
+}
+
+static void
+do_connect (NMModemGsm *self)
+{
+	NMModemGsmPrivate *priv = NM_MODEM_GSM_GET_PRIVATE (self);
+	DBusGProxy *proxy;
+
+	proxy = nm_modem_get_proxy (NM_MODEM (self), MM_DBUS_INTERFACE_MODEM_SIMPLE);
+	dbus_g_proxy_begin_call_with_timeout (proxy,
+	                                      "Connect", stage1_prepare_done,
+	                                      self, NULL, 120000,
+	                                      DBUS_TYPE_G_MAP_OF_VARIANT, priv->connect_properties,
+	                                      G_TYPE_INVALID);
+}
+
+static void stage1_enable_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data);
+
+static void
+do_enable (NMModemGsm *self)
+{
+	DBusGProxy *proxy;
+
+	g_return_if_fail (self != NULL);
+	g_return_if_fail (NM_IS_MODEM_GSM (self));
+
+	proxy = nm_modem_get_proxy (NM_MODEM (self), MM_DBUS_INTERFACE_MODEM);
+	dbus_g_proxy_begin_call_with_timeout (proxy,
+	                                      "Enable", stage1_enable_done,
+	                                      self, NULL, 20000,
+	                                      G_TYPE_BOOLEAN, TRUE,
+	                                      G_TYPE_INVALID);
+}
+
+static void
+stage1_pin_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
+{
+	NMModemGsm *self = NM_MODEM_GSM (user_data);
+	GError *error = NULL;
+
+	if (dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_INVALID)) {
+		/* Success; go back and try the enable again */
+		do_enable (self);
+	} else {
+		nm_log_warn (LOGD_MB, "GSM PIN unlock failed: (%d) %s",
+		             error ? error->code : -1,
+		             error && error->message ? error->message : "(unknown)");
+		g_error_free (error);
+
+		g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, FALSE, NM_DEVICE_STATE_REASON_MODEM_INIT_FAILED);
+	}
+}
+
+static void
+handle_enable_pin_required (NMModemGsm *self)
+{
+	NMModemGsmPrivate *priv = NM_MODEM_GSM_GET_PRIVATE (self);
+	const char *pin = NULL;
+	GValue *value;
+	DBusGProxy *proxy;
+
+	/* See if we have a PIN already */
+	value = g_hash_table_lookup (priv->connect_properties, "pin");
+	if (value && G_VALUE_HOLDS_STRING (value))
+		pin = g_value_get_string (value);
+
+	/* If we do, send it */
+	if (pin) {
+		proxy = nm_modem_get_proxy (NM_MODEM (self), MM_DBUS_INTERFACE_MODEM_GSM_CARD);
+		dbus_g_proxy_begin_call_with_timeout (proxy,
+		                                      "SendPin", stage1_pin_done,
+		                                      self, NULL, 10000,
+		                                      G_TYPE_STRING, pin,
+		                                      G_TYPE_INVALID);
+	} else
+		ask_for_pin (self, FALSE);
+}
+
+static void
+stage1_enable_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
+{
+	NMModemGsm *self = NM_MODEM_GSM (user_data);
+	GError *error = NULL;
+
+	if (dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_INVALID))
+		do_connect (self);
+	else {
+		nm_log_warn (LOGD_MB, "GSM modem enable failed: (%d) %s",
+		             error ? error->code : -1,
+		             error && error->message ? error->message : "(unknown)");
+
+		if (dbus_g_error_has_name (error, MM_MODEM_ERROR_SIM_PIN))
+			handle_enable_pin_required (self);
+		else
+			g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, FALSE, NM_DEVICE_STATE_REASON_MODEM_INIT_FAILED);
+
+		g_error_free (error);
+	}
+}
+
+
+static GHashTable *
+create_connect_properties (NMConnection *connection)
+{
+	NMSettingGsm *setting;
+	GHashTable *properties;
+	const char *str;
+
+	setting = NM_SETTING_GSM (nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM));
+	properties = value_hash_create ();
+
+	str = nm_setting_gsm_get_number (setting);
+	if (str)
+		value_hash_add_str (properties, "number", str);
+
+	str = nm_setting_gsm_get_apn (setting);
+	if (str)
+		value_hash_add_str (properties, "apn", str);
+
+	str = nm_setting_gsm_get_network_id (setting);
+	if (str)
+		value_hash_add_str (properties, "network_id", str);
+
+	str = nm_setting_gsm_get_pin (setting);
+	if (str)
+		value_hash_add_str (properties, "pin", str);
+
+	str = nm_setting_gsm_get_username (setting);
+	if (str)
+		value_hash_add_str (properties, "username", str);
+
+	str = nm_setting_gsm_get_password (setting);
+	if (str)
+		value_hash_add_str (properties, "password", str);
+
+	/* Add both old and new preferred modes */
+	switch (nm_setting_gsm_get_network_type (setting)) {
+	case NM_SETTING_GSM_NETWORK_TYPE_UMTS_HSPA:
+		value_hash_add_uint (properties, "network_mode", MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_3G_ONLY);
+		value_hash_add_uint (properties, "allowed_mode", MM_MODEM_GSM_ALLOWED_MODE_3G_ONLY);
+		break;
+	case NM_SETTING_GSM_NETWORK_TYPE_GPRS_EDGE:
+		value_hash_add_uint (properties, "network_mode", MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_2G_ONLY);
+		value_hash_add_uint (properties, "allowed_mode", MM_MODEM_GSM_ALLOWED_MODE_2G_ONLY);
+		break;
+	case NM_SETTING_GSM_NETWORK_TYPE_PREFER_UMTS_HSPA:
+		value_hash_add_uint (properties, "network_mode", MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_3G_PREFERRED);
+		value_hash_add_uint (properties, "allowed_mode", MM_MODEM_GSM_ALLOWED_MODE_3G_PREFERRED);
+		break;
+	case NM_SETTING_GSM_NETWORK_TYPE_PREFER_GPRS_EDGE:
+		value_hash_add_uint (properties, "network_mode", MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_2G_PREFERRED);
+		value_hash_add_uint (properties, "allowed_mode", MM_MODEM_GSM_ALLOWED_MODE_2G_PREFERRED);
+		break;
+	default:
+		value_hash_add_uint (properties, "network_mode", MM_MODEM_GSM_NETWORK_DEPRECATED_MODE_ANY);
+		value_hash_add_uint (properties, "allowed_mode", MM_MODEM_GSM_ALLOWED_MODE_ANY);
+		break;
+	}
+
+	/* Roaming */
+	if (nm_setting_gsm_get_home_only (setting))
+		value_hash_add_bool (properties, "home_only", TRUE);
+
+	return properties;
+}
+
+static NMActStageReturn
+real_act_stage1_prepare (NMModem *modem,
+                         NMActRequest *req,
+                         GPtrArray **out_hints,
+                         const char **out_setting_name,
+                         NMDeviceStateReason *reason)
+{
+	NMModemGsm *self = NM_MODEM_GSM (modem);
+	NMModemGsmPrivate *priv = NM_MODEM_GSM_GET_PRIVATE (self);
+	NMConnection *connection;
+
+	connection = nm_act_request_get_connection (req);
+	g_assert (connection);
+
+	*out_setting_name = nm_connection_need_secrets (connection, out_hints);
+	if (!*out_setting_name) {
+		gboolean enabled = nm_modem_get_mm_enabled (modem);
+
+		if (priv->connect_properties)
+			g_hash_table_destroy (priv->connect_properties);
+		priv->connect_properties = create_connect_properties (connection);
+
+		if (enabled)
+			do_connect (self);
+		else
+			do_enable (self);
+	} else {
+		/* NMModem will handle requesting secrets... */
+	}
+
+	return NM_ACT_STAGE_RETURN_POSTPONE;
+}
+
+static NMConnection *
+real_get_best_auto_connection (NMModem *modem,
+							   GSList *connections,
+							   char **specific_object)
+{
+	GSList *iter;
+
+	for (iter = connections; iter; iter = g_slist_next (iter)) {
+		NMConnection *connection = NM_CONNECTION (iter->data);
+		NMSettingConnection *s_con;
+
+		s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
+		g_assert (s_con);
+
+		if (!nm_setting_connection_get_autoconnect (s_con))
+			continue;
+
+		if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_GSM_SETTING_NAME))
+			continue;
+
+		return connection;
+	}
+	return NULL;
+}
+
+static gboolean
+real_check_connection_compatible (NMModem *modem,
+                                  NMConnection *connection,
+                                  GError **error)
+{
+	NMSettingConnection *s_con;
+	NMSettingGsm *s_gsm;
+
+	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
+	g_assert (s_con);
+
+	if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_GSM_SETTING_NAME)) {
+		g_set_error (error,
+		             NM_GSM_ERROR, NM_GSM_ERROR_CONNECTION_NOT_GSM,
+		             "The connection was not a GSM connection.");
+		return FALSE;
+	}
+
+	s_gsm = NM_SETTING_GSM (nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM));
+	if (!s_gsm) {
+		g_set_error (error,
+		             NM_GSM_ERROR, NM_GSM_ERROR_CONNECTION_INVALID,
+		             "The connection was not a valid GSM connection.");
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+static gboolean
+real_get_user_pass (NMModem *modem,
+                    NMConnection *connection,
+                    const char **user,
+                    const char **pass)
+{
+	NMSettingGsm *s_gsm;
+
+	s_gsm = (NMSettingGsm *) nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM);
+	if (!s_gsm)
+		return FALSE;
+
+	if (user)
+		*user = nm_setting_gsm_get_username (s_gsm);
+	if (pass)
+		*pass = nm_setting_gsm_get_password (s_gsm);
+
+	return TRUE;
+}
+
+static const char *
+real_get_setting_name (NMModem *modem)
+{
+	return NM_SETTING_GSM_SETTING_NAME;
+}
+
+static void
+real_deactivate_quickly (NMModem *modem, NMDevice *device)
+{
+	NMModemGsmPrivate *priv = NM_MODEM_GSM_GET_PRIVATE (modem);
+
+	if (priv->call) {
+		DBusGProxy *proxy;
+
+		proxy = nm_modem_get_proxy (modem, MM_DBUS_INTERFACE_MODEM_SIMPLE);
+		dbus_g_proxy_cancel_call (proxy, priv->call);
+		priv->call = NULL;
+	}
+
+	priv->pin_tries = 0;
+
+	NM_MODEM_CLASS (nm_modem_gsm_parent_class)->deactivate_quickly (modem, device);	
+}
+
+
+/*****************************************************************************/
+
+static void
+nm_modem_gsm_init (NMModemGsm *self)
+{
+}
+
+static void
+dispose (GObject *object)
+{
+	NMModemGsm *self = NM_MODEM_GSM (object);
+	NMModemGsmPrivate *priv = NM_MODEM_GSM_GET_PRIVATE (self);
+
+	if (priv->connect_properties)
+		g_hash_table_destroy (priv->connect_properties);
+
+	G_OBJECT_CLASS (nm_modem_gsm_parent_class)->dispose (object);
+}
+
+static void
+nm_modem_gsm_class_init (NMModemGsmClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	NMModemClass *modem_class = NM_MODEM_CLASS (klass);
+
+	g_type_class_add_private (object_class, sizeof (NMModemGsmPrivate));
+
+	/* Virtual methods */
+	object_class->dispose = dispose;
+	modem_class->get_user_pass = real_get_user_pass;
+	modem_class->get_setting_name = real_get_setting_name;
+	modem_class->get_best_auto_connection = real_get_best_auto_connection;
+	modem_class->check_connection_compatible = real_check_connection_compatible;
+	modem_class->act_stage1_prepare = real_act_stage1_prepare;
+	modem_class->deactivate_quickly = real_deactivate_quickly;
+
+	dbus_g_error_domain_register (NM_GSM_ERROR, NULL, NM_TYPE_GSM_ERROR);
+}
diff --git a/src/modem-manager/nm-modem-gsm.h b/src/modem-manager/nm-modem-gsm.h
new file mode 100644
index 00000000..f481bdb8
--- /dev/null
+++ b/src/modem-manager/nm-modem-gsm.h
@@ -0,0 +1,56 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ * Copyright (C) 2009 Novell, Inc.
+ */
+
+#ifndef NM_MODEM_GSM_H
+#define NM_MODEM_GSM_H
+
+#include <nm-modem.h>
+
+G_BEGIN_DECLS
+
+#define NM_TYPE_MODEM_GSM			 (nm_modem_gsm_get_type ())
+#define NM_MODEM_GSM(obj)			 (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_MODEM_GSM, NMModemGsm))
+#define NM_MODEM_GSM_CLASS(klass)	 (G_TYPE_CHECK_CLASS_CAST ((klass),	 NM_TYPE_MODEM_GSM, NMModemGsmClass))
+#define NM_IS_MODEM_GSM(obj)		 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_MODEM_GSM))
+#define NM_IS_MODEM_GSM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),	 NM_TYPE_MODEM_GSM))
+#define NM_MODEM_GSM_GET_CLASS(obj)	 (G_TYPE_INSTANCE_GET_CLASS ((obj),	 NM_TYPE_MODEM_GSM, NMModemGsmClass))
+
+typedef struct {
+	NMModem parent;
+} NMModemGsm;
+
+typedef struct {
+	NMModemClass parent;
+
+	/* Signals */
+	void (*signal_quality) (NMModemGsm *self, guint32 quality);
+} NMModemGsmClass;
+
+GType nm_modem_gsm_get_type (void);
+
+NMModem *nm_modem_gsm_new (const char *path,
+                           const char *device,
+                           const char *data_device,
+                           guint32 ip_method);
+
+G_END_DECLS
+
+#endif /* NM_MODEM_GSM_H */
diff --git a/src/modem-manager/nm-modem-manager.c b/src/modem-manager/nm-modem-manager.c
new file mode 100644
index 00000000..28f7b94d
--- /dev/null
+++ b/src/modem-manager/nm-modem-manager.c
@@ -0,0 +1,443 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2009 - 2010 Red Hat, Inc.
+ * Copyright (C) 2009 Novell, Inc.
+ * Copyright (C) 2009 Canonical Ltd.
+ */
+
+#include <string.h>
+#include "nm-modem-manager.h"
+#include "nm-logging.h"
+#include "nm-modem.h"
+#include "nm-modem-gsm.h"
+#include "nm-modem-cdma.h"
+#include "nm-dbus-manager.h"
+#include "nm-modem-types.h"
+#include "nm-marshal.h"
+
+#define MODEM_POKE_INTERVAL 120
+
+G_DEFINE_TYPE (NMModemManager, nm_modem_manager, G_TYPE_OBJECT)
+
+#define NM_MODEM_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_MODEM_MANAGER, NMModemManagerPrivate))
+
+typedef struct {
+	NMDBusManager *dbus_mgr;
+	DBusGProxy *proxy;
+	GHashTable *modems;
+	gboolean disposed;
+	guint poke_id;
+} NMModemManagerPrivate;
+
+enum {
+	MODEM_ADDED,
+	MODEM_REMOVED,
+
+	LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+
+NMModemManager *
+nm_modem_manager_get (void)
+{
+	static NMModemManager *singleton = NULL;
+
+	if (!singleton)
+		singleton = NM_MODEM_MANAGER (g_object_new (NM_TYPE_MODEM_MANAGER, NULL));
+	else
+		g_object_ref (singleton);
+
+	g_assert (singleton);
+	return singleton;
+}
+
+static gboolean
+get_modem_properties (DBusGConnection *connection,
+					  const char *path,
+					  char **device,
+					  char **data_device,
+					  char **driver,
+					  guint32 *type,
+					  guint32 *ip_method)
+{
+	DBusGProxy *proxy;
+	GValue value = { 0 };
+	GError *err = NULL;
+
+	proxy = dbus_g_proxy_new_for_name (connection,
+									   MM_DBUS_SERVICE,
+									   path,
+									   "org.freedesktop.DBus.Properties");
+
+	if (dbus_g_proxy_call_with_timeout (proxy, "Get", 15000, &err,
+	                                    G_TYPE_STRING, MM_DBUS_INTERFACE_MODEM,
+	                                    G_TYPE_STRING, "Type",
+	                                    G_TYPE_INVALID,
+	                                    G_TYPE_VALUE, &value,
+	                                    G_TYPE_INVALID)) {
+		*type = g_value_get_uint (&value);
+		g_value_unset (&value);
+	} else {
+		nm_log_warn (LOGD_MB, "could not get device type: %s", err->message);
+		goto out;
+	}
+
+	if (dbus_g_proxy_call_with_timeout (proxy, "Get", 15000, &err,
+	                                    G_TYPE_STRING, MM_DBUS_INTERFACE_MODEM,
+	                                    G_TYPE_STRING, "MasterDevice",
+	                                    G_TYPE_INVALID,
+	                                    G_TYPE_VALUE, &value,
+	                                    G_TYPE_INVALID)) {
+		*device = g_value_dup_string (&value);
+		g_value_unset (&value);
+	} else {
+		nm_log_warn (LOGD_MB, "could not get device: %s", err->message);
+		goto out;
+	}
+
+	if (dbus_g_proxy_call_with_timeout (proxy, "Get", 15000, &err,
+										G_TYPE_STRING, MM_DBUS_INTERFACE_MODEM,
+										G_TYPE_STRING, "IpMethod",
+										G_TYPE_INVALID,
+										G_TYPE_VALUE, &value,
+										G_TYPE_INVALID)) {
+		*ip_method = g_value_get_uint (&value);
+		g_value_unset (&value);
+	} else {
+		nm_log_warn (LOGD_MB, "could not get IP method: %s", err->message);
+		goto out;
+	}
+
+	if (dbus_g_proxy_call_with_timeout (proxy, "Get", 15000, &err,
+										G_TYPE_STRING, MM_DBUS_INTERFACE_MODEM,
+										G_TYPE_STRING, "Device",
+										G_TYPE_INVALID,
+										G_TYPE_VALUE, &value,
+										G_TYPE_INVALID)) {
+		*data_device = g_value_dup_string (&value);
+		g_value_unset (&value);
+	} else {
+		nm_log_warn (LOGD_MB, "could not get modem data device: %s", err->message);
+		goto out;
+	}
+
+	if (dbus_g_proxy_call_with_timeout (proxy, "Get", 15000, &err,
+										G_TYPE_STRING, MM_DBUS_INTERFACE_MODEM,
+										G_TYPE_STRING, "Driver",
+										G_TYPE_INVALID,
+										G_TYPE_VALUE, &value,
+										G_TYPE_INVALID)) {
+		*driver = g_value_dup_string (&value);
+		g_value_unset (&value);
+	} else {
+		nm_log_warn (LOGD_MB, "could not get modem driver: %s", err->message);
+		goto out;
+	}
+
+ out:
+	if (err)
+		g_error_free (err);
+
+	g_object_unref (proxy);
+
+	return *data_device && *driver;
+}
+
+static void
+create_modem (NMModemManager *manager, const char *path)
+{
+	NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (manager);
+	NMModem *modem = NULL;
+	char *data_device = NULL, *driver = NULL, *master_device = NULL;
+	uint modem_type = MM_MODEM_TYPE_UNKNOWN;
+	uint ip_method = MM_MODEM_IP_METHOD_PPP;
+
+	if (g_hash_table_lookup (priv->modems, path)) {
+		nm_log_warn (LOGD_MB, "modem with path %s already exists, ignoring", path);
+		return;
+	}
+
+	if (!get_modem_properties (nm_dbus_manager_get_connection (priv->dbus_mgr),
+	                           path, &master_device, &data_device, &driver,
+	                           &modem_type, &ip_method))
+		return;
+
+	if (modem_type == MM_MODEM_TYPE_UNKNOWN) {
+		nm_log_warn (LOGD_MB, "modem with path %s has unknown type, ignoring", path);
+		return;
+	}
+
+	if (!master_device || !strlen (master_device)) {
+		nm_log_warn (LOGD_MB, "modem with path %s has unknown device, ignoring", path);
+		return;
+	}
+
+	if (!driver || !strlen (driver)) {
+		nm_log_warn (LOGD_MB, "modem with path %s has unknown driver, ignoring", path);
+		return;
+	}
+
+	if (!data_device || !strlen (data_device)) {
+		nm_log_warn (LOGD_MB, "modem with path %s has unknown data device, ignoring", path);
+		return;
+	}
+
+	if (modem_type == MM_MODEM_TYPE_GSM)
+		modem = nm_modem_gsm_new (path, master_device, data_device, ip_method);
+	else if (modem_type == MM_MODEM_TYPE_CDMA)
+		modem = nm_modem_cdma_new (path, master_device, data_device, ip_method);
+	else
+		nm_log_warn (LOGD_MB, "unknown modem type '%d'", modem_type);
+
+	g_free (data_device);
+
+	if (modem) {
+		g_hash_table_insert (priv->modems, g_strdup (path), modem);
+		g_signal_emit (manager, signals[MODEM_ADDED], 0, modem, driver);
+	}
+
+	g_free (driver);
+}
+
+static void
+modem_added (DBusGProxy *proxy, const char *path, gpointer user_data)
+{
+	create_modem (NM_MODEM_MANAGER (user_data), path);
+}
+
+static void
+modem_removed (DBusGProxy *proxy, const char *path, gpointer user_data)
+{
+	NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (user_data);
+	NMModem *modem;
+
+	modem = (NMModem *) g_hash_table_lookup (priv->modems, path);
+	if (modem) {
+		g_signal_emit (user_data, signals[MODEM_REMOVED], 0, modem);
+		g_hash_table_remove (priv->modems, path);
+	}
+}
+
+static gboolean
+poke_modem_cb (gpointer user_data)
+{
+	NMModemManager *self = NM_MODEM_MANAGER (user_data);
+	NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (self);
+	DBusGConnection *g_connection;
+	DBusGProxy *proxy;
+
+	g_connection = nm_dbus_manager_get_connection (priv->dbus_mgr);
+	proxy = dbus_g_proxy_new_for_name (g_connection,
+									   MM_DBUS_SERVICE,
+									   MM_DBUS_PATH,
+									   MM_DBUS_INTERFACE);
+
+	dbus_g_proxy_call_no_reply (proxy, "EnumerateDevices", G_TYPE_INVALID);
+	g_object_unref (proxy);
+
+	return TRUE;
+}
+
+static void
+enumerate_devices_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer data)
+{
+	NMModemManager *manager = NM_MODEM_MANAGER (data);
+	GPtrArray *modems;
+	GError *error = NULL;
+
+	if (!dbus_g_proxy_end_call (proxy, call_id, &error,
+								dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH), &modems,
+								G_TYPE_INVALID)) {
+		nm_log_warn (LOGD_MB, "could not get modem list: %s", error->message);
+		g_error_free (error);
+	} else {
+		int i;
+
+		for (i = 0; i < modems->len; i++) {
+			char *path = (char *) g_ptr_array_index (modems, i);
+
+			create_modem (manager, path);
+			g_free (path);
+		}
+
+		g_ptr_array_free (modems, TRUE);
+	}
+}
+
+static void
+modem_manager_appeared (NMModemManager *self, gboolean enumerate_devices)
+{
+	NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (self);
+
+	if (priv->poke_id) {
+		g_source_remove (priv->poke_id);
+		priv->poke_id = 0;
+	}
+
+	nm_log_info (LOGD_MB, "modem-manager is now available");
+
+	priv->proxy = dbus_g_proxy_new_for_name (nm_dbus_manager_get_connection (priv->dbus_mgr),
+											 MM_DBUS_SERVICE, MM_DBUS_PATH, MM_DBUS_INTERFACE);
+
+	dbus_g_proxy_add_signal (priv->proxy, "DeviceAdded", DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
+	dbus_g_proxy_connect_signal (priv->proxy, "DeviceAdded",
+								 G_CALLBACK (modem_added), self,
+								 NULL);
+
+	dbus_g_proxy_add_signal (priv->proxy, "DeviceRemoved", DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
+	dbus_g_proxy_connect_signal (priv->proxy, "DeviceRemoved",
+								 G_CALLBACK (modem_removed), self,
+								 NULL);
+
+	if (enumerate_devices)
+		dbus_g_proxy_begin_call (priv->proxy, "EnumerateDevices", enumerate_devices_done, self, NULL, G_TYPE_INVALID);
+}
+
+static gboolean
+remove_one_modem (gpointer key, gpointer value, gpointer user_data)
+{
+	g_signal_emit (user_data, signals[MODEM_REMOVED], 0, value);
+
+	return TRUE;
+}
+
+static void
+modem_manager_disappeared (NMModemManager *self)
+{
+	NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (self);
+
+	g_hash_table_foreach_remove (priv->modems, remove_one_modem, self);
+
+	if (priv->proxy) {
+		g_object_unref (priv->proxy);
+		priv->proxy = NULL;
+	}
+
+	/* Try to activate the modem-manager */
+	nm_log_info (LOGD_MB, "trying to start the modem manager...");
+	poke_modem_cb (self);
+	priv->poke_id = g_timeout_add_seconds (MODEM_POKE_INTERVAL, poke_modem_cb, self);
+}
+
+static void
+nm_modem_manager_name_owner_changed (NMDBusManager *dbus_mgr,
+									 const char *name,
+									 const char *old_owner,
+									 const char *new_owner,
+									 gpointer user_data)
+{
+	gboolean old_owner_good;
+	gboolean new_owner_good;
+
+	/* Can't handle the signal if its not from the modem service */
+	if (strcmp (MM_DBUS_SERVICE, name) != 0)
+		return;
+
+	old_owner_good = (old_owner && strlen (old_owner));
+	new_owner_good = (new_owner && strlen (new_owner));
+
+	if (!old_owner_good && new_owner_good) {
+		modem_manager_appeared (NM_MODEM_MANAGER (user_data), FALSE);
+	} else if (old_owner_good && !new_owner_good) {
+		nm_log_info (LOGD_MB, "the modem manager disappeared");
+		modem_manager_disappeared (NM_MODEM_MANAGER (user_data));
+	}
+}
+
+/*******************************************************/
+
+static void
+nm_modem_manager_init (NMModemManager *self)
+{
+	NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (self);
+
+	priv->modems = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
+	priv->dbus_mgr = nm_dbus_manager_get ();
+
+	g_signal_connect (priv->dbus_mgr, "name-owner-changed",
+					  G_CALLBACK (nm_modem_manager_name_owner_changed),
+					  self);
+
+	if (nm_dbus_manager_name_has_owner (priv->dbus_mgr, MM_DBUS_SERVICE))
+		modem_manager_appeared (self, TRUE);
+	else
+		modem_manager_disappeared (self);
+}
+
+static void
+dispose (GObject *object)
+{
+	NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (object);
+
+	if (priv->disposed)
+		return;
+
+	priv->disposed = TRUE;
+
+	if (priv->poke_id) {
+		g_source_remove (priv->poke_id);
+		priv->poke_id = 0;
+	}
+
+	g_hash_table_foreach_remove (priv->modems, remove_one_modem, object);
+	g_hash_table_destroy (priv->modems);
+
+	if (priv->proxy) {
+		g_object_unref (priv->proxy);
+		priv->proxy = NULL;
+	}
+
+	if (priv->dbus_mgr) {
+		g_object_unref (priv->dbus_mgr);
+		priv->dbus_mgr = NULL;
+	}
+
+	/* Chain up to the parent class */
+	G_OBJECT_CLASS (nm_modem_manager_parent_class)->dispose (object);
+}
+
+static void
+nm_modem_manager_class_init (NMModemManagerClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+	g_type_class_add_private (object_class, sizeof (NMModemManagerPrivate));
+
+	object_class->dispose = dispose;
+
+	/* signals */
+	signals[MODEM_ADDED] =
+		g_signal_new ("modem-added",
+					  G_OBJECT_CLASS_TYPE (object_class),
+					  G_SIGNAL_RUN_FIRST,
+					  G_STRUCT_OFFSET (NMModemManagerClass, modem_added),
+					  NULL, NULL,
+					  _nm_marshal_VOID__OBJECT_STRING,
+					  G_TYPE_NONE, 2, G_TYPE_OBJECT, G_TYPE_STRING);
+
+	signals[MODEM_REMOVED] =
+		g_signal_new ("modem-removed",
+					  G_OBJECT_CLASS_TYPE (object_class),
+					  G_SIGNAL_RUN_FIRST,
+					  G_STRUCT_OFFSET (NMModemManagerClass, modem_removed),
+					  NULL, NULL,
+					  g_cclosure_marshal_VOID__OBJECT,
+					  G_TYPE_NONE, 1, G_TYPE_OBJECT);
+}
diff --git a/src/modem-manager/nm-modem-manager.h b/src/modem-manager/nm-modem-manager.h
new file mode 100644
index 00000000..56427baf
--- /dev/null
+++ b/src/modem-manager/nm-modem-manager.h
@@ -0,0 +1,53 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ * Copyright (C) 2009 Novell, Inc.
+ * Copyright (C) 2009 Canonical Ltd.
+ */
+
+#ifndef NM_MODEM_MANAGER_H
+#define NM_MODEM_MANAGER_H
+
+#include <glib-object.h>
+#include "nm-modem.h"
+
+#define NM_TYPE_MODEM_MANAGER				(nm_modem_manager_get_type ())
+#define NM_MODEM_MANAGER(obj)				(G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_MODEM_MANAGER, NMModemManager))
+#define NM_MODEM_MANAGER_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST ((klass),	NM_TYPE_MODEM_MANAGER, NMModemManagerClass))
+#define NM_IS_MODEM_MANAGER(obj)			(G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_MODEM_MANAGER))
+#define NM_IS_MODEM_MANAGER_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass),	NM_TYPE_MODEM_MANAGER))
+#define NM_MODEM_MANAGER_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj),	NM_TYPE_MODEM_MANAGER, NMModemManagerClass))
+
+typedef struct {
+	GObject parent;
+} NMModemManager;
+
+typedef struct {
+	GObjectClass parent;
+
+	/* Signals */
+	void (*modem_added) (NMModemManager *manager, NMModem *modem, const char *driver);
+
+	void (*modem_removed) (NMModemManager *manager, NMModem *modem);
+} NMModemManagerClass;
+
+GType nm_modem_manager_get_type (void);
+
+NMModemManager *nm_modem_manager_get (void);
+
+#endif /* NM_MODEM_MANAGER_H */
diff --git a/src/modem-manager/nm-modem-types.h b/src/modem-manager/nm-modem-types.h
new file mode 100644
index 00000000..e805cb21
--- /dev/null
+++ b/src/modem-manager/nm-modem-types.h
@@ -0,0 +1,111 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2009 Novell, Inc.
+ */
+
+#ifndef NM_MODEM_TYPES_H
+#define NM_MODEM_TYPES_H
+
+#define MM_DBUS_SERVICE              "org.freedesktop.ModemManager"
+#define MM_DBUS_PATH                 "/org/freedesktop/ModemManager"
+#define MM_DBUS_INTERFACE            "org.freedesktop.ModemManager"
+#define MM_DBUS_INTERFACE_MODEM      "org.freedesktop.ModemManager.Modem"
+#define MM_DBUS_INTERFACE_MODEM_SIMPLE "org.freedesktop.ModemManager.Modem.Simple"
+#define MM_DBUS_INTERFACE_MODEM_CDMA "org.freedesktop.ModemManager.Modem.Cdma"
+
+#define MM_DBUS_INTERFACE_MODEM_GSM_CARD    "org.freedesktop.ModemManager.Modem.Gsm.Card"
+#define MM_DBUS_INTERFACE_MODEM_GSM_NETWORK "org.freedesktop.ModemManager.Modem.Gsm.Network"
+
+#define MM_MODEM_TYPE_UNKNOWN  0
+#define MM_MODEM_TYPE_GSM      1
+#define MM_MODEM_TYPE_CDMA     2
+
+#define MM_MODEM_IP_METHOD_PPP    0
+#define MM_MODEM_IP_METHOD_STATIC 1
+#define MM_MODEM_IP_METHOD_DHCP   2
+
+/* Errors */
+
+#define MM_SERIAL_OPEN_FAILED MM_DBUS_INTERFACE_MODEM ".SerialOpenFailed"
+#define MM_SERIAL_SEND_FAILED MM_DBUS_INTERFACE_MODEM ".SerialSendFailed"
+#define MM_SERIAL_RESPONSE_TIMEOUT MM_DBUS_INTERFACE_MODEM ".SerialResponseTimeout"
+
+#define MM_MODEM_ERROR_GENERAL MM_DBUS_INTERFACE_MODEM ".General"
+#define MM_MODEM_ERROR_OPERATION_NOT_SUPPORTED MM_DBUS_INTERFACE_MODEM ".OperationNotSupported"
+
+#define MM_MODEM_CONNECT_ERROR_NO_CARRIER MM_DBUS_INTERFACE_MODEM ".NoCarrier"
+#define MM_MODEM_CONNECT_ERROR_NO_DIALTONE MM_DBUS_INTERFACE_MODEM ".NoDialtone"
+#define MM_MODEM_CONNECT_ERROR_BUSY MM_DBUS_INTERFACE_MODEM ".Busy"
+#define MM_MODEM_CONNECT_ERROR_NO_ANSWER MM_DBUS_INTERFACE_MODEM ".NoAnswer"
+
+#define MM_MODEM_ERROR "org.freedesktop.ModemManager.Modem.Gsm"
+
+#define MM_MODEM_ERROR_PHONE_FAILURE MM_MODEM_ERROR ".PhoneFailure"
+#define MM_MODEM_ERROR_NO_CONNECTION MM_MODEM_ERROR ".NoConnection"
+#define MM_MODEM_ERROR_LINK_RESERVED MM_MODEM_ERROR ".LinkReserved"
+#define MM_MODEM_ERROR_NOT_ALLOWED MM_MODEM_ERROR ".OperationNotAllowed"
+#define MM_MODEM_ERROR_NOT_SUPPORTED MM_MODEM_ERROR ".OperationNotSupported"
+#define MM_MODEM_ERROR_PH_SIM_PIN MM_MODEM_ERROR ".PhSimPinRequired"
+#define MM_MODEM_ERROR_PH_FSIM_PIN MM_MODEM_ERROR ".PhFSimPinRequired"
+#define MM_MODEM_ERROR_PH_FSIM_PUK MM_MODEM_ERROR ".PhFPukRequired"
+#define MM_MODEM_ERROR_SIM_NOT_INSERTED MM_MODEM_ERROR ".SimNotInserted"
+#define MM_MODEM_ERROR_SIM_PIN MM_MODEM_ERROR ".SimPinRequired"
+#define MM_MODEM_ERROR_SIM_PUK MM_MODEM_ERROR ".SimPukRequired"
+#define MM_MODEM_ERROR_SIM_FAILURE MM_MODEM_ERROR ".SimFailure"
+#define MM_MODEM_ERROR_SIM_BUSY MM_MODEM_ERROR ".SimBusy"
+#define MM_MODEM_ERROR_SIM_WRONG MM_MODEM_ERROR ".SimWrong"
+#define MM_MODEM_ERROR_WRONG_PASSWORD MM_MODEM_ERROR ".IncorrectPassword"
+#define MM_MODEM_ERROR_SIM_PIN2 MM_MODEM_ERROR ".SimPin2Required"
+#define MM_MODEM_ERROR_SIM_PUK2 MM_MODEM_ERROR ".SimPuk2Required"
+#define MM_MODEM_ERROR_MEMORY_FULL MM_MODEM_ERROR ".MemoryFull"
+#define MM_MODEM_ERROR_INVALID_INDEX MM_MODEM_ERROR ".InvalidIndex"
+#define MM_MODEM_ERROR_NOT_FOUND MM_MODEM_ERROR ".NotFound"
+#define MM_MODEM_ERROR_MEMORY_FAILURE MM_MODEM_ERROR ".MemoryFailure"
+#define MM_MODEM_ERROR_TEXT_TOO_LONG MM_MODEM_ERROR ".TextTooLong"
+#define MM_MODEM_ERROR_INVALID_CHARS MM_MODEM_ERROR ".InvalidChars"
+#define MM_MODEM_ERROR_DIAL_STRING_TOO_LONG MM_MODEM_ERROR ".DialStringTooLong"
+#define MM_MODEM_ERROR_DIAL_STRING_INVALID MM_MODEM_ERROR ".InvalidDialString"
+#define MM_MODEM_ERROR_NO_NETWORK MM_MODEM_ERROR ".NoNetwork"
+#define MM_MODEM_ERROR_NETWORK_TIMEOUT MM_MODEM_ERROR ".NetworkTimeout"
+#define MM_MODEM_ERROR_NETWORK_NOT_ALLOWED MM_MODEM_ERROR ".NetworkNotAllowed"
+#define MM_MODEM_ERROR_NETWORK_PIN MM_MODEM_ERROR ".NetworkPinRequired"
+#define MM_MODEM_ERROR_NETWORK_PUK MM_MODEM_ERROR ".NetworkPukRequired"
+#define MM_MODEM_ERROR_NETWORK_SUBSET_PIN MM_MODEM_ERROR ".NetworkSubsetPinRequired"
+#define MM_MODEM_ERROR_NETWORK_SUBSET_PUK MM_MODEM_ERROR ".NetworkSubsetPukRequired"
+#define MM_MODEM_ERROR_SERVICE_PIN MM_MODEM_ERROR ".ServicePinRequired"
+#define MM_MODEM_ERROR_SERVICE_PUK MM_MODEM_ERROR ".ServicePukRequired"
+#define MM_MODEM_ERROR_CORP_PIN MM_MODEM_ERROR ".CorporatePinRequired"
+#define MM_MODEM_ERROR_CORP_PUK MM_MODEM_ERROR ".CorporatePukRequired"
+#define MM_MODEM_ERROR_HIDDEN_KEY MM_MODEM_ERROR ".HiddenKeyRequired"
+#define MM_MODEM_ERROR_EAP_NOT_SUPPORTED MM_MODEM_ERROR ".EapMethodNotSupported"
+#define MM_MODEM_ERROR_INCORRECT_PARAMS MM_MODEM_ERROR ".IncorrectParams"
+#define MM_MODEM_ERROR_UNKNOWN MM_MODEM_ERROR ".Unknown"
+#define MM_MODEM_ERROR_GPRS_ILLEGAL_MS MM_MODEM_ERROR ".GprsIllegalMs"
+#define MM_MODEM_ERROR_GPRS_ILLEGAL_ME MM_MODEM_ERROR ".GprsIllegalMe"
+#define MM_MODEM_ERROR_GPRS_SERVICE_NOT_ALLOWED  MM_MODEM_ERROR ".GprsServiceNotAllowed"
+#define MM_MODEM_ERROR_GPRS_PLMN_NOT_ALLOWED MM_MODEM_ERROR ".GprsPlmnNotAllowed"
+#define MM_MODEM_ERROR_GPRS_LOCATION_NOT_ALLOWED MM_MODEM_ERROR ".GprsLocationNotAllowed"
+#define MM_MODEM_ERROR_GPRS_ROAMING_NOT_ALLOWED MM_MODEM_ERROR ".GprsRoamingNotAllowed"
+#define MM_MODEM_ERROR_GPRS_OPTION_NOT_SUPPORTED MM_MODEM_ERROR ".GprsOptionNotSupported"
+#define MM_MODEM_ERROR_GPRS_NOT_SUBSCRIBED MM_MODEM_ERROR ".GprsNotSubscribed"
+#define MM_MODEM_ERROR_GPRS_OUT_OF_ORDER MM_MODEM_ERROR ".GprsOutOfOrder"
+#define MM_MODEM_ERROR_GPRS_PDP_AUTH_FAILURE MM_MODEM_ERROR ".GprsPdpAuthFailure"
+#define MM_MODEM_ERROR_GPRS_UNKNOWN MM_MODEM_ERROR ".GprsUnspecified"
+#define MM_MODEM_ERROR_GPRS_INVALID_CLASS MM_MODEM_ERROR ".GprsInvalidClass"
+
+#endif /* NM_MODEM_TYPES_H */
diff --git a/src/modem-manager/nm-modem.c b/src/modem-manager/nm-modem.c
new file mode 100644
index 00000000..e07b818b
--- /dev/null
+++ b/src/modem-manager/nm-modem.c
@@ -0,0 +1,1147 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2009 - 2010 Red Hat, Inc.
+ * Copyright (C) 2009 Novell, Inc.
+ */
+
+#include <string.h>
+#include "nm-modem.h"
+#include "nm-system.h"
+#include "nm-dbus-manager.h"
+#include "nm-setting-connection.h"
+#include "nm-marshal.h"
+#include "nm-properties-changed-signal.h"
+#include "nm-modem-types.h"
+#include "nm-logging.h"
+#include "NetworkManagerUtils.h"
+#include "nm-device-private.h"
+#include "nm-device-interface.h"
+#include "nm-dbus-glib-types.h"
+
+#include "nm-serial-device-glue.h"
+
+G_DEFINE_TYPE (NMModem, nm_modem, G_TYPE_OBJECT)
+
+#define NM_MODEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_MODEM, NMModemPrivate))
+
+enum {
+	PROP_0,
+	PROP_DEVICE,
+	PROP_IFACE,
+	PROP_PATH,
+	PROP_IP_METHOD,
+	PROP_ENABLED,
+
+	LAST_PROP
+};
+
+typedef struct {
+	NMDBusManager *dbus_mgr;
+	DBusGProxy *proxy;
+	DBusGProxy *props_proxy;
+
+	char *path;
+	NMPPPManager *ppp_manager;
+	NMIP4Config	 *pending_ip4_config;
+	guint32 ip_method;
+	char *device;
+	char *iface;
+
+	guint32 secrets_tries;
+
+	DBusGProxyCall *call;
+
+	gboolean mm_enabled;
+
+	/* PPP stats */
+	guint32 in_bytes;
+	guint32 out_bytes;
+} NMModemPrivate;
+
+enum {
+	PPP_STATS,
+	PPP_FAILED,
+	PREPARE_RESULT,
+	IP4_CONFIG_RESULT,
+	NEED_AUTH,
+
+	LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+NMPPPManager *
+nm_modem_get_ppp_manager (NMModem *self)
+{
+	g_return_val_if_fail (NM_IS_MODEM (self), NULL);
+
+	return NM_MODEM_GET_PRIVATE (self)->ppp_manager;
+}
+
+gboolean
+nm_modem_get_mm_enabled (NMModem *self)
+{
+	g_return_val_if_fail (NM_IS_MODEM (self), TRUE);
+
+	return NM_MODEM_GET_PRIVATE (self)->mm_enabled;
+}
+
+DBusGProxy *
+nm_modem_get_proxy (NMModem *self,
+					const char *interface)
+{
+
+	NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
+	const char *current_iface;
+
+	g_return_val_if_fail (NM_IS_MODEM (self), NULL);
+
+	/* Default to the default interface. */
+	if (interface == NULL)
+		interface = MM_DBUS_INTERFACE_MODEM;
+
+	if (interface && !strcmp (interface, DBUS_INTERFACE_PROPERTIES))
+		return priv->props_proxy;
+
+	current_iface = dbus_g_proxy_get_interface (priv->proxy);
+	if (!current_iface || strcmp (current_iface, interface))
+		dbus_g_proxy_set_interface (priv->proxy, interface);
+
+	return priv->proxy;
+}
+
+static void
+merge_ip4_config (NMActRequest *req, NMIP4Config *config)
+{
+	NMConnection *connection;
+	NMSettingIP4Config *s_ip4;
+
+	/* Merge user-defined overrides into the IP4Config to be applied */
+	connection = nm_act_request_get_connection (req);
+	g_assert (connection);
+
+	s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
+	if (s_ip4)
+		nm_utils_merge_ip4_config (config, s_ip4);
+}
+
+/*****************************************************************************/
+/* IP method PPP */
+
+static void
+ppp_state_changed (NMPPPManager *ppp_manager, NMPPPStatus status, gpointer user_data)
+{
+	switch (status) {
+	case NM_PPP_STATUS_DISCONNECT:
+		g_signal_emit (NM_MODEM (user_data), signals[PPP_FAILED], 0, NM_DEVICE_STATE_REASON_PPP_DISCONNECT);
+		break;
+	case NM_PPP_STATUS_DEAD:
+		g_signal_emit (NM_MODEM (user_data), signals[PPP_FAILED], 0, NM_DEVICE_STATE_REASON_PPP_FAILED);
+		break;
+	default:
+		break;
+	}
+}
+
+static void
+ppp_ip4_config (NMPPPManager *ppp_manager,
+				const char *iface,
+				NMIP4Config *config,
+				gpointer user_data)
+{
+	NMModem *self = NM_MODEM (user_data);
+	NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
+	guint32 i, num;
+	guint32 bad_dns1 = htonl (0x0A0B0C0D);
+	guint32 good_dns1 = htonl (0x04020201);  /* GTE nameserver */
+	guint32 bad_dns2 = htonl (0x0A0B0C0E);
+	guint32 good_dns2 = htonl (0x04020202);  /* GTE nameserver */
+	gboolean dns_workaround = FALSE;
+
+	/* Work around a PPP bug (#1732) which causes many mobile broadband
+	 * providers to return 10.11.12.13 and 10.11.12.14 for the DNS servers.
+	 * Apparently fixed in ppp-2.4.5 but we've had some reports that this is
+	 * not the case.
+	 *
+	 * http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=2e09ef6886bbf00bc5a9a641110f801e372ffde6
+	 * http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=f8191bf07df374f119a07910a79217c7618f113e
+	 */
+
+	num = nm_ip4_config_get_num_nameservers (config);
+	if (num == 2) {
+		gboolean found1 = FALSE, found2 = FALSE;
+
+		for (i = 0; i < num; i++) {
+			guint32 ns = nm_ip4_config_get_nameserver (config, i);
+
+			if (ns == bad_dns1)
+				found1 = TRUE;
+			else if (ns == bad_dns2)
+				found2 = TRUE;
+		}
+
+		/* Be somewhat conservative about substitutions; the "bad" nameservers
+		 * could actually be valid in some cases, so only substitute if ppp
+		 * returns *only* the two bad nameservers.
+		 */
+		dns_workaround = (found1 && found2);
+	}
+
+	if (!num || dns_workaround) {
+		nm_log_warn (LOGD_PPP, "compensating for invalid PPP-provided nameservers");
+		nm_ip4_config_reset_nameservers (config);
+		nm_ip4_config_add_nameserver (config, good_dns1);
+		nm_ip4_config_add_nameserver (config, good_dns2);
+	}
+
+	priv->pending_ip4_config = g_object_ref (config);
+	g_signal_emit (self, signals[IP4_CONFIG_RESULT], 0, iface, config, NULL);
+}
+
+static void
+ppp_stats (NMPPPManager *ppp_manager,
+		   guint32 in_bytes,
+		   guint32 out_bytes,
+		   gpointer user_data)
+{
+	NMModem *self = NM_MODEM (user_data);
+	NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
+
+	if (priv->in_bytes != in_bytes || priv->out_bytes != out_bytes) {
+		priv->in_bytes = in_bytes;
+		priv->out_bytes = out_bytes;
+
+		g_signal_emit (self, signals[PPP_STATS], 0, in_bytes, out_bytes);
+	}
+}
+
+static NMActStageReturn
+ppp_stage3_ip4_config_start (NMModem *self,
+                             NMActRequest *req,
+                             NMDeviceStateReason *reason)
+{
+	NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
+	const char *ppp_name = NULL;
+	GError *error = NULL;
+	NMActStageReturn ret;
+
+	g_return_val_if_fail (self != NULL, NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (NM_IS_MODEM (self), NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (req != NULL, NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (NM_IS_ACT_REQUEST (req), NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (reason !=	NULL, NM_ACT_STAGE_RETURN_FAILURE);
+
+	if (NM_MODEM_GET_CLASS (self)->get_user_pass) {
+		NMConnection *connection = nm_act_request_get_connection (req);
+
+		g_assert (connection);
+		if (!NM_MODEM_GET_CLASS (self)->get_user_pass (self, connection, &ppp_name, NULL))
+			return NM_ACT_STAGE_RETURN_FAILURE;
+	}
+
+	priv->ppp_manager = nm_ppp_manager_new (priv->iface);
+	if (nm_ppp_manager_start (priv->ppp_manager, req, ppp_name, 20, &error)) {
+		g_signal_connect (priv->ppp_manager, "state-changed",
+						  G_CALLBACK (ppp_state_changed),
+						  self);
+		g_signal_connect (priv->ppp_manager, "ip4-config",
+						  G_CALLBACK (ppp_ip4_config),
+						  self);
+		g_signal_connect (priv->ppp_manager, "stats",
+						  G_CALLBACK (ppp_stats),
+						  self);
+
+		ret = NM_ACT_STAGE_RETURN_POSTPONE;
+	} else {
+		nm_log_err (LOGD_PPP, "error starting PPP: (%d) %s",
+		            error ? error->code : -1,
+		            error && error->message ? error->message : "(unknown)");
+		g_error_free (error);
+
+		g_object_unref (priv->ppp_manager);
+		priv->ppp_manager = NULL;
+
+		*reason = NM_DEVICE_STATE_REASON_PPP_START_FAILED;
+		ret = NM_ACT_STAGE_RETURN_FAILURE;
+	}
+
+	return ret;
+}
+
+static NMActStageReturn
+ppp_stage4 (NMModem *self,
+            NMActRequest *req,
+            NMIP4Config **config,
+            NMDeviceStateReason *reason)
+{
+	NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
+
+	*config = priv->pending_ip4_config;
+	priv->pending_ip4_config = NULL;
+
+	merge_ip4_config (req, *config);
+
+	return NM_ACT_STAGE_RETURN_SUCCESS;
+}
+
+/*****************************************************************************/
+/* IP method static */
+
+static void
+static_stage3_done (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
+{
+	NMModem *self = NM_MODEM (user_data);
+	NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
+	GValueArray *ret_array = NULL;
+	GError *error = NULL;
+	NMIP4Config *config = NULL;
+
+	priv->call = NULL;
+
+	if (dbus_g_proxy_end_call (proxy, call, &error,
+							   G_TYPE_VALUE_ARRAY, &ret_array,
+							   G_TYPE_INVALID)) {
+		NMIP4Address *addr;
+		int i;
+
+		config = nm_ip4_config_new ();
+
+		addr = nm_ip4_address_new ();
+		nm_ip4_address_set_address (addr, g_value_get_uint (g_value_array_get_nth (ret_array, 0)));
+		nm_ip4_address_set_prefix (addr, 32);
+		nm_ip4_config_take_address (config, addr);
+
+		for (i = 0; i < ret_array->n_values; i++) {
+			GValue *value = g_value_array_get_nth (ret_array, i);
+
+			nm_ip4_config_add_nameserver (config, g_value_get_uint (value));
+		}
+		g_value_array_free (ret_array);
+
+		priv->pending_ip4_config = g_object_ref (config);
+		g_signal_emit (self, signals[IP4_CONFIG_RESULT], 0, NULL, config, NULL);
+	}
+
+	g_signal_emit (self, signals[IP4_CONFIG_RESULT], 0, NULL, config, error);
+	g_clear_error (&error);
+}
+
+static NMActStageReturn
+static_stage3_ip4_config_start (NMModem *self,
+                                NMActRequest *req,
+                                NMDeviceStateReason *reason)
+{
+	NMModemPrivate *priv;
+
+	g_return_val_if_fail (self != NULL, NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (NM_IS_MODEM (self), NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (req != NULL, NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (NM_IS_ACT_REQUEST (req), NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (reason !=	NULL, NM_ACT_STAGE_RETURN_FAILURE);
+
+	priv = NM_MODEM_GET_PRIVATE (self);
+
+	priv->call = dbus_g_proxy_begin_call (nm_modem_get_proxy (self, MM_DBUS_INTERFACE_MODEM),
+	                                      "GetIP4Config", static_stage3_done,
+	                                      self, NULL,
+	                                      G_TYPE_INVALID);
+
+	return NM_ACT_STAGE_RETURN_POSTPONE;
+}
+
+static NMActStageReturn
+static_stage4 (NMModem *self,
+               NMActRequest *req,
+               NMDevice *device,
+               NMIP4Config **config,
+               NMDeviceStateReason *reason)
+{
+	NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
+	gboolean no_firmware = FALSE;
+
+	if (!nm_device_hw_bring_up (device, TRUE, &no_firmware)) {
+		if (no_firmware)
+			*reason = NM_DEVICE_STATE_REASON_FIRMWARE_MISSING;
+		else
+			*reason = NM_DEVICE_STATE_REASON_CONFIG_FAILED;
+		return NM_ACT_STAGE_RETURN_FAILURE;
+	}
+
+	*config = priv->pending_ip4_config;
+	priv->pending_ip4_config = NULL;
+
+	merge_ip4_config (req, *config);
+
+	return NM_ACT_STAGE_RETURN_SUCCESS;
+}
+
+/*****************************************************************************/
+
+NMActStageReturn
+nm_modem_stage3_ip4_config_start (NMModem *self,
+                                  NMDevice *device,
+                                  NMDeviceClass *device_class,
+                                  NMDeviceStateReason *reason)
+{
+	NMModemPrivate *priv;
+	NMActRequest *req;
+	NMActStageReturn ret;
+
+	g_return_val_if_fail (self != NULL, NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (NM_IS_MODEM (self), NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (device != NULL, NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (NM_IS_DEVICE (device), NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (device_class != NULL, NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (NM_IS_DEVICE_CLASS (device_class), NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
+
+	req = nm_device_get_act_request (device);
+	g_assert (req);
+
+	priv = NM_MODEM_GET_PRIVATE (self);
+	switch (priv->ip_method) {
+	case MM_MODEM_IP_METHOD_PPP:
+		ret = ppp_stage3_ip4_config_start (self, req, reason);
+		break;
+	case MM_MODEM_IP_METHOD_STATIC:
+		ret = static_stage3_ip4_config_start (self, req, reason);
+		break;
+	case MM_MODEM_IP_METHOD_DHCP:
+		ret = device_class->act_stage3_ip4_config_start (device, reason);
+		break;
+	default:
+		nm_log_err (LOGD_MB, "unknown IP method %d", priv->ip_method);
+		ret = NM_ACT_STAGE_RETURN_FAILURE;
+		break;
+	}
+
+	return ret;
+}
+
+NMActStageReturn
+nm_modem_stage4_get_ip4_config (NMModem *self,
+                                NMDevice *device,
+                                NMDeviceClass *device_class,
+								NMIP4Config **config,
+								NMDeviceStateReason *reason)
+{
+	NMModemPrivate *priv;
+	NMActRequest *req;
+	NMActStageReturn ret;
+
+	g_return_val_if_fail (self != NULL, NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (NM_IS_MODEM (self), NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (device != NULL, NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (NM_IS_DEVICE (device), NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (device_class != NULL, NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (NM_IS_DEVICE_CLASS (device_class), NM_ACT_STAGE_RETURN_FAILURE);
+	g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
+
+	req = nm_device_get_act_request (device);
+	g_assert (req);
+
+	priv = NM_MODEM_GET_PRIVATE (self);
+	switch (priv->ip_method) {
+	case MM_MODEM_IP_METHOD_PPP:
+		ret = ppp_stage4 (self, req, config, reason);
+		break;
+	case MM_MODEM_IP_METHOD_STATIC:
+		ret = static_stage4 (self, req, device, config, reason);
+		break;
+	case MM_MODEM_IP_METHOD_DHCP:
+		ret = device_class->act_stage4_get_ip4_config (device, config, reason);
+		break;
+	default:
+		nm_log_err (LOGD_MB, "unknown IP method %d", priv->ip_method);
+		ret = NM_ACT_STAGE_RETURN_FAILURE;
+		break;
+	}
+
+	return ret;
+}
+
+gboolean
+nm_modem_connection_secrets_updated (NMModem *self,
+                                     NMActRequest *req,
+                                     NMConnection *connection,
+                                     GSList *updated_settings,
+                                     RequestSecretsCaller caller)
+{
+	NMModemPrivate *priv;
+	gboolean found = FALSE;
+	const char *setting_name;
+	GSList *iter;
+
+	g_return_val_if_fail (self != NULL, FALSE);
+	g_return_val_if_fail (NM_IS_MODEM (self), FALSE);
+	g_return_val_if_fail (req != NULL, FALSE);
+	g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE);
+	g_return_val_if_fail (connection != NULL, FALSE);
+	g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE);
+
+	priv = NM_MODEM_GET_PRIVATE (self);
+
+	if (caller == SECRETS_CALLER_PPP) {
+		const char *user = NULL;
+		const char *pass = NULL;
+
+		g_return_val_if_fail (priv->ppp_manager != NULL, FALSE);
+
+		if (!NM_MODEM_GET_CLASS (self)->get_user_pass (self, connection, &user, &pass)) {
+			/* Shouldn't ever happen */
+			nm_ppp_manager_update_secrets (priv->ppp_manager,
+										   priv->iface,
+										   NULL,
+										   NULL,
+										   "missing GSM/CDMA setting; no secrets could be found.");
+		} else {
+			nm_ppp_manager_update_secrets (priv->ppp_manager,
+										   priv->iface,
+										   user ? user : "",
+										   pass ? pass : "",
+										   NULL);
+		}
+		return TRUE;
+	}
+
+	g_return_val_if_fail (caller == SECRETS_CALLER_MOBILE_BROADBAND, FALSE);
+
+	g_assert (NM_MODEM_GET_CLASS (self)->get_setting_name);
+	setting_name = NM_MODEM_GET_CLASS (self)->get_setting_name (self);
+
+	for (iter = updated_settings; iter; iter = g_slist_next (iter)) {
+		const char *candidate_setting_name = (const char *) iter->data;
+
+		if (!strcmp (candidate_setting_name, setting_name))
+			found = TRUE;
+		else {
+			nm_log_warn (LOGD_MB, "ignoring updated secrets for setting '%s'.",
+			            candidate_setting_name);
+		}
+	}
+
+	return found;
+}
+
+static NMActStageReturn
+real_act_stage1_prepare (NMModem *modem,
+                         NMActRequest *req,
+                         GPtrArray **out_hints,
+                         const char **out_setting_name,
+                         NMDeviceStateReason *reason)
+{
+	*reason = NM_DEVICE_STATE_REASON_UNKNOWN;
+	return NM_ACT_STAGE_RETURN_FAILURE;
+}
+
+NMActStageReturn
+nm_modem_act_stage1_prepare (NMModem *self,
+                             NMActRequest *req,
+                             NMDeviceStateReason *reason)
+{
+	NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
+	NMActStageReturn ret;
+	GPtrArray *hints = NULL;
+	const char *setting_name = NULL;
+
+	ret = NM_MODEM_GET_CLASS (self)->act_stage1_prepare (self,
+	                                                     req,
+	                                                     &hints,
+	                                                     &setting_name,
+	                                                     reason);
+	if ((ret == NM_ACT_STAGE_RETURN_POSTPONE) && setting_name) {
+		const char *hint1 = NULL, *hint2 = NULL;
+
+		/* Need some secrets */
+		if (hints) {
+			if (hints->len > 0)
+				hint1 = g_ptr_array_index (hints, 0);
+			if (hints->len > 1)
+				hint2 = g_ptr_array_index (hints, 1);
+		}
+
+		g_signal_emit (self, signals[NEED_AUTH], 0,
+		               setting_name, 
+	                   priv->secrets_tries++ ? TRUE : FALSE,
+	                   SECRETS_CALLER_MOBILE_BROADBAND,
+	                   hint1,
+	                   hint2);
+
+		if (hints)
+			g_ptr_array_free (hints, TRUE);
+	}
+	
+	return ret;
+}
+
+NMActStageReturn
+nm_modem_act_stage2_config (NMModem *self,
+                            NMActRequest *req,
+                            NMDeviceStateReason *reason)
+{
+	NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
+
+	/* Clear secrets tries counter since secrets were successfully used
+	 * already if we get here.
+	 */
+	priv->secrets_tries = 0;
+
+	return NM_ACT_STAGE_RETURN_SUCCESS;
+}
+
+NMConnection *
+nm_modem_get_best_auto_connection (NMModem *self,
+                                   GSList *connections,
+                                   char **specific_object)
+{
+	if (NM_MODEM_GET_CLASS (self)->get_best_auto_connection)
+		return NM_MODEM_GET_CLASS (self)->get_best_auto_connection (self, connections, specific_object);
+	return NULL;
+}
+
+gboolean
+nm_modem_check_connection_compatible (NMModem *self,
+                                      NMConnection *connection,
+                                      GError **error)
+{
+	if (NM_MODEM_GET_CLASS (self)->check_connection_compatible)
+		return NM_MODEM_GET_CLASS (self)->check_connection_compatible (self, connection, error);
+	return FALSE;
+}
+
+static void
+real_deactivate_quickly (NMModem *self, NMDevice *device)
+{
+	NMModemPrivate *priv;
+	const char *iface;
+
+	g_return_if_fail (self != NULL);
+	g_return_if_fail (NM_IS_MODEM (self));
+	g_return_if_fail (device != NULL);
+	g_return_if_fail (NM_IS_DEVICE (device));
+
+	priv = NM_MODEM_GET_PRIVATE (self);
+
+	priv->secrets_tries = 0;
+
+	if (priv->call) {
+		dbus_g_proxy_cancel_call (priv->proxy, priv->call);
+		priv->call = NULL;
+	}
+
+	if (priv->pending_ip4_config) {
+		g_object_unref (priv->pending_ip4_config);
+		priv->pending_ip4_config = NULL;
+	}
+
+	priv->in_bytes = priv->out_bytes = 0;
+
+	switch (priv->ip_method) {
+	case MM_MODEM_IP_METHOD_PPP:
+		if (priv->ppp_manager) {
+			g_object_unref (priv->ppp_manager);
+			priv->ppp_manager = NULL;
+		}
+		break;
+	case MM_MODEM_IP_METHOD_STATIC:
+	case MM_MODEM_IP_METHOD_DHCP:
+		iface = nm_device_get_ip_iface (device);
+		/* FIXME: use AF_UNSPEC here when we have IPv6 support */
+		nm_system_device_flush_routes_with_iface (iface, AF_INET);
+		nm_system_device_flush_addresses_with_iface (iface);
+		nm_system_device_set_up_down_with_iface (iface, FALSE, NULL);
+		break;
+	default:
+		nm_log_err (LOGD_MB, "unknown IP method %d", priv->ip_method);
+		break;
+	}
+}
+
+void
+nm_modem_deactivate_quickly (NMModem *self, NMDevice *device)
+{
+	NM_MODEM_GET_CLASS (self)->deactivate_quickly (self, device);
+}
+
+static void
+disconnect_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
+{
+	GError *error = NULL;
+
+	if (!dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_INVALID)) {
+		nm_log_info (LOGD_MB, "disconnect failed: (%d) %s",
+		             error ? error->code : -1,
+		             error && error->message ? error->message : "(unknown)");
+	}
+}
+
+void
+nm_modem_device_state_changed (NMModem *self,
+                               NMDeviceState new_state,
+                               NMDeviceState old_state,
+                               NMDeviceStateReason reason)
+{
+	gboolean was_connected = FALSE;
+
+	g_return_if_fail (self != NULL);
+	g_return_if_fail (NM_IS_MODEM (self));
+
+	if (IS_ACTIVATING_STATE (old_state) || (old_state == NM_DEVICE_STATE_ACTIVATED))
+		was_connected = TRUE;
+
+	/* Make sure we don't leave the serial device open */
+	switch (new_state) {
+	case NM_DEVICE_STATE_NEED_AUTH:
+		if (NM_MODEM_GET_PRIVATE (self)->ppp_manager)
+			break;
+		/* else fall through */
+	case NM_DEVICE_STATE_UNMANAGED:
+	case NM_DEVICE_STATE_UNAVAILABLE:
+	case NM_DEVICE_STATE_FAILED:
+	case NM_DEVICE_STATE_DISCONNECTED:
+		if (was_connected) {
+			dbus_g_proxy_begin_call (nm_modem_get_proxy (self, MM_DBUS_INTERFACE_MODEM),
+			                         "Disconnect",
+			                         disconnect_done,
+			                         self,
+			                         NULL,
+			                         G_TYPE_INVALID);
+		}
+		break;
+	default:
+		break;
+	}
+}
+
+gboolean
+nm_modem_hw_is_up (NMModem *self, NMDevice *device)
+{
+	guint32 ip_method = NM_MODEM_GET_PRIVATE (self)->ip_method;
+
+	if (ip_method == MM_MODEM_IP_METHOD_STATIC || ip_method == MM_MODEM_IP_METHOD_DHCP) {
+		NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
+		NMDeviceState state;
+
+		state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (device));
+		if (priv->pending_ip4_config || state == NM_DEVICE_STATE_IP_CONFIG || state == NM_DEVICE_STATE_ACTIVATED)
+			return nm_system_device_is_up (device);
+	}
+
+	return TRUE;
+}
+
+gboolean
+nm_modem_hw_bring_up (NMModem *self, NMDevice *device, gboolean *no_firmware)
+{
+	guint32 ip_method = NM_MODEM_GET_PRIVATE (self)->ip_method;
+
+	if (ip_method == MM_MODEM_IP_METHOD_STATIC || ip_method == MM_MODEM_IP_METHOD_DHCP) {
+		NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
+		NMDeviceState state;
+
+		state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (device));
+		if (priv->pending_ip4_config || state == NM_DEVICE_STATE_IP_CONFIG || state == NM_DEVICE_STATE_ACTIVATED)
+			return nm_system_device_set_up_down (device, TRUE, no_firmware);
+	}
+
+	return TRUE;
+}
+
+const char *
+nm_modem_get_iface (NMModem *self)
+{
+	g_return_val_if_fail (self != NULL, NULL);
+	g_return_val_if_fail (NM_IS_MODEM (self), NULL);
+
+	return NM_MODEM_GET_PRIVATE (self)->iface;
+}
+
+const char *
+nm_modem_get_path (NMModem *self)
+{
+	g_return_val_if_fail (self != NULL, NULL);
+	g_return_val_if_fail (NM_IS_MODEM (self), NULL);
+
+	return NM_MODEM_GET_PRIVATE (self)->path;
+}
+
+static void
+get_mm_enabled_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
+{
+	NMModem *self = NM_MODEM (user_data);
+	GError *error = NULL;
+	GValue value = { 0, };
+
+	if (!dbus_g_proxy_end_call (proxy, call_id, &error,
+	                            G_TYPE_VALUE, &value,
+	                            G_TYPE_INVALID)) {
+		nm_log_warn (LOGD_MB, "failed get modem enabled state: (%d) %s",
+		             error ? error->code : -1,
+		             error && error->message ? error->message : "(unknown)");
+		return;
+	}
+
+	if (G_VALUE_HOLDS_BOOLEAN (&value)) {
+		NM_MODEM_GET_PRIVATE (self)->mm_enabled = g_value_get_boolean (&value);
+		g_object_notify (G_OBJECT (self), NM_MODEM_ENABLED);
+	} else
+		nm_log_warn (LOGD_MB, "failed get modem enabled state: unexpected reply type");
+
+	g_value_unset (&value);
+}
+
+static void
+query_mm_enabled (NMModem *self)
+{
+	dbus_g_proxy_begin_call (NM_MODEM_GET_PRIVATE (self)->props_proxy,
+	                         "Get", get_mm_enabled_done,
+	                         self, NULL,
+	                         G_TYPE_STRING, MM_DBUS_INTERFACE_MODEM,
+	                         G_TYPE_STRING, "Enabled",
+	                         G_TYPE_INVALID);
+}
+
+static void
+set_mm_enabled_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
+{
+	GError *error = NULL;
+
+	if (!dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_INVALID)) {
+		nm_log_warn (LOGD_MB, "failed to enable/disable modem: (%d) %s",
+		             error ? error->code : -1,
+		             error && error->message ? error->message : "(unknown)");
+	}
+
+	/* Update enabled/disabled state again */
+	query_mm_enabled (NM_MODEM (user_data));
+}
+
+void
+nm_modem_set_mm_enabled (NMModem *self, gboolean enabled)
+{
+	NMModemPrivate *priv;
+
+	g_return_if_fail (self != NULL);
+	g_return_if_fail (NM_IS_MODEM (self));
+
+	priv = NM_MODEM_GET_PRIVATE (self);
+
+	/* FIXME: For now this just toggles the ModemManager enabled state.  In the
+	 * future we want to tie this into rfkill state instead so that the user can
+	 * toggle rfkill status of the WWAN modem.
+	 */
+
+	if (priv->mm_enabled != enabled) {
+		DBusGProxy *proxy;
+
+		proxy = nm_modem_get_proxy (self, MM_DBUS_INTERFACE_MODEM);
+		dbus_g_proxy_begin_call (proxy,
+		                         "Enable", set_mm_enabled_done,
+		                         self, NULL,
+		                         G_TYPE_BOOLEAN, enabled,
+		                         G_TYPE_INVALID);
+	}
+}
+
+static void
+modem_properties_changed (DBusGProxy *proxy,
+                          const char *interface,
+                          GHashTable *props,
+                          gpointer user_data)
+{
+	NMModem *self = NM_MODEM (user_data);
+	NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
+	GValue *value;
+
+	if (strcmp (interface, MM_DBUS_INTERFACE_MODEM))
+		return;
+
+	value = g_hash_table_lookup (props, "Enabled");
+	if (value && G_VALUE_HOLDS_BOOLEAN (value)) {
+		priv->mm_enabled = g_value_get_boolean (value);
+		g_object_notify (G_OBJECT (self), NM_MODEM_ENABLED);
+	}
+}
+
+/*****************************************************************************/
+
+static void
+nm_modem_init (NMModem *self)
+{
+	NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
+
+	priv->dbus_mgr = nm_dbus_manager_get ();
+}
+
+static GObject*
+constructor (GType type,
+			 guint n_construct_params,
+			 GObjectConstructParam *construct_params)
+{
+	GObject *object;
+	NMModemPrivate *priv;
+	DBusGConnection *bus;
+
+	object = G_OBJECT_CLASS (nm_modem_parent_class)->constructor (type,
+																  n_construct_params,
+																  construct_params);
+	if (!object)
+		return NULL;
+
+	priv = NM_MODEM_GET_PRIVATE (object);
+
+	if (!priv->device) {
+		nm_log_err (LOGD_HW, "modem parent device not provided");
+		goto err;
+	}
+
+	if (!priv->device) {
+		nm_log_err (LOGD_HW, "modem command interface not provided");
+		goto err;
+	}
+
+	if (!priv->path) {
+		nm_log_err (LOGD_HW, "D-Bus path not provided");
+		goto err;
+	}
+
+	bus = nm_dbus_manager_get_connection (priv->dbus_mgr);
+	priv->proxy = dbus_g_proxy_new_for_name (bus,
+	                                         MM_DBUS_SERVICE,
+	                                         priv->path,
+	                                         MM_DBUS_INTERFACE_MODEM);
+
+	priv->props_proxy = dbus_g_proxy_new_for_name (bus,
+	                                               MM_DBUS_SERVICE,
+	                                               priv->path,
+	                                               DBUS_INTERFACE_PROPERTIES);
+	dbus_g_object_register_marshaller (_nm_marshal_VOID__STRING_BOXED,
+	                                   G_TYPE_NONE,
+	                                   G_TYPE_STRING, DBUS_TYPE_G_MAP_OF_VARIANT,
+	                                   G_TYPE_INVALID);
+	dbus_g_proxy_add_signal (priv->props_proxy, "MmPropertiesChanged",
+	                         G_TYPE_STRING, DBUS_TYPE_G_MAP_OF_VARIANT,
+	                         G_TYPE_INVALID);
+	dbus_g_proxy_connect_signal (priv->props_proxy, "MmPropertiesChanged",
+	                             G_CALLBACK (modem_properties_changed),
+	                             object,
+	                             NULL);
+
+	query_mm_enabled (NM_MODEM (object));
+
+	return object;
+
+ err:
+	g_object_unref (object);
+	return NULL;
+}
+
+static void
+get_property (GObject *object, guint prop_id,
+			  GValue *value, GParamSpec *pspec)
+{
+	NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (object);
+
+	switch (prop_id) {
+	case PROP_PATH:
+		g_value_set_string (value, priv->path);
+		break;
+	case PROP_DEVICE:
+		g_value_set_string (value, priv->device);
+		break;
+	case PROP_IFACE:
+		g_value_set_string (value, priv->iface);
+		break;
+	case PROP_IP_METHOD:
+		g_value_set_uint (value, priv->ip_method);
+		break;
+	case PROP_ENABLED:
+		g_value_set_boolean (value, priv->mm_enabled);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+
+}
+
+static void
+set_property (GObject *object, guint prop_id,
+			  const GValue *value, GParamSpec *pspec)
+{
+	NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (object);
+
+	switch (prop_id) {
+	case PROP_PATH:
+		/* Construct only */
+		priv->path = g_value_dup_string (value);
+		break;
+	case PROP_DEVICE:
+		/* Construct only */
+		priv->device = g_value_dup_string (value);
+		break;
+	case PROP_IFACE:
+		/* Construct only */
+		priv->iface = g_value_dup_string (value);
+		break;
+	case PROP_IP_METHOD:
+		/* Construct only */
+		priv->ip_method = g_value_get_uint (value);
+		break;
+	case PROP_ENABLED:
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+finalize (GObject *object)
+{
+	NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (object);
+
+	if (priv->proxy)
+		g_object_unref (priv->proxy);
+
+	if (priv->props_proxy)
+		g_object_unref (priv->props_proxy);
+
+	g_object_unref (priv->dbus_mgr);
+
+	g_free (priv->iface);
+	g_free (priv->path);
+	g_free (priv->device);
+
+	G_OBJECT_CLASS (nm_modem_parent_class)->finalize (object);
+}
+
+static void
+nm_modem_class_init (NMModemClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+	g_type_class_add_private (object_class, sizeof (NMModemPrivate));
+
+	/* Virtual methods */
+	object_class->constructor = constructor;
+	object_class->set_property = set_property;
+	object_class->get_property = get_property;
+	object_class->finalize = finalize;
+
+	klass->act_stage1_prepare = real_act_stage1_prepare;
+	klass->deactivate_quickly = real_deactivate_quickly;
+
+	/* Properties */
+	g_object_class_install_property
+		(object_class, PROP_PATH,
+		 g_param_spec_string (NM_MODEM_PATH,
+							  "DBus path",
+							  "DBus path",
+							  NULL,
+							  G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+	g_object_class_install_property
+		(object_class, PROP_DEVICE,
+		 g_param_spec_string (NM_MODEM_DEVICE,
+		                      "Device",
+		                      "Master modem parent device",
+		                      NULL,
+		                      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+	g_object_class_install_property
+		(object_class, PROP_IFACE,
+		 g_param_spec_string (NM_MODEM_IFACE,
+		                      "Interface",
+		                      "Modem command interface",
+		                      NULL,
+		                      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+	g_object_class_install_property
+		(object_class, PROP_IP_METHOD,
+		 g_param_spec_uint (NM_MODEM_IP_METHOD,
+							"IP method",
+							"IP method",
+							MM_MODEM_IP_METHOD_PPP,
+							MM_MODEM_IP_METHOD_DHCP,
+							MM_MODEM_IP_METHOD_PPP,
+							G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+	g_object_class_install_property
+		(object_class, PROP_ENABLED,
+		 g_param_spec_boolean (NM_MODEM_ENABLED,
+		                       "Enabled",
+		                       "Enabled",
+		                       TRUE,
+		                       G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | NM_PROPERTY_PARAM_NO_EXPORT));
+
+	/* Signals */
+	signals[PPP_STATS] =
+		g_signal_new ("ppp-stats",
+					  G_OBJECT_CLASS_TYPE (object_class),
+					  G_SIGNAL_RUN_FIRST,
+					  G_STRUCT_OFFSET (NMModemClass, ppp_stats),
+					  NULL, NULL,
+					  _nm_marshal_VOID__UINT_UINT,
+					  G_TYPE_NONE, 2,
+					  G_TYPE_UINT, G_TYPE_UINT);
+
+	signals[PPP_FAILED] =
+		g_signal_new ("ppp-failed",
+					  G_OBJECT_CLASS_TYPE (object_class),
+					  G_SIGNAL_RUN_FIRST,
+					  G_STRUCT_OFFSET (NMModemClass, ppp_failed),
+					  NULL, NULL,
+					  g_cclosure_marshal_VOID__UINT,
+					  G_TYPE_NONE, 1, G_TYPE_UINT);
+
+	signals[IP4_CONFIG_RESULT] =
+		g_signal_new (NM_MODEM_IP4_CONFIG_RESULT,
+					  G_OBJECT_CLASS_TYPE (object_class),
+					  G_SIGNAL_RUN_FIRST,
+					  G_STRUCT_OFFSET (NMModemClass, ip4_config_result),
+					  NULL, NULL,
+					  _nm_marshal_VOID__STRING_OBJECT_POINTER,
+					  G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_OBJECT, G_TYPE_POINTER);
+
+	signals[PREPARE_RESULT] =
+		g_signal_new (NM_MODEM_PREPARE_RESULT,
+					  G_OBJECT_CLASS_TYPE (object_class),
+					  G_SIGNAL_RUN_FIRST,
+					  G_STRUCT_OFFSET (NMModemClass, prepare_result),
+					  NULL, NULL,
+					  _nm_marshal_VOID__BOOLEAN_UINT,
+					  G_TYPE_NONE, 2, G_TYPE_BOOLEAN, G_TYPE_UINT);
+
+	signals[NEED_AUTH] =
+		g_signal_new (NM_MODEM_NEED_AUTH,
+					  G_OBJECT_CLASS_TYPE (object_class),
+					  G_SIGNAL_RUN_FIRST,
+					  G_STRUCT_OFFSET (NMModemClass, need_auth),
+					  NULL, NULL,
+					  _nm_marshal_VOID__STRING_BOOLEAN_UINT_STRING_STRING,
+					  G_TYPE_NONE, 5,
+					  G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING);
+}
+
+const DBusGObjectInfo *
+nm_modem_get_serial_dbus_info (void)
+{
+	return &dbus_glib_nm_serial_device_object_info;
+}
+
diff --git a/src/modem-manager/nm-modem.h b/src/modem-manager/nm-modem.h
new file mode 100644
index 00000000..a2aed57e
--- /dev/null
+++ b/src/modem-manager/nm-modem.h
@@ -0,0 +1,157 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* NetworkManager -- Network link manager
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ * Copyright (C) 2009 Novell, Inc.
+ */
+
+#ifndef NM_MODEM_H
+#define NM_MODEM_H
+
+#include <dbus/dbus-glib.h>
+#include <glib-object.h>
+#include "ppp-manager/nm-ppp-manager.h"
+#include "nm-device.h"
+
+G_BEGIN_DECLS
+
+#define NM_TYPE_MODEM			(nm_modem_get_type ())
+#define NM_MODEM(obj)			(G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_MODEM, NMModem))
+#define NM_MODEM_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass),	NM_TYPE_MODEM, NMModemClass))
+#define NM_IS_MODEM(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_MODEM))
+#define NM_IS_MODEM_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass),	NM_TYPE_MODEM))
+#define NM_MODEM_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj),	NM_TYPE_MODEM, NMModemClass))
+
+#define NM_MODEM_PATH      "path"
+#define NM_MODEM_DEVICE    "device"
+#define NM_MODEM_IFACE     "iface"
+#define NM_MODEM_IP_METHOD "ip-method"
+#define NM_MODEM_ENABLED   "enabled"
+
+#define NM_MODEM_PPP_STATS         "ppp-stats"
+#define NM_MODEM_PPP_FAILED        "ppp-failed"
+#define NM_MODEM_PREPARE_RESULT    "prepare-result"
+#define NM_MODEM_IP4_CONFIG_RESULT "ip4-config-result"
+#define NM_MODEM_NEED_AUTH         "need-auth"
+
+typedef struct {
+	GObject parent;
+} NMModem;
+
+typedef struct {
+	GObjectClass parent;
+
+	gboolean (*get_user_pass)                  (NMModem *modem,
+	                                            NMConnection *connection,
+	                                            const char **user,
+	                                            const char **pass);
+
+	const char * (*get_setting_name)           (NMModem *modem);
+
+	gboolean (*check_connection_compatible)    (NMModem *modem,
+	                                            NMConnection *connection,
+	                                            GError **error);
+
+	NMConnection * (*get_best_auto_connection) (NMModem *modem,
+	                                            GSList *connections,
+	                                            char **specific_object);
+
+	NMActStageReturn (*act_stage1_prepare)     (NMModem *modem,
+	                                            NMActRequest *req,
+	                                            GPtrArray **out_hints,
+	                                            const char **out_setting_name,
+	                                            NMDeviceStateReason *reason);
+
+	void (*deactivate_quickly)                 (NMModem *self, NMDevice *device);
+
+	/* Signals */
+	void (*ppp_stats)  (NMModem *self, guint32 in_bytes, guint32 out_bytes);
+	void (*ppp_failed) (NMModem *self, NMDeviceStateReason reason);
+
+	void (*prepare_result)    (NMModem *self, gboolean success, NMDeviceStateReason reason);
+	void (*ip4_config_result) (NMModem *self, const char *iface, NMIP4Config *config, GError *error);
+
+	void (*need_auth)  (NMModem *self,
+	                    const char *setting_name,
+	                    gboolean retry,
+	                    RequestSecretsCaller caller,
+	                    const char *hint1,
+	                    const char *hint2);
+} NMModemClass;
+
+GType nm_modem_get_type (void);
+
+/* Protected */
+
+NMPPPManager *nm_modem_get_ppp_manager (NMModem *modem);
+DBusGProxy *  nm_modem_get_proxy       (NMModem *modem, const char *interface);
+const char *  nm_modem_get_iface       (NMModem *modem);
+const char *  nm_modem_get_path        (NMModem *modem);
+
+NMConnection *nm_modem_get_best_auto_connection (NMModem *self,
+                                                 GSList *connections,
+                                                 char **specific_object);
+
+gboolean nm_modem_check_connection_compatible (NMModem *self,
+                                               NMConnection *connection,
+                                               GError **error);
+
+NMActStageReturn nm_modem_act_stage1_prepare (NMModem *modem,
+                                              NMActRequest *req,
+                                              NMDeviceStateReason *reason);
+
+NMActStageReturn nm_modem_act_stage2_config (NMModem *modem,
+                                             NMActRequest *req,
+                                             NMDeviceStateReason *reason);
+
+NMActStageReturn nm_modem_stage3_ip4_config_start (NMModem *modem,
+                                                   NMDevice *device,
+                                                   NMDeviceClass *device_class,
+                                                   NMDeviceStateReason *reason);
+
+NMActStageReturn nm_modem_stage4_get_ip4_config (NMModem *modem,
+                                                 NMDevice *device,
+                                                 NMDeviceClass *device_class,
+                                                 NMIP4Config **config,
+                                                 NMDeviceStateReason *reason);
+
+void nm_modem_deactivate_quickly (NMModem *modem, NMDevice *device);
+
+void nm_modem_device_state_changed (NMModem *modem,
+                                    NMDeviceState new_state,
+                                    NMDeviceState old_state,
+                                    NMDeviceStateReason reason);
+
+gboolean nm_modem_hw_is_up (NMModem *modem, NMDevice *device);
+
+gboolean nm_modem_hw_bring_up (NMModem *modem, NMDevice *device, gboolean *no_firmware);
+
+gboolean nm_modem_connection_secrets_updated (NMModem *modem,
+                                              NMActRequest *req,
+                                              NMConnection *connection,
+                                              GSList *updated_settings,
+                                              RequestSecretsCaller caller);
+
+const DBusGObjectInfo *nm_modem_get_serial_dbus_info (void);
+
+gboolean      nm_modem_get_mm_enabled (NMModem *self);
+
+void          nm_modem_set_mm_enabled (NMModem *self, gboolean enabled);
+
+G_END_DECLS
+
+#endif /* NM_MODEM_H */