huawei: start porting the Huawei plugin
This commit is contained in:
+9
-13
@@ -48,7 +48,8 @@ pkglib_LTLIBRARIES = \
|
||||
libmm-plugin-anydata.la \
|
||||
libmm-plugin-linktop.la \
|
||||
libmm-plugin-simtech.la \
|
||||
libmm-plugin-wavecom.la
|
||||
libmm-plugin-wavecom.la \
|
||||
libmm-plugin-huawei.la
|
||||
|
||||
#pkglib_LTLIBRARIES = \
|
||||
# libmm-plugin-generic.la \
|
||||
@@ -93,18 +94,13 @@ libmm_plugin_gobi_la_SOURCES = \
|
||||
libmm_plugin_gobi_la_CPPFLAGS = $(PLUGIN_COMMON_COMPILER_FLAGS)
|
||||
libmm_plugin_gobi_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS)
|
||||
|
||||
#
|
||||
## Huawei
|
||||
#libmm_plugin_huawei_la_SOURCES = \
|
||||
# mm-plugin-huawei.c \
|
||||
# mm-plugin-huawei.h \
|
||||
# mm-modem-huawei-gsm.c \
|
||||
# mm-modem-huawei-gsm.h \
|
||||
# mm-modem-huawei-cdma.c \
|
||||
# mm-modem-huawei-cdma.h
|
||||
#libmm_plugin_huawei_la_CPPFLAGS = $(PLUGIN_COMMON_COMPILER_FLAGS)
|
||||
#libmm_plugin_huawei_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS)
|
||||
#
|
||||
# Huawei
|
||||
libmm_plugin_huawei_la_SOURCES = \
|
||||
huawei/mm-plugin-huawei.c \
|
||||
huawei/mm-plugin-huawei.h
|
||||
libmm_plugin_huawei_la_CPPFLAGS = $(PLUGIN_COMMON_COMPILER_FLAGS)
|
||||
libmm_plugin_huawei_la_LDFLAGS = $(PLUGIN_COMMON_LINKER_FLAGS)
|
||||
|
||||
## MBM
|
||||
#libmm_plugin_mbm_la_SOURCES = \
|
||||
# mm-plugin-mbm.c \
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* 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) 2008 - 2009 Novell, Inc.
|
||||
* Copyright (C) 2009 - 2012 Red Hat, Inc.
|
||||
* Copyright (C) 2012 Aleksander Morgado <aleksander@gnu.org>
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
#include <libmm-common.h>
|
||||
|
||||
#include "mm-log.h"
|
||||
#include "mm-plugin-huawei.h"
|
||||
#include "mm-broadband-modem.h"
|
||||
|
||||
G_DEFINE_TYPE (MMPluginHuawei, mm_plugin_huawei, MM_TYPE_PLUGIN)
|
||||
|
||||
int mm_plugin_major_version = MM_PLUGIN_MAJOR_VERSION;
|
||||
int mm_plugin_minor_version = MM_PLUGIN_MINOR_VERSION;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static MMBaseModem *
|
||||
create_modem (MMPlugin *self,
|
||||
const gchar *sysfs_path,
|
||||
const gchar *driver,
|
||||
guint16 vendor,
|
||||
guint16 product,
|
||||
GList *probes,
|
||||
GError **error)
|
||||
{
|
||||
return MM_BASE_MODEM (mm_broadband_modem_new (sysfs_path,
|
||||
driver,
|
||||
mm_plugin_get_name (self),
|
||||
vendor,
|
||||
product));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
grab_port (MMPlugin *self,
|
||||
MMBaseModem *modem,
|
||||
MMPortProbe *probe,
|
||||
GError **error)
|
||||
{
|
||||
return mm_base_modem_grab_port (modem,
|
||||
mm_port_probe_get_port_subsys (probe),
|
||||
mm_port_probe_get_port_name (probe),
|
||||
mm_port_probe_get_port_type (probe),
|
||||
MM_AT_PORT_FLAG_NONE,
|
||||
error);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
G_MODULE_EXPORT MMPlugin *
|
||||
mm_plugin_create (void)
|
||||
{
|
||||
static const gchar *subsystems[] = { "tty", "net", NULL };
|
||||
static const guint16 vendor_ids[] = { 0x12d1, 0 };
|
||||
|
||||
return MM_PLUGIN (
|
||||
g_object_new (MM_TYPE_PLUGIN_HUAWEI,
|
||||
MM_PLUGIN_NAME, "Huawei",
|
||||
MM_PLUGIN_ALLOWED_SUBSYSTEMS, subsystems,
|
||||
MM_PLUGIN_ALLOWED_VENDOR_IDS, vendor_ids,
|
||||
MM_PLUGIN_ALLOWED_AT, TRUE,
|
||||
NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
mm_plugin_huawei_init (MMPluginHuawei *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
mm_plugin_huawei_class_init (MMPluginHuaweiClass *klass)
|
||||
{
|
||||
MMPluginClass *plugin_class = MM_PLUGIN_CLASS (klass);
|
||||
|
||||
plugin_class->create_modem = create_modem;
|
||||
plugin_class->grab_port = grab_port;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* 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) 2008 - 2009 Novell, Inc.
|
||||
* Copyright (C) 2009 - 2012 Red Hat, Inc.
|
||||
* Copyright (C) 2012 Aleksander Morgado <aleksander@gnu.org
|
||||
*/
|
||||
|
||||
#ifndef MM_PLUGIN_HUAWEI_H
|
||||
#define MM_PLUGIN_HUAWEI_H
|
||||
|
||||
#include "mm-plugin.h"
|
||||
|
||||
#define MM_TYPE_PLUGIN_HUAWEI (mm_plugin_huawei_get_type ())
|
||||
#define MM_PLUGIN_HUAWEI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_PLUGIN_HUAWEI, MMPluginHuawei))
|
||||
#define MM_PLUGIN_HUAWEI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_PLUGIN_HUAWEI, MMPluginHuaweiClass))
|
||||
#define MM_IS_PLUGIN_HUAWEI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_PLUGIN_HUAWEI))
|
||||
#define MM_IS_PLUGIN_HUAWEI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_PLUGIN_HUAWEI))
|
||||
#define MM_PLUGIN_HUAWEI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_PLUGIN_HUAWEI, MMPluginHuaweiClass))
|
||||
|
||||
typedef struct {
|
||||
MMPlugin parent;
|
||||
} MMPluginHuawei;
|
||||
|
||||
typedef struct {
|
||||
MMPluginClass parent;
|
||||
} MMPluginHuaweiClass;
|
||||
|
||||
GType mm_plugin_huawei_get_type (void);
|
||||
|
||||
G_MODULE_EXPORT MMPlugin *mm_plugin_create (void);
|
||||
|
||||
#endif /* MM_PLUGIN_HUAWEI_H */
|
||||
Reference in New Issue
Block a user