5

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.

2
  • Apparently, sometimes ACM1 is available, sometimes ACM2. This partially fixes my problem...
    – Ekhi
    Jul 11, 2014 at 13:05
  • Do you see any ttyUSB devices appearing in /dev when the modem powers up? Jul 11, 2014 at 16:16

1 Answer 1

8

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.

1
  • With bionic (18.04), this has slightly changed, the ID_MM_DEVICE_IGNORE flag is not taken in account anymore by default because of the policy set to strict. Apr 14, 2020 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.