From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: "Chen, Bo" <Bo.Chen@atmel.com>
Cc: "alan@linux.intel.com" <alan@linux.intel.com>,
"rick@efn.org" <rick@efn.org>,
"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
"linux-arm-kernel@lists.arm.linux.org.uk"
<linux-arm-kernel@lists.arm.linux.org.uk>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [Query] serial: AT91: Add SIM Driver
Date: Fri, 27 Apr 2012 15:51:43 +0100 [thread overview]
Message-ID: <20120427155143.6b9720a3@pyramind.ukuu.org.uk> (raw)
In-Reply-To: <7AD597EA49E297498E79AFA326C986BB0D31A5CE@penmbx02>
On Fri, 27 Apr 2012 11:19:18 +0000
"Chen, Bo" <Bo.Chen@atmel.com> wrote:
> Hi Alan,
>
> > One way would be to make ISO7816 a line discipline (the layer which sits about the tty).
>
> >Your user space interface would then be
>
> > int ldisc = N_ISO7816;
> > ioctl(tty_fd, TIOCSETD, &ldisc);
>
> Make ISO7816 a line discipline would register it in driver(atmel_serial.c or a new named driver) via tty_register_ldisc(N_ISO7816, &tty_ldisc_ops)
Yes
> If I use ioctl(tty_fd, TIOCSETD, &ldisc), it will close current line discipline and open a new line discipline related to ISO7816 (tty_register_ldisc(N_ISO7816, &tty_ldisc_ops))?
Yes
> > at which point the read/write/ioctl etc calls on your tty will also be > routed via your ldisc so you can manage them and provide ISO7816 sensible > interfaces
>
> Does it mean when I call read/write/ioctl in user space, it will call tty_ldisc_ops functions (ISO7816 line discipline has been opened) such as gsmld_read/gsmld_write/gsmld_ioctl in N_gsm.c? What I need to do is to implement the interface in tty_ldisc_ops?
Yes. The read and write methods get called with the user buffer and size
requested being passed. The ioctl handler is called as well as part of the
standard tty handlers so that a line discipline can implement its own
ioctls.
> What is the reasonable way to add this line discipline, in atmel_serial.c or create a new driver (build as a module and dynamically load)? Would it be accepted by kernel mainline?
Probably as a separate driver. That makes it easier to test and to review.
Alan
prev parent reply other threads:[~2012-04-27 14:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <7AD597EA49E297498E79AFA326C986BB0D317277@penmbx01>
2012-04-23 10:54 ` [Query] serial: AT91: Add SIM Driver Alan Cox
2012-04-27 11:19 ` Chen, Bo
2012-04-27 14:51 ` 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=20120427155143.6b9720a3@pyramind.ukuu.org.uk \
--to=alan@lxorguk.ukuu.org.uk \
--cc=Bo.Chen@atmel.com \
--cc=alan@linux.intel.com \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=rick@efn.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;
as well as URLs for NNTP newsgroup(s).