rusefi / rusefi

rusefi - GPL internal combustion engine control unit
http://rusefi.com
Other
769 stars 239 forks source link

ttyACM* gets disturbed by ModemManager on modern Linux distro #4359

Closed dron0gus closed 1 year ago

dron0gus commented 2 years ago

CDC ACM is interface mostly used for modems. ModemManager tries to detect modem on all newly added ttyACM devices. This breaks TunerStudio communication few seconds after establish when ModemManages sends few AT commands. https://stackoverflow.com/questions/24696527/modem-manager-and-ttyacm-in-use

Simple solution: systemctl stop ModemManager.service

Advanced solution: Add VID, PID to udev rules with ENV{ID_MM_DEVICE_IGNORE}="1" attribute https://linux-tips.com/t/prevent-modem-manager-to-capture-usb-serial-devices/284/2

dron0gus commented 2 years ago
$ systemctl status ModemManager.service
● ModemManager.service - Modem Manager
   Loaded: loaded (/lib/systemd/system/ModemManager.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2022-07-20 11:50:04 MSK; 8h ago
 Main PID: 1242 (ModemManager)
    Tasks: 3 (limit: 4915)
   CGroup: /system.slice/ModemManager.service
           └─1242 /usr/sbin/ModemManager --filter-policy=strict

июл 20 20:02:05 DronG ModemManager[1242]: <warn>  (ttyACM0) could not open serial device (2)
июл 20 20:02:05 DronG ModemManager[1242]: <warn>  [plugin manager] task 93,ttyACM0: error when checking support with plugin 'Cinterion': '(tty/ttyACM0) failed to open port: Could not open serial device ttyACM0: 
июл 20 20:02:05 DronG ModemManager[1242]: <warn>  (ttyACM0) could not open serial device (2)
июл 20 20:02:05 DronG ModemManager[1242]: <warn>  [plugin manager] task 93,ttyACM0: error when checking support with plugin 'u-blox': '(tty/ttyACM0) failed to open port: Could not open serial device ttyACM0: No 
июл 20 20:02:05 DronG ModemManager[1242]: <warn>  (ttyACM0) could not open serial device (2)
июл 20 20:02:05 DronG ModemManager[1242]: <warn>  [plugin manager] task 93,ttyACM0: error when checking support with plugin 'Generic': '(tty/ttyACM0) failed to open port: Could not open serial device ttyACM0: No
июл 20 20:02:05 DronG ModemManager[1242]: <info>  Couldn't check support for device '/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.8/2-1.8.3/2-1.8.3.3': not supported by any plugin
июл 20 20:02:25 DronG ModemManager[1242]: <info>  [device /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.8/2-1.8.3/2-1.8.3.3] creating modem with plugin 'Generic' and '1' ports
июл 20 20:02:25 DronG ModemManager[1242]: <warn>  Could not grab port (tty/ttyACM0): 'Cannot add port 'tty/ttyACM0', unhandled serial type'
июл 20 20:02:25 DronG ModemManager[1242]: <warn>  Couldn't create modem for device '/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.8/2-1.8.3/2-1.8.3.3': Failed to find primary AT port
mck1117 commented 2 years ago

does hardware CI run this service?

let's find out:

https://github.com/rusefi/rusefi/pull/4361

mck1117 commented 2 years ago

Nope.

image

dron0gus commented 2 years ago

Do we have reconnect issues on CI?

mck1117 commented 2 years ago

nope

chuckwagoncomputing commented 1 year ago

Can we add a note in the wiki, maybe link it from https://wiki.rusefi.com/HOWTO-quick-start/, and close this? Unless there's some actionable firmware change, but I don't see that there is. https://github.com/rusefi/rusefi_documentation/pull/403

chuckwagoncomputing commented 1 year ago

Somebody else with this issue https://github.com/qmk/qmk_firmware/issues/3804

Adafruit tells people to just remove ModemManager https://learn.adafruit.com/adafruit-arduino-ide-setup/linux-setup#udev-rules

chuckwagoncomputing commented 1 year ago

This is documented now, I suggest we close this issue unless we plan on doing something within the firmware to prevent this from happening, which I don't think is feasible.