From e112896994454d357861619c7db87fcea8b2d2fb Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Mon, 9 Nov 2020 00:36:13 +0100 Subject: base-manager: allow forcing the testing without udev Even if udev support is really built and available. This is extremely useful to test the udev-less setup without fully recompiling the whole daemon. E.g.: the daemon can be run like this: $ sudo /usr/sbin/ModemManager --debug --test-no-udev And then, the kernel events may be reported using mmcli like this: $ sudo mmcli --report-kernel-event-auto-scan --- src/mm-context.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/mm-context.c') diff --git a/src/mm-context.c b/src/mm-context.c index 8f20d2e8..79091e87 100644 --- a/src/mm-context.c +++ b/src/mm-context.c @@ -222,6 +222,9 @@ mm_context_get_log_relative_timestamps (void) static gboolean test_session; static gboolean test_enable; static gchar *test_plugin_dir; +#if defined WITH_UDEV +static gboolean test_no_udev; +#endif static const GOptionEntry test_entries[] = { { @@ -239,6 +242,13 @@ static const GOptionEntry test_entries[] = { "Path to look for plugins", "[PATH]" }, +#if defined WITH_UDEV + { + "test-no-udev", 0, 0, G_OPTION_ARG_NONE, &test_no_udev, + "Run without udev support even if available", + NULL + }, +#endif { NULL } }; @@ -274,6 +284,14 @@ mm_context_get_test_plugin_dir (void) return test_plugin_dir ? test_plugin_dir : PLUGINDIR; } +#if defined WITH_UDEV +gboolean +mm_context_get_test_no_udev (void) +{ + return test_no_udev; +} +#endif + /*****************************************************************************/ static void @@ -345,5 +363,8 @@ mm_context_init (gint argc, g_warning ("error: --initial-kernel-events must be used only if --no-auto-scan is also used"); exit (1); } + /* Force skipping autoscan if running test without udev */ + if (test_no_udev) + no_auto_scan = TRUE; #endif } -- cgit v1.2.3-70-g09d2