diff options
author | som <somashekhar.puttagangaiah@intel.com> | 2022-02-07 00:06:36 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2022-03-07 09:51:43 +0000 |
commit | fcf5e3af0d28a12e6070f0b2bbbf75a3d775dee7 (patch) | |
tree | 7fe354f8064fc1cc4c2630f3f1a5a22d8e009ccf | |
parent | 40c791e293c9c58106a256ec0b251f28ebcd068a (diff) |
intel: new MBIM capable device
-rw-r--r-- | plugins/Makefile.am | 7 | ||||
-rw-r--r-- | plugins/intel/mm-broadband-modem-mbim-intel.c | 61 | ||||
-rw-r--r-- | plugins/intel/mm-broadband-modem-mbim-intel.h | 47 | ||||
-rw-r--r-- | plugins/intel/mm-plugin-intel.c | 4 | ||||
-rw-r--r-- | plugins/meson.build | 4 |
5 files changed, 121 insertions, 2 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am index bf9ab350..0900e6b9 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -891,6 +891,13 @@ libmm_plugin_intel_la_SOURCES = \ intel/mm-plugin-intel.c \ intel/mm-plugin-intel.h \ $(NULL) +if WITH_MBIM +libmm_plugin_intel_la_SOURCES += \ + intel/mm-broadband-modem-mbim-intel.h \ + intel/mm-broadband-modem-mbim-intel.c \ + $(NULL) +endif + libmm_plugin_intel_la_CPPFLAGS = \ $(PLUGIN_COMMON_COMPILER_FLAGS) \ -DMM_MODULE_NAME=\"intel\" \ diff --git a/plugins/intel/mm-broadband-modem-mbim-intel.c b/plugins/intel/mm-broadband-modem-mbim-intel.c new file mode 100644 index 00000000..499f8e4f --- /dev/null +++ b/plugins/intel/mm-broadband-modem-mbim-intel.c @@ -0,0 +1,61 @@ +/* -*- 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) 2021-2022 Intel Corporation + */ + +#include <config.h> + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <ctype.h> +#include <time.h> + +#include <ModemManager.h> +#define _LIBMM_INSIDE_MM +#include <libmm-glib.h> + +#include "mm-broadband-modem-mbim-intel.h" + +G_DEFINE_TYPE (MMBroadbandModemMbimIntel, mm_broadband_modem_mbim_intel, MM_TYPE_BROADBAND_MODEM_MBIM) + +/*****************************************************************************/ + +MMBroadbandModemMbimIntel * +mm_broadband_modem_mbim_intel_new (const gchar *device, + const gchar **drivers, + const gchar *plugin, + guint16 vendor_id, + guint16 product_id) +{ + return g_object_new (MM_TYPE_BROADBAND_MODEM_MBIM_INTEL, + MM_BASE_MODEM_DEVICE, device, + MM_BASE_MODEM_DRIVERS, drivers, + MM_BASE_MODEM_PLUGIN, plugin, + MM_BASE_MODEM_VENDOR_ID, vendor_id, + MM_BASE_MODEM_PRODUCT_ID, product_id, + /* MBIM bearer supports NET only */ + MM_BASE_MODEM_DATA_NET_SUPPORTED, TRUE, + NULL); +} + +static void +mm_broadband_modem_mbim_intel_init (MMBroadbandModemMbimIntel *self) +{ +} + +static void +mm_broadband_modem_mbim_intel_class_init (MMBroadbandModemMbimIntelClass *klass) +{ +} diff --git a/plugins/intel/mm-broadband-modem-mbim-intel.h b/plugins/intel/mm-broadband-modem-mbim-intel.h new file mode 100644 index 00000000..549f179d --- /dev/null +++ b/plugins/intel/mm-broadband-modem-mbim-intel.h @@ -0,0 +1,47 @@ +/* -*- 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) 2021-2022 Intel Corporation + */ + +#ifndef MM_BROADBAND_MODEM_MBIM_INTEL_H +#define MM_BROADBAND_MODEM_MBIM_INTEL_H + +#include "mm-broadband-modem-mbim.h" + +#define MM_TYPE_BROADBAND_MODEM_MBIM_INTEL (mm_broadband_modem_mbim_intel_get_type ()) +#define MM_BROADBAND_MODEM_MBIM_INTEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM_MBIM_INTEL, MMBroadbandModemMbimIntel)) +#define MM_BROADBAND_MODEM_MBIM_INTEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_MODEM_MBIM_INTEL, MMBroadbandModemMbimIntelClass)) +#define MM_IS_BROADBAND_MODEM_MBIM_INTEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_MODEM_MBIM_INTEL)) +#define MM_IS_BROADBAND_MODEM_MBIM_INTEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_MODEM_MBIM_INTEL)) +#define MM_BROADBAND_MODEM_MBIM_INTEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_MODEM_MBIM_INTEL, MMBroadbandModemMbimIntelClass)) + +typedef struct _MMBroadbandModemMbimIntel MMBroadbandModemMbimIntel; +typedef struct _MMBroadbandModemMbimIntelClass MMBroadbandModemMbimIntelClass; + +struct _MMBroadbandModemMbimIntel { + MMBroadbandModemMbim parent; +}; + +struct _MMBroadbandModemMbimIntelClass{ + MMBroadbandModemMbimClass parent; +}; + +GType mm_broadband_modem_mbim_intel_get_type (void); + +MMBroadbandModemMbimIntel *mm_broadband_modem_mbim_intel_new (const gchar *device, + const gchar **driver, + const gchar *plugin, + guint16 vendor_id, + guint16 product_id); + +#endif /* MM_BROADBAND_MODEM_MBIM_INTEL_H */ diff --git a/plugins/intel/mm-plugin-intel.c b/plugins/intel/mm-plugin-intel.c index 1e965728..18fc54f8 100644 --- a/plugins/intel/mm-plugin-intel.c +++ b/plugins/intel/mm-plugin-intel.c @@ -24,7 +24,7 @@ #include "mm-broadband-modem.h" #if defined WITH_MBIM -#include "mm-broadband-modem-mbim.h" +#include "mm-broadband-modem-mbim-intel.h" #endif G_DEFINE_TYPE (MMPluginIntel, mm_plugin_intel, MM_TYPE_PLUGIN) @@ -44,7 +44,7 @@ create_modem (MMPlugin *self, #if defined WITH_MBIM if (mm_port_probe_list_has_mbim_port (probes)) { mm_obj_dbg (self, "MBIM-powered Intel modem found..."); - return MM_BASE_MODEM (mm_broadband_modem_mbim_new (uid, + return MM_BASE_MODEM (mm_broadband_modem_mbim_intel_new (uid, drivers, mm_plugin_get_name (self), vendor, diff --git a/plugins/meson.build b/plugins/meson.build index 91484acd..90135988 100644 --- a/plugins/meson.build +++ b/plugins/meson.build @@ -462,6 +462,10 @@ if plugins_options['intel'] 'intel/mm-plugin-intel.c', ) + if enable_mbim + sources += files('intel/mm-broadband-modem-mbim-intel.c') + endif + common_c_args = '-DMM_MODULE_NAME="intel"' plugins += {'plugin-intel': { |