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
@@ -195,10 +195,14 @@ main (int argc, char *argv[])
|
||||
{
|
||||
MMSleepMonitor *sleep_monitor;
|
||||
|
||||
if (mm_context_get_test_no_suspend_resume())
|
||||
mm_dbg ("Suspend/resume support disabled at runtime");
|
||||
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
|
||||
|
||||
/* Go into the main loop */
|
||||
|
@@ -225,6 +225,9 @@ static gchar *test_plugin_dir;
|
||||
#if defined WITH_UDEV
|
||||
static gboolean test_no_udev;
|
||||
#endif
|
||||
#if defined WITH_SYSTEMD_SUSPEND_RESUME
|
||||
static gboolean test_no_suspend_resume;
|
||||
#endif
|
||||
|
||||
static const GOptionEntry test_entries[] = {
|
||||
{
|
||||
@@ -248,6 +251,13 @@ static const GOptionEntry test_entries[] = {
|
||||
"Run without udev support even if available",
|
||||
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
|
||||
{ NULL }
|
||||
};
|
||||
@@ -292,6 +302,14 @@ mm_context_get_test_no_udev (void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined WITH_SYSTEMD_SUSPEND_RESUME
|
||||
gboolean
|
||||
mm_context_get_test_no_suspend_resume (void)
|
||||
{
|
||||
return test_no_suspend_resume;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
|
@@ -49,5 +49,8 @@ const gchar *mm_context_get_test_plugin_dir (void);
|
||||
#if defined WITH_UDEV
|
||||
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 /* MM_CONTEXT_H */
|
||||
|
Reference in New Issue
Block a user