Modem manager causing our serial ports to fail

Hey! I’m continuing looking at this today - can you do a

udevadm info /sys/class/tty/*

Just to see what kind of USB’s there are

Also, looking at the journal (thank you!) - it seems there may be some issues caused by modem0 (cdc-wdm0). Can you try to mask this device (IGNORE it) and see if it improves the situation?

If i understood correctly, things were working fine when you restarted modem-manager? If that is indeed the case, can you get us a journal after the restart of modem-manager?

Thank you for not giving up.

So, bad things happen when modem manager runs. Everything works fine when modem manager is not running. You have that part backwards :slight_smile:

I just did a test. What occurs is a major delay in Ubuntu recognizing Thiopoly serial devices. If you wait long enough. With modem manager down this does not occur Thiopoly devices are recognized immediately. This only begins to happen once the 4th or 5th Thiopoly device is added.

My rules now look like this:

# Thiopoly USBs
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_DEVICE_PROCESS}="0"

# Quectel EC25/EG25
#  ttyUSB0 (if #0): QCDM/DIAG port
#  ttyUSB1 (if #1): GPS data port
#  ttyUSB2 (if #2): AT primary port
#  ttyUSB3 (if #3): AT secondary port
ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", KERNEL=="ttyUSB0", ENV{.MM_USBIFNUM}=="00", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_QCDM}="1", ENV{ID_MM_DEVICE_PROCESS}="1", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", KERNEL=="ttyUSB1", ENV{.MM_USBIFNUM}=="01", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_GPS}="1", ENV{ID_MM_DEVICE_PROCESS}="1"
ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", KERNEL=="ttyUSB2", ENV{.MM_USBIFNUM}=="02", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1", ENV{ID_MM_DEVICE_PROCESS}="1"
ATTRS{idVendor}=="2c7c", ATTRS{idProduct}=="0125", KERNEL=="ttyUSB3", ENV{.MM_USBIFNUM}=="03", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_SECONDARY}="1", ENV{ID_MM_DEVICE_PROCESS}="1"

Here is the output of the udev command: https://drive.google.com/file/d/1bI1O7HMTcRBRIhC10FYt_Np_CdRpjbJM/view?usp=sharing

It didn’t fit inside the post.

Thanks again, Will

It seems multiple of the ttyUSB* are missing from the udev output – is it possible to have the debug logs from udev when modem-manager starts to hang? (i.e having udev running with debug logs and then starting modem-manager)

Yes, can you be more explicit?

Its interesting. Our TTY devices hang up when modem manager runs at about the 4th device. I then add two more of ours and they hang. No device under /dev/ for the 2 “stuck”. But, I do a ‘snap remove modem-manager’ while they are in this “stuck” condition and BOOM the two that are connected and “stuck” immediately show up.

One of the things I tried doing is build my own modem manager snap from here:

What this lets me do, I think (haven’t fully tested it) is launch modem manager how I like.

So, right now the normal snap ways runs modem manager with the filter-policy=strict. I can now use a different filter policy. For example I can change the launch script in the snap and build a new snap. Here is an example:

will@will-desktop-home:~/modem-manager-snap-1.20.0-2_snap-22/bin$ cat modemmanager 
#!/bin/sh

set -ex

# Until we've reworked the patch which adds snappy support to
# ModemManager we keep this as a rework to make the plugin
# loader happy and find the plugins at the right location
export SNAP_APP_PATH=$SNAP

LOG_LEVEL="INFO"
DEBUG=""
if [ -f "$SNAP_DATA"/.debug_enabled ]; then
    LOG_LEVEL="DEBUG"
    DEBUG="--debug"
fi

TEST_NO_SUSPEND_RESUME=""
if [ "$(snapctl get test.no-suspend-resume)" = "true" ]; then
        TEST_NO_SUSPEND_RESUME="--test-no-suspend-resume"
fi

TEST_QUICK_SUSPEND_RESUME=""
if [ "$(snapctl get test.quick-suspend-resume)" =  "true" ]; then
        TEST_QUICK_SUSPEND_RESUME="--test-quick-suspend-resume"
fi

LOG_LEVEL="DEBUG"
DEBUG="--debug"
# MM_FILTER_RULE_PLUGIN_WHITELIST=1
MM_FILTER_RULE_NET=1 
MM_FILTER_RULE_CDC_WDM=1 
MM_FILTER_RULE_PLUGIN_ALLOWLIST=1
MM_FILTER_RULE_WWAN=1
MM_FILTER_RULE_TTY=1
MM_FILTER_RULE_TTY_DRIVER=1
FILTER_RULE_TTY_ACM_INTERFACE=1
MM_FILTER_RULE_TTY_WITH_NET=1
exec "$SNAP"/usr/sbin/ModemManager --filter-policy=allowlist-only\
     $DEBUG --log-level="$LOG_LEVEL" \
     $TEST_NO_SUSPEND_RESUME \
     $TEST_QUICK_SUSPEND_RESUME \
     "$@"

There are a ton of env variables to choose from. So far, I have not been able to get this to recognize my modem…

But…

Is this a potential solution and if so what arguments and env variables would you recommend I launch modem manager with?