The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
To: Ulf Samuelsson <linux-kernel@emagii.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: RFC: mcu_tty: Trying to open /dev/ttyUSB0 and lock access from a kernel driver
Date: Tue, 26 Sep 2017 00:05:16 +0100	[thread overview]
Message-ID: <20170926000516.7b556e58@alans-desktop> (raw)
In-Reply-To: <ed0f000c-acd2-857c-2e6e-e25f72ae9f9e@emagii.com>

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

      reply	other threads:[~2017-09-25 23:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-25 13:01 RFC: mcu_tty: Trying to open /dev/ttyUSB0 and lock access from a kernel driver Ulf Samuelsson
2017-09-25 23:05 ` Alan Cox [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170926000516.7b556e58@alans-desktop \
    --to=gnomes@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@emagii.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox