From 86496bd326f2ec139101049fb19a10b255ee8ad5 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Sat, 22 Jan 2022 14:38:22 +0100 Subject: [PATCH] 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 --- src/mm-plugin-manager.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mm-plugin-manager.c b/src/mm-plugin-manager.c index f0bdba0d..8ec85a57 100644 --- a/src/mm-plugin-manager.c +++ b/src/mm-plugin-manager.c @@ -22,6 +22,8 @@ #include #include +#include + #include #include @@ -713,8 +715,14 @@ port_context_new (MMPluginManager *self, #define MIN_PROBING_TIME_MSECS 2500 /* Additional time to wait for other ports to appear after the last port is - * exposed in the system. */ -#define EXTRA_PROBING_TIME_MSECS 1500 + * 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 +#else +# define EXTRA_PROBING_TIME_MSECS 3000 +#endif /* The wait time we define must always be less than the probing time */ G_STATIC_ASSERT (MIN_WAIT_TIME_MSECS < MIN_PROBING_TIME_MSECS);