* RE: access to RS-232 signals from user-space?
@ 2003-03-26 22:39 Ed Vance
2003-03-26 23:32 ` Amit Kucheria
0 siblings, 1 reply; 4+ messages in thread
From: Ed Vance @ 2003-03-26 22:39 UTC (permalink / raw)
To: 'Amit Kucheria'; +Cc: 'linux-serial'
Hi Amit,
The following ioctl calls are implemented in the generic serial driver,
/usr/src/linux*/drivers/char/serial.c:
Modem Lines
On special files representing serial ports, the modem con-
trol lines supported by the hardware can be read, and the
modem status lines supported by the hardware can be changed.
The following modem control and status lines may be sup-
ported by a device; they are defined by <asm/termios.h>:
TIOCM_DTR data terminal ready
TIOCM_RTS request to send
TIOCM_CTS clear to send
TIOCM_CAR carrier detect
TIOCM_RNG ring
TIOCM_DSR data set ready
TIOCM_OUT1 UART OUT1 signal
TIOCM_OUT2 UART OUT2 signal
TIOCM_CD is a synonym for TIOCM_CAR, and TIOCM_RI is a
synonym for TIOCM_RNG. Not all of these are necessarily sup-
ported by any particular device; check the manual page for
the device in question.
TIOCMBIS The argument is a pointer to an int whose
value is a mask containing modem control
lines to be turned on. The control lines
whose bits are set in the argument are turned
on; no other control lines are affected.
TIOCMBIC The argument is a pointer to an int whose
value is a mask containing modem control
lines to be turned off. The control lines
whose bits are set in the argument are turned
off; no other control lines are affected.
TIOCMGET The argument is a pointer to an int. The
current state of the modem status lines is
fetched and stored in the int pointed to by
the argument.
TIOCMSET The argument is a pointer to an int contain-
ing a new set of modem control lines. The
modem control lines are turned on or off,
depending on whether the bit for that mode is
set or clear.
Cheers,
Ed
----------------------------------------------------------------
Ed Vance edv (at) macrolink (dot) com
Macrolink, Inc. 1500 N. Kellogg Dr Anaheim, CA 92807
----------------------------------------------------------------
-----Original Message-----
From: Amit Kucheria [mailto:akucheria@metricsystems.com]
Sent: Wednesday, March 26, 2003 12:41 PM
To: linux-serial
Subject: access to RS-232 signals from user-space?
Hi all,
I have successfully run a SLIP link between two machines over their
serial ports. We now want to replace the null-modem cable with a radio
at each end connected to the serial port. We also want the ability to
"drive" the radio i.e. use flow-control based on the modem signals on
the radio.
Can anyone enlighten me about the facilities offered by the kernel to
control the various RS-232 lines from kernel-space or user-space? Any
pointers would be helpful.
Regards,
Amit
--
----------------------------------------------------------------------------
Amit Kucheria akucheria@NOSPAMmetricsystems.com
Metric Systems Corporation 2320 Cousteau Court, Suite 201, Vista, CA
92083
----------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread* RE: access to RS-232 signals from user-space?
2003-03-26 22:39 access to RS-232 signals from user-space? Ed Vance
@ 2003-03-26 23:32 ` Amit Kucheria
2003-03-27 23:24 ` Amit Kucheria
0 siblings, 1 reply; 4+ messages in thread
From: Amit Kucheria @ 2003-03-26 23:32 UTC (permalink / raw)
To: Ed Vance; +Cc: linux-serial
Thanks Ed.
I have a few more doubts, but I will reserve them for until after I have
written some code to test out the capabilities of serial port
communications on Linux.
Regards,
Amit
----------------------------------------------------------------------
Amit Kucheria akucheria@NOSPAMmetricsystems.com
Metric Systems Corp. 2320 Cousteau Court, Suite 201, Vista, CA 92083
----------------------------------------------------------------------
On Wed, 2003-03-26 at 14:39, Ed Vance wrote:
> Hi Amit,
>
> The following ioctl calls are implemented in the generic serial driver,
> /usr/src/linux*/drivers/char/serial.c:
>
> Modem Lines
> On special files representing serial ports, the modem con-
> trol lines supported by the hardware can be read, and the
> modem status lines supported by the hardware can be changed.
> The following modem control and status lines may be sup-
> ported by a device; they are defined by <asm/termios.h>:
>
> TIOCM_DTR data terminal ready
> TIOCM_RTS request to send
> TIOCM_CTS clear to send
> TIOCM_CAR carrier detect
> TIOCM_RNG ring
> TIOCM_DSR data set ready
> TIOCM_OUT1 UART OUT1 signal
> TIOCM_OUT2 UART OUT2 signal
>
> TIOCM_CD is a synonym for TIOCM_CAR, and TIOCM_RI is a
> synonym for TIOCM_RNG. Not all of these are necessarily sup-
> ported by any particular device; check the manual page for
> the device in question.
>
> TIOCMBIS The argument is a pointer to an int whose
> value is a mask containing modem control
> lines to be turned on. The control lines
> whose bits are set in the argument are turned
> on; no other control lines are affected.
>
> TIOCMBIC The argument is a pointer to an int whose
> value is a mask containing modem control
> lines to be turned off. The control lines
> whose bits are set in the argument are turned
> off; no other control lines are affected.
>
> TIOCMGET The argument is a pointer to an int. The
> current state of the modem status lines is
> fetched and stored in the int pointed to by
> the argument.
>
> TIOCMSET The argument is a pointer to an int contain-
> ing a new set of modem control lines. The
> modem control lines are turned on or off,
> depending on whether the bit for that mode is
> set or clear.
>
> Cheers,
> Ed
>
> ----------------------------------------------------------------
> Ed Vance edv (at) macrolink (dot) com
> Macrolink, Inc. 1500 N. Kellogg Dr Anaheim, CA 92807
> ----------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: access to RS-232 signals from user-space?
2003-03-26 23:32 ` Amit Kucheria
@ 2003-03-27 23:24 ` Amit Kucheria
0 siblings, 0 replies; 4+ messages in thread
From: Amit Kucheria @ 2003-03-27 23:24 UTC (permalink / raw)
To: linux-serial
Hi,
So I wrote some code which can get and set modem line status from
user-space using the TIOCM[S|G]ET ioctls.
I want to get a little more ambitious and do the following:
------| |-------
| / \ |
Box 1 |====--- ---====| Box2
| \ / |
P1 | Radio1 Radio2 | P2
------| |-------
1. Box1 and Box2 are connected to a radio thru the serial port. They are
communicating over the air. The serial ports on both sides are
configured as a SLIP link.
2. P1 and P2 are two processes generating traffic, they know nothing
about the SLIP link, they just generate IP traffic that is forwarded
over the SLIP link (radio) by the IP layer using the forwarding table.
3. I want to write a program that will get/set the status of RTS/CTS,
etc. depending on the load on the box, load on the link, etc. This will
turn on/off the radio.
So when I turnoff RTS on one side, the same program on the other side
will detect this and turn off the (traffic) tap from that side and
buffer the packets. And when I turn it back on the traffic starts
flowing again.
4. I also want the ability to inject some "status/keep-alive" packets if
the link has been idle for a long time. Any suggestions regarding the
best way to do this?
Has anybody attempted this? Do you foresee any problems?
TIA.
Regards,
Amit
On Wed, 2003-03-26 at 15:32, Amit Kucheria wrote:
> Thanks Ed.
>
> I have a few more doubts, but I will reserve them for until after I have
> written some code to test out the capabilities of serial port
> communications on Linux.
>
> Regards,
> Amit
--
----------------------------------------------------------------------
Amit Kucheria akucheria@NOSPAMmetricsystems.com
Metric Systems Corp. 2320 Cousteau Court, Suite 201, Vista, CA 92083
----------------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* access to RS-232 signals from user-space?
@ 2003-03-26 20:41 Amit Kucheria
0 siblings, 0 replies; 4+ messages in thread
From: Amit Kucheria @ 2003-03-26 20:41 UTC (permalink / raw)
To: linux-serial
Hi all,
I have successfully run a SLIP link between two machines over their
serial ports. We now want to replace the null-modem cable with a radio
at each end connected to the serial port. We also want the ability to
"drive" the radio i.e. use flow-control based on the modem signals on
the radio.
Can anyone enlighten me about the facilities offered by the kernel to
control the various RS-232 lines from kernel-space or user-space? Any
pointers would be helpful.
Regards,
Amit
--
----------------------------------------------------------------------------
Amit Kucheria akucheria@NOSPAMmetricsystems.com
Metric Systems Corporation 2320 Cousteau Court, Suite 201, Vista, CA
92083
----------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-03-27 23:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-26 22:39 access to RS-232 signals from user-space? Ed Vance
2003-03-26 23:32 ` Amit Kucheria
2003-03-27 23:24 ` Amit Kucheria
-- strict thread matches above, loose matches on Subject: below --
2003-03-26 20:41 Amit Kucheria
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox