How to make /dev/ttyACM0 (and friends) exclusive?

Jeffrey Walton noloader at gmail.com
Fri Mar 1 23:29:53 EST 2019


Hi Everyone,

I'm trying to trackdown a problem using my dialup modem. I have a
program that opens the modem and watches caller id's. It flashes the
hook when a telemarketer calls. It works well until...

When another program opens the modem then my program starts reading
intermittent responses intended for the other program.

I cannot seem to open the device in exclusive mode. The current open
is (I also tried with O_EXCL):

    int modem = open(device_path, O_RDWR | O_NOCTTY | O_SYNC);

I'm not sure if it because udev configures the device incorrectly or
the kernel driver is configured incorrectly. Or maybe it is impossible
to do.

Does anyone know how I can make the device exclusive?

Thanks in advance.



More information about the Kernelnewbies mailing list