From: linux@iam.tj (TJ)
To: kernelnewbies@lists.kernelnewbies.org
Subject: How to implement a tty serial driver for RFC2217 networked serial port access devices?
Date: Sat, 02 Aug 2014 12:38:50 +0100 [thread overview]
Message-ID: <53DCCDCA.10801@iam.tj> (raw)
I'm investigating how to design and write a module for RFC2217 [1] networked serial port access devices. The aim is to present /dev/ttyXXYY devices so that all user-space applications that connect to
local serial ports can connect to
the remote RFC2217 ports in the same way.
The kernel module would act as a RFC2217 client, presenting the local system with serial TTY devices whose endpoints are on a remote network access device, e.g. the Moxa NPort 6650 [2][*].
The driver would need a configuration interface for setting the endpoint(s) for one or more access servers, possibly via sysfs.
Because of the underlying TCP network link I'm not at all clear on how to implement it so I am hoping that others may have some insight on how to tackle this, in particular how to handle the network
connections since they seem more appropriate for user-space rather than the kernel.
For an access device with 16 ports I'd imagine presenting something like /dev/ttyNET${DEV}p${PORT}, e.g:
/dev/ttyNET0p0 /dev/ttyNET0p1 /dev/ttyNET0p2 ... /dev/ttyNET0p13 /dev/ttyNET0p14 /dev/ttyNET0p15
and a sysfs control interface something like:
/sys/bus/net-serial/drivers/rfc2217/
with nodes:
endpoint_add # echo "${IPv4} ${BASE_PORT} 16" > endpoint_add
# creates /dev/ttyNET0p0 - p15
endpoint_add # echo "${IPv6} ${BASE_PORT} 8" > endpoint_add
# creates /dev/ttyNET1p0 - p8
endpoints # cat endpoints; "0 ${IPv4} ${BASE_PORT} 16", "1 ${IPv6} ${BASE_PORT} 8"
endpoint_del # echo 0 > endpoint_del
Because RFC2217 is only one flavour of network-attached serial ports my thoughts are to create two modules, the first being a generic "ttynet" module that manages tty creation, configuration,
tear-down and network connection when a port is opened, and a specialised rfc2217 module that depends on "ttynet" and knows how to talk to RFC2217 devices.
That would provide ready support for other types of networked serial device such as raw (which the generic module should probably do by default).
Because some access devices support more than one serial protocol (RS232, RS422, RS485, etc.) I'm wondering how that should be represented in the driver - possibly another parameter passed to
"endpoint_add", or an additional per-port setting (since access devices allow per-port setting) ?
Thanks in advance.
[*] Moxa do provide an out-of-tree driver for the NPort series but it only works in the NPort-specific 'Real COM' mode, not RFC2217
[1] http://tools.ietf.org/html/rfc2217
[2] http://www.moxa.com/product/NPort_6650.htm
next reply other threads:[~2014-08-02 11:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-02 11:38 TJ [this message]
2014-08-02 20:27 ` How to implement a tty serial driver for RFC2217 networked serial port access devices? Valdis.Kletnieks at vt.edu
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=53DCCDCA.10801@iam.tj \
--to=linux@iam.tj \
--cc=kernelnewbies@lists.kernelnewbies.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.