Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1739325

Re: RFC: mcu_tty: Trying to open /dev/ttyUSB0 and lock access from a kernel driver

From Alan Cox <gnomes@lxorguk.ukuu.org.uk>
Newsgroups linux.kernel
Subject Re: RFC: mcu_tty: Trying to open /dev/ttyUSB0 and lock access from a kernel driver
Date 2017-09-26 01:10 +0200
Message-ID <utKFH-4Hh-3@gated-at.bofh.it> (permalink)
References <utBj4-6Ms-5@gated-at.bofh.it>
Organization Intel Corporation

Show all headers | View raw


On Mon, 25 Sep 2017 15:01:13 +0200
Ulf Samuelsson <linux-kernel@emagii.com> wrote:

> Trying to open /dev/ttyUSB from a kernel driver (which works), but 
> locking the
> serial port so noone else can access it does not work.
> Any advice would be appreciated.

File locks are advisory only.

For the rest of it you might want to take a look at how the gsm mux
driver works (the protocol stuff is scary but you can ignore that end).
It plugs a line discipline into a tty and that muxes out as a collection
of ttys and shows how it's meant to be done.

That also means you have an owning process with the port open that can do
locking on it and/or route any raw read/writes to the master port into
the bit bucket.

Alan

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

RFC: mcu_tty: Trying to open /dev/ttyUSB0 and lock access from a  kernel driver Ulf Samuelsson <linux-kernel@emagii.com> - 2017-09-25 15:10 +0200
  Re: RFC: mcu_tty: Trying to open /dev/ttyUSB0 and lock access from  a kernel driver Alan Cox <gnomes@lxorguk.ukuu.org.uk> - 2017-09-26 01:10 +0200

csiph-web