Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modem manager and ttyACM in use

I have a script that gets the signal strength from a external Ericsson F3507gw modem, which is connected in:

ttyACM0: mobile broadband data modem
ttyACM1: mobile broadband modem
ttyACM2: GPS port
cdc-wdm0: Device management
cdc-wdm1: USIM port

cu -l /dev/ttyACM2 works fine to send the AT commands. When I do not run Ubuntu's modem manager (mobile broadband is disabled) I can run my script without any problem. However, when Ubuntu is connected using the modem manager sometimes I get:

cu -l /dev/ttyACM2

cu: /dev/ttyACM2: Line in use

I have not figured out when, but I would like to fix it. My user is in the dialup group so there are no permission problems. Any ideas how to run my script without killing the modem-manager?

The script simply sends AT commands using echo.

like image 648
Ekhi Avatar asked Feb 13 '23 12:02

Ekhi


1 Answers

The problem is that ModemManager sees creation of any /dev/ttyACM* device as "Oh, a new modem occurred. I am the modem manager and I have to claim exclusive access to it by opening it right away.". So if you want to avoid that for specific modems you can do that through udev. The contents of my /etc/udev/rules.d/99-ttyacms.rules file:

# http://linux-tips.org/t/prevent-modem-manager-to-capture-usb-serial-devices/284/2.

#$ lsusb | grep Sony
#Bus 007 Device 006: ID 0fce:d0d9 Sony Ericsson Mobile Communications AB 
#$

#udevadm control --reload-rules

ATTRS{idVendor}=="0fce" ATTRS{idProduct}=="d0d9", ENV{ID_MM_DEVICE_IGNORE}="1"

Credit goes to the author of the answer in the link above.

like image 127
hlovdal Avatar answered Feb 15 '23 00:02

hlovdal