Prevent modem manager to capture usb serial devices


#1

I’m working with an embedded device which has an USB serial debug interface.

When I plug usb cable to my Debian box, device registered as /dev/ttyACM0 and ModemManager process, automatically opens the device and I couldn’t use it for a while.

Is it possible to disable ModemManager for this type of devices?


#2

It is possible to disable ModemManager on specific device through udev. You need to write a new udev rule to skip some devices.

First of all, you have to get your usb vendor id and product id from the output of lsusb:

$ lsusb
Bus 001 Device 003: ID 05ac:8511 Apple, Inc. 
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 032: ID 0ca6:a050 Castles Technology Co., Ltd 
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
...

VendorID:ProductID combination comes in front of the human readable device name above.

If your VendorID is 0c06 and ProductId is a050, you can write following rules into a new udev rule file like /etc/udev/rules.d/99-ttyacms.rules:

ATTRS{idVendor}=="0ca6" ATTRS{idProduct}=="a050", ENV{ID_MM_DEVICE_IGNORE}="1"

The magic job is here setting ID_MM_DEVICE_IGNORE environment value to inform ModemManager to skip device.

After new udev rules written you need to reload your udev rules again:

$ sudo udevadm control --reload-rules