When connecting instruments using USB under Linux operating system, /dev/ttyACM0 is created. On most Linux distributions ModemManager service starts to use this interface because it thinks there is a modem attached and we are unable to communicate with a device.

There are 2 solutions to a problem:

  1. Disable service ModemManager
  2. Prevent ModemManager to use specific USB device

Disable service ModemManager 

Try in command line:

sudo systemctl status ModemManager.service

if it returns that it is running then you have to stop it and disable it.

sudo systemctl stop ModemManager.service

sudo systemctl disable ModemManager.service

now check if it is really disabled

sudo systemctl status ModemManager.service

 After that you can communicate over /dev/ttyACM0 like with any other serial port on linux
CODE


Prevent ModemManager to use specific USB devices

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
CODE