mirror of
https://gitlab.com/mobian1/eg25-manager.git
synced 2025-08-29 07:12:08 +02:00
Merge branch 'sfos' into 'master'
Allow to build without mmglib See merge request mobian1/devices/eg25-manager!13
This commit is contained in:
@@ -47,13 +47,18 @@ eg25_datadir = join_paths(full_datadir, meson.project_name())
|
||||
add_global_arguments('-D@0@="@1@"'.format('EG25_CONFDIR', eg25_confdir), language : 'c')
|
||||
add_global_arguments('-D@0@="@1@"'.format('EG25_DATADIR', eg25_datadir), language : 'c')
|
||||
|
||||
mmglib_dep = dependency('mm-glib', required : false)
|
||||
if mmglib_dep.found()
|
||||
add_global_arguments('-DHAVE_MMGLIB=1', language : 'c')
|
||||
endif
|
||||
|
||||
mgr_deps = [
|
||||
dependency('glib-2.0'),
|
||||
dependency('gio-unix-2.0'),
|
||||
dependency('gudev-1.0'),
|
||||
dependency('libgpiod'),
|
||||
dependency('libusb-1.0'),
|
||||
dependency('mm-glib'),
|
||||
mmglib_dep,
|
||||
]
|
||||
|
||||
subdir('data')
|
||||
|
2
src/at.c
2
src/at.c
@@ -77,12 +77,14 @@ static gboolean send_at_command(struct EG25Manager *manager)
|
||||
g_message("Sending command: %s", g_strstrip(command));
|
||||
} else if (manager->modem_state < EG25_STATE_CONFIGURED) {
|
||||
if (manager->modem_iface == MODEM_IFACE_MODEMMANAGER) {
|
||||
#ifdef HAVE_MMGLIB
|
||||
MMModemState modem_state = mm_modem_get_state(manager->mm_modem);
|
||||
|
||||
if (manager->mm_modem && modem_state >= MM_MODEM_STATE_REGISTERED)
|
||||
modem_update_state(manager, modem_state);
|
||||
else
|
||||
manager->modem_state = EG25_STATE_CONFIGURED;
|
||||
#endif
|
||||
} else {
|
||||
manager->modem_state = EG25_STATE_CONFIGURED;
|
||||
}
|
||||
|
@@ -7,7 +7,11 @@
|
||||
#include "at.h"
|
||||
#include "gpio.h"
|
||||
#include "manager.h"
|
||||
|
||||
#ifdef HAVE_MMGLIB
|
||||
#include "mm-iface.h"
|
||||
#endif
|
||||
|
||||
#include "ofono-iface.h"
|
||||
#include "suspend.h"
|
||||
#include "udev.h"
|
||||
@@ -35,7 +39,9 @@ static gboolean quit_app(struct EG25Manager *manager)
|
||||
g_message("Request to quit...");
|
||||
|
||||
at_destroy(manager);
|
||||
#ifdef HAVE_MMGLIB
|
||||
mm_iface_destroy(manager);
|
||||
#endif
|
||||
ofono_iface_destroy(manager);
|
||||
suspend_destroy(manager);
|
||||
udev_destroy(manager);
|
||||
@@ -100,6 +106,7 @@ static gboolean modem_start(struct EG25Manager *manager)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef HAVE_MMGLIB
|
||||
void modem_update_state(struct EG25Manager *manager, MMModemState state)
|
||||
{
|
||||
switch (state) {
|
||||
@@ -116,6 +123,7 @@ void modem_update_state(struct EG25Manager *manager, MMModemState state)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void modem_configure(struct EG25Manager *manager)
|
||||
{
|
||||
@@ -328,7 +336,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
at_init(&manager, toml_table_in(toml_config, "at"));
|
||||
gpio_init(&manager, toml_table_in(toml_config, "gpio"));
|
||||
#ifdef HAVE_MMGLIB
|
||||
mm_iface_init(&manager, toml_table_in(toml_config, "mm-iface"));
|
||||
#endif
|
||||
ofono_iface_init(&manager);
|
||||
suspend_init(&manager, toml_table_in(toml_config, "suspend"));
|
||||
udev_init(&manager, toml_table_in(toml_config, "udev"));
|
||||
|
@@ -9,7 +9,9 @@
|
||||
#include <glib.h>
|
||||
#include <gpiod.h>
|
||||
#include <gudev/gudev.h>
|
||||
#ifdef HAVE_MMGLIB
|
||||
#include <libmm-glib.h>
|
||||
#endif
|
||||
#include <libgdbofono/gdbo-manager.h>
|
||||
|
||||
#include "toml.h"
|
||||
@@ -51,9 +53,10 @@ struct EG25Manager {
|
||||
|
||||
enum ModemIface modem_iface;
|
||||
guint mm_watch;
|
||||
#ifdef HAVE_MMGLIB
|
||||
MMManager *mm_manager;
|
||||
MMModem *mm_modem;
|
||||
|
||||
#endif
|
||||
guint ofono_watch;
|
||||
GDBOManager *ofono_manager;
|
||||
GDBusConnection *ofono_connection;
|
||||
@@ -80,4 +83,6 @@ void modem_suspend_pre(struct EG25Manager *data);
|
||||
void modem_suspend_post(struct EG25Manager *data);
|
||||
void modem_resume_pre(struct EG25Manager *data);
|
||||
void modem_resume_post(struct EG25Manager *data);
|
||||
#ifdef HAVE_MMGLIB
|
||||
void modem_update_state(struct EG25Manager *data, MMModemState state);
|
||||
#endif
|
||||
|
@@ -7,18 +7,23 @@
|
||||
|
||||
subdir('libgdbofono')
|
||||
|
||||
executable (
|
||||
'eg25manager',
|
||||
[
|
||||
src = [
|
||||
'at.c', 'at.h',
|
||||
'gpio.c', 'gpio.h',
|
||||
'manager.c', 'manager.h',
|
||||
'mm-iface.c', 'mm-iface.h',
|
||||
'ofono-iface.c', 'ofono-iface.h',
|
||||
'suspend.c', 'suspend.h',
|
||||
'toml.c', 'toml.h',
|
||||
'udev.c', 'udev.h',
|
||||
],
|
||||
]
|
||||
|
||||
if mmglib_dep.found()
|
||||
src += ['mm-iface.c', 'mm-iface.h']
|
||||
endif
|
||||
|
||||
executable (
|
||||
'eg25manager',
|
||||
src,
|
||||
dependencies : mgr_deps,
|
||||
link_with: gdbofono_lib,
|
||||
install : true
|
||||
|
@@ -170,7 +170,11 @@ static void signal_cb(GDBusProxy *proxy,
|
||||
g_message("system is resuming");
|
||||
take_inhibitor(manager, FALSE);
|
||||
modem_resume_pre(manager);
|
||||
if (manager->mm_modem || manager->modem_iface == MODEM_IFACE_OFONO) {
|
||||
if (
|
||||
#ifdef HAVE_MMGLIB
|
||||
manager->mm_modem ||
|
||||
#endif
|
||||
manager->modem_iface == MODEM_IFACE_OFONO) {
|
||||
/*
|
||||
* On some systems ModemManager doesn't handle suspend/resume, so
|
||||
* we still have a valid/managed modem when resuming. In this case,
|
||||
|
Reference in New Issue
Block a user