context: allow disabling QRTR on runtime even if support is built
This commit is contained in:
@@ -1455,19 +1455,6 @@ initable_init (GInitable *initable,
|
|||||||
{
|
{
|
||||||
MMBaseManager *self = MM_BASE_MANAGER (initable);
|
MMBaseManager *self = MM_BASE_MANAGER (initable);
|
||||||
|
|
||||||
#if defined WITH_QRTR
|
|
||||||
/* Create and setup the QrtrBusWatcher */
|
|
||||||
self->priv->qrtr_bus_watcher = mm_qrtr_bus_watcher_new ();
|
|
||||||
mm_qrtr_bus_watcher_start (self->priv->qrtr_bus_watcher, NULL, NULL);
|
|
||||||
|
|
||||||
/* If autoscan enabled, list for QrtrBusWatcher events */
|
|
||||||
if (self->priv->auto_scan) {
|
|
||||||
g_object_connect (self->priv->qrtr_bus_watcher,
|
|
||||||
"swapped-signal::" MM_QRTR_BUS_WATCHER_DEVICE_ADDED, G_CALLBACK (handle_qrtr_device_added), self,
|
|
||||||
"swapped-signal::" MM_QRTR_BUS_WATCHER_DEVICE_REMOVED, G_CALLBACK (handle_qrtr_device_removed), self,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/* Create filter */
|
/* Create filter */
|
||||||
self->priv->filter = mm_filter_new (self->priv->filter_policy, error);
|
self->priv->filter = mm_filter_new (self->priv->filter_policy, error);
|
||||||
if (!self->priv->filter)
|
if (!self->priv->filter)
|
||||||
@@ -1487,6 +1474,21 @@ initable_init (GInitable *initable,
|
|||||||
g_signal_connect_swapped (self->priv->udev, "uevent", G_CALLBACK (handle_uevent), initable);
|
g_signal_connect_swapped (self->priv->udev, "uevent", G_CALLBACK (handle_uevent), initable);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined WITH_QRTR
|
||||||
|
if (!mm_context_get_test_no_qrtr ()) {
|
||||||
|
/* Create and setup the QrtrBusWatcher */
|
||||||
|
self->priv->qrtr_bus_watcher = mm_qrtr_bus_watcher_new ();
|
||||||
|
mm_qrtr_bus_watcher_start (self->priv->qrtr_bus_watcher, NULL, NULL);
|
||||||
|
/* If autoscan enabled, list for QrtrBusWatcher events */
|
||||||
|
if (self->priv->auto_scan) {
|
||||||
|
g_object_connect (self->priv->qrtr_bus_watcher,
|
||||||
|
"swapped-signal::" MM_QRTR_BUS_WATCHER_DEVICE_ADDED, G_CALLBACK (handle_qrtr_device_added), self,
|
||||||
|
"swapped-signal::" MM_QRTR_BUS_WATCHER_DEVICE_REMOVED, G_CALLBACK (handle_qrtr_device_removed), self,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Export the manager interface */
|
/* Export the manager interface */
|
||||||
if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (initable),
|
if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (initable),
|
||||||
self->priv->connection,
|
self->priv->connection,
|
||||||
|
@@ -25,12 +25,12 @@
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Application context */
|
/* Application context */
|
||||||
|
|
||||||
#if defined WITH_UDEV
|
#if defined WITH_UDEV || defined WITH_QRTR
|
||||||
# define NO_AUTO_SCAN_OPTION_FLAG 0
|
# define NO_AUTO_SCAN_OPTION_FLAG 0
|
||||||
# define NO_AUTO_SCAN_DEFAULT FALSE
|
# define NO_AUTO_SCAN_DEFAULT FALSE
|
||||||
#else
|
#else
|
||||||
/* Keep the option when udev disabled, just so that the unit test setup can
|
/* Keep the option when udev and QRTR disabled, just so that the unit test
|
||||||
* unconditionally use --no-auto-scan */
|
* setup can unconditionally use --no-auto-scan */
|
||||||
# define NO_AUTO_SCAN_OPTION_FLAG G_OPTION_FLAG_HIDDEN
|
# define NO_AUTO_SCAN_OPTION_FLAG G_OPTION_FLAG_HIDDEN
|
||||||
# define NO_AUTO_SCAN_DEFAULT TRUE
|
# define NO_AUTO_SCAN_DEFAULT TRUE
|
||||||
#endif
|
#endif
|
||||||
@@ -228,6 +228,9 @@ static gboolean test_no_udev;
|
|||||||
#if defined WITH_SYSTEMD_SUSPEND_RESUME
|
#if defined WITH_SYSTEMD_SUSPEND_RESUME
|
||||||
static gboolean test_no_suspend_resume;
|
static gboolean test_no_suspend_resume;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined WITH_QRTR
|
||||||
|
static gboolean test_no_qrtr;
|
||||||
|
#endif
|
||||||
|
|
||||||
static const GOptionEntry test_entries[] = {
|
static const GOptionEntry test_entries[] = {
|
||||||
{
|
{
|
||||||
@@ -258,6 +261,13 @@ static const GOptionEntry test_entries[] = {
|
|||||||
"Disable suspend/resume support at runtime even if available",
|
"Disable suspend/resume support at runtime even if available",
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
|
#endif
|
||||||
|
#if defined WITH_QRTR
|
||||||
|
{
|
||||||
|
"test-no-qrtr", 0, 0, G_OPTION_ARG_NONE, &test_no_qrtr,
|
||||||
|
"Run without qrtr support even if available",
|
||||||
|
NULL
|
||||||
|
},
|
||||||
#endif
|
#endif
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
@@ -310,6 +320,13 @@ mm_context_get_test_no_suspend_resume (void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined WITH_QRTR
|
||||||
|
gboolean
|
||||||
|
mm_context_get_test_no_qrtr (void)
|
||||||
|
{
|
||||||
|
return test_no_qrtr;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -376,13 +393,22 @@ mm_context_init (gint argc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initial kernel events processing may only be used if autoscan is disabled */
|
/* Initial kernel events processing may only be used if autoscan is disabled */
|
||||||
#if defined WITH_UDEV
|
#if defined WITH_UDEV || defined WITH_QRTR
|
||||||
if (!no_auto_scan && initial_kernel_events) {
|
if (!no_auto_scan && initial_kernel_events) {
|
||||||
g_warning ("error: --initial-kernel-events must be used only if --no-auto-scan is also used");
|
g_warning ("error: --initial-kernel-events must be used only if --no-auto-scan is also used");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
# if defined WITH_UDEV
|
||||||
/* Force skipping autoscan if running test without udev */
|
/* Force skipping autoscan if running test without udev */
|
||||||
if (test_no_udev)
|
if (test_no_udev)
|
||||||
no_auto_scan = TRUE;
|
no_auto_scan = TRUE;
|
||||||
|
# endif
|
||||||
|
# if defined WITH_QRTR
|
||||||
|
/* Force skipping autoscan if running test without qrtr */
|
||||||
|
if (test_no_qrtr)
|
||||||
|
no_auto_scan = TRUE;
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -52,5 +52,8 @@ gboolean mm_context_get_test_no_udev (void);
|
|||||||
#if defined WITH_SYSTEMD_SUSPEND_RESUME
|
#if defined WITH_SYSTEMD_SUSPEND_RESUME
|
||||||
gboolean mm_context_get_test_no_suspend_resume (void);
|
gboolean mm_context_get_test_no_suspend_resume (void);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined WITH_QRTR
|
||||||
|
gboolean mm_context_get_test_no_qrtr (void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* MM_CONTEXT_H */
|
#endif /* MM_CONTEXT_H */
|
||||||
|
Reference in New Issue
Block a user