Skip to contentSkip to conversation

Enable Modem Manager Support via a plugin

PATCH New [email protected] 1 participant 1 message Feb 19, 2021 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 9/9 Enable Modem Manager Support via a plugin

This enables modem manager support via a plugin. It has been tested on Mobian, PostmarketOS, PureOS, and on a Pinephone and a Librem 5.

It has been tested for a few weeks, and I consider it in an advanced beta state to stable.

---
 Makefile.am               |   8 +-
 README                    |  81 +++-
 configure.ac              |   5 +
 doc/modem-manager-api.txt | 102 ++++
 plugins/modemmanager.c    | 993 ++++++++++++++++++++++++++++++++++++++
 src/service.c             |   2 +-
 src/service.h             |   2 +
 7 files changed, 1187 insertions(+), 6 deletions(-)
 create mode 100644 doc/modem-manager-api.txt
 create mode 100644 plugins/modemmanager.c
Makefile.am +4 -4
index 99fdb76..ecca9d8 100644
@@ -12,8 +12,8 @@ builtin_sources =
 builtin_cflags =
 builtin_libadd =
 
-builtin_modules += ofono
-builtin_sources += plugins/ofono.c
+builtin_modules += ofono modemmanager
+builtin_sources += plugins/ofono.c plugins/modemmanager.c
 
 libexec_PROGRAMS = src/mmsd
 
@@ -24,7 +24,7 @@ src_mmsd_SOURCES = $(gdbus_sources) $(gweb_sources) $(builtin_sources) \
 			src/push.h src/push.c src/store.h src/store.c \
 			src/wsputil.h src/wsputil.c src/mmsutil.h src/mmsutil.c
 
-src_mmsd_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ -lresolv -ldl
+src_mmsd_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @MMGLIB_LIBS@ -lresolv -ldl
 
 src_mmsd_LDFLAGS = -Wl,--export-dynamic
 
@@ -41,7 +41,7 @@ src/plugin.$(OBJEXT): src/builtin.h
 src/builtin.h: src/genbuiltin $(builtin_sources)
 	$(AM_V_GEN)$(srcdir)/src/genbuiltin $(builtin_modules) > $@
 
-AM_CFLAGS = @GLIB_CFLAGS@ @DBUS_CFLAGS@ $(builtin_cflags) \
+AM_CFLAGS = @GLIB_CFLAGS@ @DBUS_CFLAGS@ @MMGLIB_CFLAGS@ $(builtin_cflags) \
 					-DMMS_PLUGIN_BUILTIN \
 					-DPLUGINDIR=\""$(plugindir)"\" \
 					-DPUSHCONFDIR=\""$(pushconfdir)"\"
README +80 -1

97 lines not on this page · raw message

configure.ac +5 -0
index 6b5e1b1..721eb19 100644
@@ -78,4 +78,9 @@ PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.2, dummy=yes,
 AC_SUBST(DBUS_CFLAGS)
 AC_SUBST(DBUS_LIBS)
 
+PKG_CHECK_MODULES(MMGLIB, mm-glib >= 1.10, dummy=yes,
+				AC_MSG_ERROR(mm-glib >= 1.10 is required))
+AC_SUBST(MMGLIB_CFLAGS)
+AC_SUBST(MMGLIB_LIBS)
+
 AC_OUTPUT(Makefile)
doc/modem-manager-api.txt new file +102 -0

102 lines not on this page · raw message

plugins/modemmanager.c new file +993 -0

994 lines not on this page · raw message

src/service.c +1 -1
index f3e710f..0f5c13c 100644
@@ -647,7 +647,7 @@ static void process_request_queue(struct mms_service *service);
 static void emit_message_added(const struct mms_service *service,
 						struct mms_message *msg);
 
-static void activate_bearer(struct mms_service *service)
+void activate_bearer(struct mms_service *service)
 {
 	DBG("service %p setup %d active %d", service, service->bearer_setup, service->bearer_active);
 
src/service.h +2 -0
index 56c0585..586ceca 100644
@@ -52,3 +52,5 @@ int mms_message_register(struct mms_service *service,
 						struct mms_message *msg);
 int mms_message_unregister(const struct mms_service *service,
 						const char *msg_path);
+
+void activate_bearer(struct mms_service *service);
Signature · 1 line
2.30.0