56K modems - work still in progress patch



Hi!

Here's the first step in adding 56k modems capability to NetworkManager
through ModemManager. There's still work to do but it is a good start ;)

Let me know if this is all good :)

Regards,
Alex

diff -uNr ModemManager-0.4/src/Makefile.am ModemManager/src/Makefile.am
--- ModemManager-0.4/src/Makefile.am	2010-04-29 20:01:40.000000000 +0100
+++ ModemManager/src/Makefile.am	2010-08-12 10:17:24.291249721 +0100
@@ -90,6 +90,8 @@
 	mm-generic-cdma.h \
 	mm-generic-gsm.c \
 	mm-generic-gsm.h \
+	mm-generic-56k.c \
+	mm-generic-56k.h \
 	mm-modem-cdma.c \
 	mm-modem-cdma.h \
 	mm-modem-gsm.h \
diff -uNr ModemManager-0.4/src/Makefile.in ModemManager/src/Makefile.in
--- ModemManager-0.4/src/Makefile.in	2010-06-16 18:31:57.000000000 +0100
+++ ModemManager/src/Makefile.in	2010-08-12 10:18:13.752250559 +0100
@@ -81,12 +81,13 @@
 	mm-qcdm-serial-port.c mm-qcdm-serial-port.h \
 	mm-serial-parsers.c mm-serial-parsers.h mm-modem-base.c \
 	mm-modem-base.h mm-generic-cdma.c mm-generic-cdma.h \
-	mm-generic-gsm.c mm-generic-gsm.h mm-modem-cdma.c \
-	mm-modem-cdma.h mm-modem-gsm.h mm-modem-gsm-card.c \
-	mm-modem-gsm-card.h mm-modem-gsm-network.c \
-	mm-modem-gsm-network.h mm-modem-gsm-sms.c mm-modem-gsm-sms.h \
-	mm-modem-simple.c mm-modem-simple.h mm-options.c mm-options.h \
-	mm-plugin.c mm-plugin.h mm-plugin-base.c mm-plugin-base.h \
+	mm-generic-gsm.c mm-generic-gsm.h mm-generic-56k.c \
+	mm-generic-56k.h mm-modem-cdma.c mm-modem-cdma.h \
+	mm-modem-gsm.h mm-modem-gsm-card.c mm-modem-gsm-card.h \
+	mm-modem-gsm-network.c mm-modem-gsm-network.h \
+	mm-modem-gsm-sms.c mm-modem-gsm-sms.h mm-modem-simple.c \
+	mm-modem-simple.h mm-options.c mm-options.h mm-plugin.c \
+	mm-plugin.h mm-plugin-base.c mm-plugin-base.h \
 	mm-properties-changed-signal.c mm-properties-changed-signal.h \
 	mm-modem-location.c mm-modem-location.h
 @WITH_POLKIT_TRUE am__objects_1 = modem_manager-mm-auth-request-polkit.$(OBJEXT) \
@@ -109,6 +110,7 @@
 	modem_manager-mm-modem-base.$(OBJEXT) \
 	modem_manager-mm-generic-cdma.$(OBJEXT) \
 	modem_manager-mm-generic-gsm.$(OBJEXT) \
+	modem_manager-mm-generic-56k.$(OBJEXT) \
 	modem_manager-mm-modem-cdma.$(OBJEXT) \
 	modem_manager-mm-modem-gsm-card.$(OBJEXT) \
 	modem_manager-mm-modem-gsm-network.$(OBJEXT) \
@@ -394,12 +396,13 @@
 	mm-qcdm-serial-port.c mm-qcdm-serial-port.h \
 	mm-serial-parsers.c mm-serial-parsers.h mm-modem-base.c \
 	mm-modem-base.h mm-generic-cdma.c mm-generic-cdma.h \
-	mm-generic-gsm.c mm-generic-gsm.h mm-modem-cdma.c \
-	mm-modem-cdma.h mm-modem-gsm.h mm-modem-gsm-card.c \
-	mm-modem-gsm-card.h mm-modem-gsm-network.c \
-	mm-modem-gsm-network.h mm-modem-gsm-sms.c mm-modem-gsm-sms.h \
-	mm-modem-simple.c mm-modem-simple.h mm-options.c mm-options.h \
-	mm-plugin.c mm-plugin.h mm-plugin-base.c mm-plugin-base.h \
+	mm-generic-gsm.c mm-generic-gsm.h mm-generic-56k.c \
+	mm-generic-56k.h mm-modem-cdma.c mm-modem-cdma.h \
+	mm-modem-gsm.h mm-modem-gsm-card.c mm-modem-gsm-card.h \
+	mm-modem-gsm-network.c mm-modem-gsm-network.h \
+	mm-modem-gsm-sms.c mm-modem-gsm-sms.h mm-modem-simple.c \
+	mm-modem-simple.h mm-options.c mm-options.h mm-plugin.c \
+	mm-plugin.h mm-plugin-base.c mm-plugin-base.h \
 	mm-properties-changed-signal.c mm-properties-changed-signal.h \
 	$(am__append_4)
 BUILT_SOURCES = mm-manager-glue.h mm-modem-glue.h \
@@ -517,6 +520,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote  /$(DEPDIR)/modem_manager-mm-auth-request-polkit Po am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote  /$(DEPDIR)/modem_manager-mm-auth-request Po am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote  /$(DEPDIR)/modem_manager-mm-callback-info Po am__quote@
+ AMDEP_TRUE@@am__include@ @am__quote  /$(DEPDIR)/modem_manager-mm-generic-56k Po am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote  /$(DEPDIR)/modem_manager-mm-generic-cdma Po am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote  /$(DEPDIR)/modem_manager-mm-generic-gsm Po am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote  /$(DEPDIR)/modem_manager-mm-manager Po am__quote@
@@ -820,6 +824,20 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(modem_manager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o modem_manager-mm-generic-gsm.obj `if test -f 'mm-generic-gsm.c'; then $(CYGPATH_W) 'mm-generic-gsm.c'; else $(CYGPATH_W) '$(srcdir)/mm-generic-gsm.c'; fi`
 
+modem_manager-mm-generic-56k.o: mm-generic-56k.c
+ am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(modem_manager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT modem_manager-mm-generic-56k.o -MD -MP -MF $(DEPDIR)/modem_manager-mm-generic-56k.Tpo -c -o modem_manager-mm-generic-56k.o `test -f 'mm-generic-56k.c' || echo '$(srcdir)/'`mm-generic-56k.c
+ am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/modem_manager-mm-generic-56k.Tpo $(DEPDIR)/modem_manager-mm-generic-56k.Po
+ AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mm-generic-56k.c' object='modem_manager-mm-generic-56k.o' libtool=no @AMDEPBACKSLASH@
+ AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(modem_manager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o modem_manager-mm-generic-56k.o `test -f 'mm-generic-56k.c' || echo '$(srcdir)/'`mm-generic-56k.c
+
+modem_manager-mm-generic-56k.obj: mm-generic-56k.c
+ am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(modem_manager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT modem_manager-mm-generic-56k.obj -MD -MP -MF $(DEPDIR)/modem_manager-mm-generic-56k.Tpo -c -o modem_manager-mm-generic-56k.obj `if test -f 'mm-generic-56k.c'; then $(CYGPATH_W) 'mm-generic-56k.c'; else $(CYGPATH_W) '$(srcdir)/mm-generic-56k.c'; fi`
+ am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/modem_manager-mm-generic-56k.Tpo $(DEPDIR)/modem_manager-mm-generic-56k.Po
+ AMDEP_TRUE@@am__fastdepCC_FALSE@	source='mm-generic-56k.c' object='modem_manager-mm-generic-56k.obj' libtool=no @AMDEPBACKSLASH@
+ AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(modem_manager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o modem_manager-mm-generic-56k.obj `if test -f 'mm-generic-56k.c'; then $(CYGPATH_W) 'mm-generic-56k.c'; else $(CYGPATH_W) '$(srcdir)/mm-generic-56k.c'; fi`
+
 modem_manager-mm-modem-cdma.o: mm-modem-cdma.c
 @am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(modem_manager_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT modem_manager-mm-modem-cdma.o -MD -MP -MF $(DEPDIR)/modem_manager-mm-modem-cdma.Tpo -c -o modem_manager-mm-modem-cdma.o `test -f 'mm-modem-cdma.c' || echo '$(srcdir)/'`mm-modem-cdma.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/modem_manager-mm-modem-cdma.Tpo $(DEPDIR)/modem_manager-mm-modem-cdma.Po
diff -uNr ModemManager-0.4/src/mm-generic-56k.c ModemManager/src/mm-generic-56k.c
--- ModemManager-0.4/src/mm-generic-56k.c	1970-01-01 01:00:00.000000000 +0100
+++ ModemManager/src/mm-generic-56k.c	2010-08-12 10:23:20.761250838 +0100
@@ -0,0 +1,84 @@
+/*
+ * 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:
+ *
+ * Copyright (C) 2010 Alex Buell <alex buell munted org u>
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include "mm-generic-56k.h"
+#include "mm-modem-simple.h"
+#include "mm-errors.h"
+#include "mm-callback-info.h"
+#include "mm-at-serial-port.h"
+#include "mm-qcdm-serial-port.h"
+#include "mm-serial-parsers.h"
+#include "mm-modem-helpers.h"
+#include "mm-options.h"
+#include "mm-properties-changed-signal.h"
+
+static void modem_init (MMModem *modem_class);
+
+G_DEFINE_TYPE_EXTENDED	(MMGeneric56K, mm_generic_56k, MM_TYPE_MODEM_BASE, 0, G_IMPLEMENT_INTERFACE (MM_TYPE_MODEM, modem_init))
+
+#define MM_GENERIC_56K_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MM_TYPE_GENERIC_56K, MMGeneric56KPrivate))
+
+typedef struct {
+	char *driver;
+	char *plugin;
+	char *device;
+
+	gboolean valid;
+	
+	guint pending_reg_id;
+	MMCallbackInfo *pending_reg_info;
+	gboolean manual_reg;
+
+	MMAtSerialPort *port;
+	MMPort *data;
+} MMGeneric56KPrivate;
+
+MMModem *mm_generic_56k_new(const char *device, const char *driver, const char *plugin)
+{
+	g_return_val_if_fail (device != NULL, NULL);
+	g_return_val_if_fail (driver != NULL, NULL);
+	g_return_val_if_fail (plugin != NULL, NULL);
+
+	return MM_MODEM (g_object_new (MM_TYPE_GENERIC_56K, MM_MODEM_MASTER_DEVICE, device, MM_MODEM_DRIVER, driver, MM_MODEM_PLUGIN, plugin, NULL));
+}
+
+/********/
+
+static void modem_init (MMModem *modem_class)
+{
+}
+
+static void mm_generic_56k_init (MMGeneric56K *self)
+{
+	MMGeneric56KPrivate *priv = MM_GENERIC_56K_GET_PRIVATE(self);
+
+	priv = priv;
+}
+
+static void mm_generic_56k_class_init (MMGeneric56KClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+	mm_generic_56k_parent_class = g_type_class_peek_parent (klass);
+	g_type_class_add_private (object_class, sizeof(MMGeneric56KPrivate));
+
+	//object_class->set_property = set_property;
+	//object_class->get_property = get_property;
+	//object_class->finalize = finalize;
+}
diff -uNr ModemManager-0.4/src/mm-generic-56k.h ModemManager/src/mm-generic-56k.h
--- ModemManager-0.4/src/mm-generic-56k.h	1970-01-01 01:00:00.000000000 +0100
+++ ModemManager/src/mm-generic-56k.h	2010-08-12 10:22:47.026251118 +0100
@@ -0,0 +1,54 @@
+/*
+ * 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:
+ *
+ * Copyright (C) 2010 Alex Buell <alex buell munted org u>
+ */
+
+#ifndef MM_GENERIC_56K_H
+#define MM_GENERIC_56K_H
+
+#include "mm-modem-base.h"
+#include "mm-at-serial-port.h"
+#include "mm-callback-info.h"
+
+#define MM_TYPE_GENERIC_56K		(mm_generic_56k_get_type ())
+#define MM_GENERIC_56K(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_GENERIC_56K, MMGeneric56K))
+#define MM_GENERIC_56K_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_GENERIC_56K, MMGeneric56KClass))
+#define MM_IS_GENERIC_56K(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_GENERIC_56K)
+#define MM_IS_GENERIC_56K_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_GENERIC_56K))
+#define MM_GENERIC_56K_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_GLASS ((obj), MM_TYPE_GENERIC_56K, MMGeneric56KClass))
+	
+typedef struct {
+	MMModemBase parent;
+} MMGeneric56K;
+
+typedef struct {
+	MMModemBaseClass parent;
+	
+	void(*do_enable) (MMGeneric56K *self, MMModemFn callback, gpointer user_data);
+} MMGeneric56KClass;
+
+GType mm_generic_56k_get_type(void);
+
+MMModem *mm_generic_56k_new(const char *device, const char *driver, const char *plugin);
+
+MMAtSerialPort *mm_generic_56k_get_at_port(MMGeneric56K *modem, MMPortType *ptype);
+
+MMPort *mm_generic_56k_grab_port(MMGeneric56K *modem, const char *subsys, const char *name, MMPortType ptype, GError **error);
+
+void mm_generic_56k_update_enabled_state(MMGeneric56K *modem, gboolean stay_connected, MMModemStateReason reason);
+
+void mm_generic_56k_enable_complete(MMGeneric56K *modem, GError *error, MMCallbackInfo *info);
+
+void mm_generic_56k_connect_complete(MMGeneric56K *modem, GError *error, MMCallbackInfo *info);
+
+#endif /* MM_GENERIC_56K_H */
+

-- 
http://www.munted.org.uk

One very high maintenance cat living here.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]