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