Serial port over TCP/IP
Hi.
Is it possible to make a char-dev (a serial device ttyS0) available via TCP/IP on a network like it is possible for block-devices like a harddisk via nbd?
Is kernel-support for this present?
If not, is it technically possible to develop such a driver?
Thanks.
Regards Michael Buesch.
Signature · 2 lines
My homepage: http://www.8ung.at/tuxsoft fighting for peace is like fu**ing for virginity
Quoted 7 lines · * Michael Buesch ([email protected]) wrote:
Hi.
Is it possible to make a char-dev (a serial device ttyS0) available via TCP/IP on a network like it is possible for block-devices like a harddisk via nbd?
Is kernel-support for this present?
If not, is it technically possible to develop such a driver?
I keep thinking that it would be nice to have a mechanism for user space char devices; it would have to have a mechanism to pass all the ioctls to the process that dealt with it.
(The particular cases which sparked this idea for me were to do user space SCSI tape drivers to do raid tape and the like, and for emulation of touch screens or mice on systems that only had the other.).
Dave
---------------- Have a happy GNU millennium! ----------------------
/ Dr. David Alan Gilbert | Running GNU/Linux on Alpha,68K| Happy \ \ gro.gilbert @ treblig.org | MIPS,x86,ARM,SPARC,PPC & HPPA | In Hex / \ _________________________|_____ http://www.treblig.org |_______/
Quoted 3 lines · Dr. David Alan Gilbert
I keep thinking that it would be nice to have a mechanism for user space char devices; it would have to have a mechanism to pass all the ioctls to the process that dealt with it.
But wouldn't this make too much overhead, if implemented all in userspace? I say this, because nbd is also implemented in user- und kernel-space.
Regards Michael Buesch.
Signature · 2 lines
My homepage: http://www.8ung.at/tuxsoft fighting for peace is like fu**ing for virginity
Quoted 7 lines · * Michael Buesch ([email protected]) wrote:
Quoted 3 lines · Dr. David Alan Gilbert
I keep thinking that it would be nice to have a mechanism for user space char devices; it would have to have a mechanism to pass all the ioctls to the process that dealt with it.
But wouldn't this make too much overhead, if implemented all in userspace? I say this, because nbd is also implemented in user- und kernel-space.
Sure it would have overhead; but it would be a general mechanism and mean that the kernel didn't need lots of char drivers (except for boot time things). Lots of devices are really just filters/wrappers over other more basic devices (look at the growing pile of USB serial device drivers). Most char devices have such a low throughput that the little overhead wouldn't make much difference, but would simplify the kernel.
Dave
---------------- Have a happy GNU millennium! ----------------------
/ Dr. David Alan Gilbert | Running GNU/Linux on Alpha,68K| Happy \ \ gro.gilbert @ treblig.org | MIPS,x86,ARM,SPARC,PPC & HPPA | In Hex / \ _________________________|_____ http://www.treblig.org |_______/
Quoted 5 lines · Michael Buesch
Is it possible to make a char-dev (a serial device ttyS0) available via TCP/IP on a network like it is possible for block-devices like a harddisk via nbd?
Is kernel-support for this present?
If not, is it technically possible to develop such a driver?
Hi Michael,
No need for kernel support. This simple shell-script is what I use for a project at the moment.
greetings,
Rob van Nieuwkerk
------------------------------------------------
#!/bin/sh
TCP_PORT=4000
SERIAL_PORT=/dev/ttyS1
BAUDRATE=19200
while (true)
do (stty $BAUDRATE -echo clocal raw pass8 ; exec nc -l -p $TCP_PORT) \ < $SERIAL_PORT > $SERIAL_PORT
done
------------------------------------------------
Quoted 3 lines · Rob van Nieuwkerk
No need for kernel support. This simple shell-script is what I use for a project at the moment.
[...]
thanks. :)
Regards Michael Buesch.
Signature · 2 lines
My homepage: http://www.8ung.at/tuxsoft fighting for peace is like fu**ing for virginity
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines · Jeff Randall
Quoted 7 lines · Michael Buesch
Quoted 1 line · Jeff Randall
Yes, it would be very possible to do.
Yes, but after Rob posted this script
[...]
do you think it's still neccessary to develop a driver? I don't think so.Depends what kind of flexiblity you want. If you have no need to support IOCTL's remotely, that script is probably sufficient.
Hm, that's the point. I don't know if ioctls are needed, because I'm not the user of this "network COM-port", but only the possible developer. :) I'll ask the person, who requested this feature tomorrow.
I think ioctls might be needed for his application. But the simple nc-script doesn't provide them.
One thing is clear: For server-side there is no need for kernel-support. But for the client kernel-support might be the best solution.
Regards Michael Buesch.
Signature · 2 lines
My homepage: http://www.8ung.at/tuxsoft fighting for peace is like fu**ing for virginity
Followup to: <[email protected]> By author: Michael Buesch <[email protected]> In newsgroup: linux.dev.kernel
Quoted 7 lines
Is it possible to make a char-dev (a serial device ttyS0) available via TCP/IP on a network like it is possible for block-devices like a harddisk via nbd?
Is kernel-support for this present?
If not, is it technically possible to develop such a driver?
I think what you need is the enhanced pty driver patch which was posted recently, which made is possible for a user-space process to also capture ioctls() such as baud rate setting etc. Then the rest of the work can be done in userspace.
-hpa
Signature · 3 lines
<[email protected]> at work, <[email protected]> in private! "Unix gives you enough rope to shoot yourself in the foot." Architectures needed: ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64
Quoted 4 lines · H. Peter Anvin
I think what you need is the enhanced pty driver patch which was posted recently, which made is possible for a user-space process to also capture
ioctls()such as baud rate setting etc. Then the rest of the work can be done in userspace.
Thanks, this is a good solution!
Regards
Michael Buesch
Signature · 2 lines
My homepage: http://www.8ung.at/tuxsoft fighting for peace is like fu**ing for virginity