context: add test-no-suspend-resume cli parameter
Disables suspend/resume support at runtime. This is useful for modems which are never turned off or suspended when the host suspends.
This commit is contained in:

committed by
Aleksander Morgado

parent
12329ac788
commit
7159b8e27a
10
src/main.c
10
src/main.c
@@ -195,9 +195,13 @@ main (int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
MMSleepMonitor *sleep_monitor;
|
MMSleepMonitor *sleep_monitor;
|
||||||
|
|
||||||
sleep_monitor = mm_sleep_monitor_get ();
|
if (mm_context_get_test_no_suspend_resume())
|
||||||
g_signal_connect (sleep_monitor, MM_SLEEP_MONITOR_SLEEPING, G_CALLBACK (sleeping_cb), NULL);
|
mm_dbg ("Suspend/resume support disabled at runtime");
|
||||||
g_signal_connect (sleep_monitor, MM_SLEEP_MONITOR_RESUMING, G_CALLBACK (resuming_cb), NULL);
|
else {
|
||||||
|
sleep_monitor = mm_sleep_monitor_get ();
|
||||||
|
g_signal_connect (sleep_monitor, MM_SLEEP_MONITOR_SLEEPING, G_CALLBACK (sleeping_cb), NULL);
|
||||||
|
g_signal_connect (sleep_monitor, MM_SLEEP_MONITOR_RESUMING, G_CALLBACK (resuming_cb), NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -225,6 +225,9 @@ static gchar *test_plugin_dir;
|
|||||||
#if defined WITH_UDEV
|
#if defined WITH_UDEV
|
||||||
static gboolean test_no_udev;
|
static gboolean test_no_udev;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined WITH_SYSTEMD_SUSPEND_RESUME
|
||||||
|
static gboolean test_no_suspend_resume;
|
||||||
|
#endif
|
||||||
|
|
||||||
static const GOptionEntry test_entries[] = {
|
static const GOptionEntry test_entries[] = {
|
||||||
{
|
{
|
||||||
@@ -248,6 +251,13 @@ static const GOptionEntry test_entries[] = {
|
|||||||
"Run without udev support even if available",
|
"Run without udev support even if available",
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
|
#endif
|
||||||
|
#if defined WITH_SYSTEMD_SUSPEND_RESUME
|
||||||
|
{
|
||||||
|
"test-no-suspend-resume", 0, 0, G_OPTION_ARG_NONE, &test_no_suspend_resume,
|
||||||
|
"Disable suspend/resume support at runtime even if available",
|
||||||
|
NULL
|
||||||
|
},
|
||||||
#endif
|
#endif
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
@@ -292,6 +302,14 @@ mm_context_get_test_no_udev (void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined WITH_SYSTEMD_SUSPEND_RESUME
|
||||||
|
gboolean
|
||||||
|
mm_context_get_test_no_suspend_resume (void)
|
||||||
|
{
|
||||||
|
return test_no_suspend_resume;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -43,11 +43,14 @@ gboolean mm_context_get_log_timestamps (void);
|
|||||||
gboolean mm_context_get_log_relative_timestamps (void);
|
gboolean mm_context_get_log_relative_timestamps (void);
|
||||||
|
|
||||||
/* Testing support */
|
/* Testing support */
|
||||||
gboolean mm_context_get_test_session (void);
|
gboolean mm_context_get_test_session (void);
|
||||||
gboolean mm_context_get_test_enable (void);
|
gboolean mm_context_get_test_enable (void);
|
||||||
const gchar *mm_context_get_test_plugin_dir (void);
|
const gchar *mm_context_get_test_plugin_dir (void);
|
||||||
#if defined WITH_UDEV
|
#if defined WITH_UDEV
|
||||||
gboolean mm_context_get_test_no_udev (void);
|
gboolean mm_context_get_test_no_udev (void);
|
||||||
|
#endif
|
||||||
|
#if defined WITH_SYSTEMD_SUSPEND_RESUME
|
||||||
|
gboolean mm_context_get_test_no_suspend_resume (void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* MM_CONTEXT_H */
|
#endif /* MM_CONTEXT_H */
|
||||||
|
Reference in New Issue
Block a user