From: Tilman Schmidt <tilman@imap.cc>
To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
linux-serial@vger.kernel.or
Subject: Re: [RFC] tty (or char) bus?
Date: Sun, 19 Jul 2009 15:19:22 +0200 [thread overview]
Message-ID: <4A631D5A.3030105@imap.cc> (raw)
In-Reply-To: <20090717175428.GB4852@const.linuxsymposium.org>
[-- Attachment #1: Type: text/plain, Size: 1958 bytes --]
Scripsit Samuel Thibault die 17.07.2009 19:54:
> Janusz Krzysztofik, le Tue 14 Jul 2009 17:31:23 +0200, a écrit :
>> AFAICS, even if tty lowlevel write() could be used unmodified, a
>> convenient way of reading characters from a tty is missing and should
>> be implemented in a line discipline. Please correct me if I am wrong.
>
> Have you seen the receive_buf line discipline hook? Indeed it's not a
> read() operation as from userland, but at least you can get the data
> from the tty that way.
That's as it should be. A read() operation that sleeps until some data
is available isn't very useful in kernel mode, as it can only be used
if you have the ability to sleep. A callback function which runs your
code as soon as the data arrives is a much better fit, although of
course it requires a bit of rethinking.
>> OTOH, I found that some kind of abstraction layer for acccessing devices
>> over a tty could be convenient. Instead of allocating a new line
>> discipline for each specific device, sometimes found on a specific board
>> only, why not just create a new bus type?
>
> I'd tend to agree with you, as I also have a use case for that: braille
> & speech synthesis devices. However for now I haven't found a really
> convincing argument why line disciplines aren't enough.
I was in the same situation three years ago when I implemented the
ser_gigaset driver for an RS232 connected ISDN adapter, and found the
line discipline (LD) interface quite adequate once I had figured out
how to use it. The only inconvenience is how LDs are loaded and
attached to a serial interface, via the TIOCSETD ioctl, because you
need a userspace daemon which keeps the tty device open so that the
LD stays attached to it.
--
Tilman Schmidt E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Tilman Schmidt <tilman@imap.cc>
To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: Re: [RFC] tty (or char) bus?
Date: Sun, 19 Jul 2009 15:19:22 +0200 [thread overview]
Message-ID: <4A631D5A.3030105@imap.cc> (raw)
In-Reply-To: <20090717175428.GB4852@const.linuxsymposium.org>
[-- Attachment #1: Type: text/plain, Size: 1958 bytes --]
Scripsit Samuel Thibault die 17.07.2009 19:54:
> Janusz Krzysztofik, le Tue 14 Jul 2009 17:31:23 +0200, a écrit :
>> AFAICS, even if tty lowlevel write() could be used unmodified, a
>> convenient way of reading characters from a tty is missing and should
>> be implemented in a line discipline. Please correct me if I am wrong.
>
> Have you seen the receive_buf line discipline hook? Indeed it's not a
> read() operation as from userland, but at least you can get the data
> from the tty that way.
That's as it should be. A read() operation that sleeps until some data
is available isn't very useful in kernel mode, as it can only be used
if you have the ability to sleep. A callback function which runs your
code as soon as the data arrives is a much better fit, although of
course it requires a bit of rethinking.
>> OTOH, I found that some kind of abstraction layer for acccessing devices
>> over a tty could be convenient. Instead of allocating a new line
>> discipline for each specific device, sometimes found on a specific board
>> only, why not just create a new bus type?
>
> I'd tend to agree with you, as I also have a use case for that: braille
> & speech synthesis devices. However for now I haven't found a really
> convincing argument why line disciplines aren't enough.
I was in the same situation three years ago when I implemented the
ser_gigaset driver for an RS232 connected ISDN adapter, and found the
line discipline (LD) interface quite adequate once I had figured out
how to use it. The only inconvenience is how LDs are loaded and
attached to a serial interface, via the TIOCSETD ioctl, because you
need a userspace daemon which keeps the tty device open so that the
LD stays attached to it.
--
Tilman Schmidt E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
next prev parent reply other threads:[~2009-07-19 13:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-14 15:31 [RFC] tty (or char) bus? Janusz Krzysztofik
2009-07-17 17:54 ` Samuel Thibault
2009-07-19 13:19 ` Tilman Schmidt [this message]
2009-07-19 13:19 ` Tilman Schmidt
2009-07-19 13:34 ` Samuel Thibault
2009-07-19 13:19 ` Tilman Schmidt
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=4A631D5A.3030105@imap.cc \
--to=tilman@imap.cc \
--cc=jkrzyszt@tis.icnet.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.or \
--cc=samuel.thibault@ens-lyon.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.