plugin-manager: longer extra probing time when not using udev

When using udev, we rely on the kernel to timely report port additions
in the same device.

When not using udev, e.g. when using hotplug scripts in openwrt, we
use mmcli --report-kernel-event operations to report the port
additions, which may end up requiring much more time to process,
especially during bootup as we would be reporting a lot of port
addition events one after the other.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/493
This commit is contained in:
Aleksander Morgado
2022-01-22 14:38:22 +01:00
parent 11b7aa46cb
commit 86496bd326

View File

@@ -22,6 +22,8 @@
#include <gmodule.h> #include <gmodule.h>
#include <gio/gio.h> #include <gio/gio.h>
#include <config.h>
#include <ModemManager.h> #include <ModemManager.h>
#include <mm-errors-types.h> #include <mm-errors-types.h>
@@ -713,8 +715,14 @@ port_context_new (MMPluginManager *self,
#define MIN_PROBING_TIME_MSECS 2500 #define MIN_PROBING_TIME_MSECS 2500
/* Additional time to wait for other ports to appear after the last port is /* Additional time to wait for other ports to appear after the last port is
* exposed in the system. */ * exposed in the system. Longer time when not using udev, as we rely on
* mmcli --report-kernel-event events to report new port additions, e.g.
* via openwrt hotplug scripts. */
#if defined WITH_UDEV
# define EXTRA_PROBING_TIME_MSECS 1500 # define EXTRA_PROBING_TIME_MSECS 1500
#else
# define EXTRA_PROBING_TIME_MSECS 3000
#endif
/* The wait time we define must always be less than the probing time */ /* The wait time we define must always be less than the probing time */
G_STATIC_ASSERT (MIN_WAIT_TIME_MSECS < MIN_PROBING_TIME_MSECS); G_STATIC_ASSERT (MIN_WAIT_TIME_MSECS < MIN_PROBING_TIME_MSECS);