How to make /dev/ttyACM0 (and friends) exclusive?
greg at kroah.com
Sun Mar 3 06:00:11 EST 2019
On Sun, Mar 03, 2019 at 03:55:44AM -0500, Jeffrey Walton wrote:
> On Sun, Mar 3, 2019 at 12:55 AM <valdis.kletnieks at vt.edu> wrote:
> > On Sat, 02 Mar 2019 14:36:12 -0500, Jeffrey Walton said:
> > > I feel like I am missing something... Does Linux consider the modem a
> > > shared resource instead of an exclusive resource? What use cases
> > > support two different programs sending commands to the modem at the
> > > same time?
> > The Linux kernel has exactly zero clue what a "modem" is. It's talking to a
> > serial port, and doesn't care where the other end of the serial cable is. If
> > you have a onboard modem, that cable may be all of 2 mm long and consist of a
> > bunch of traces between two chips on a PCB, or even internal connections
> > between two sides of a chip, but it's still there.
> > So the correct question is "what use cases have two programs talking to the
> > same serial port"?
> I agree about the general case of serial lines and /dev/ttySn. However...
> /dev/ttyACMn are modems, not serial lines. For whatever reason the
> kernel made a special case for the devices. The kernel knows exactly
> what they are.
The kernel has no idea that this is a "modem". It doesn't even know
what a modem is. All it knows is that this is a tty device, and then
there happens to be a driver that knows how to speak the USB ACM class
protocol bound to it.
Again, go delete modem manager off of your system, it is the thing that
keeps opening the port up to see if you have made a valid connection on
the device or not. If you write your own program to talk to the device,
modem manager is not needed at all, and is known to cause this problem.
More information about the Kernelnewbies