* Help:Serial / Parallel Port Control Under Linux
@ 2008-10-03 5:10 johnny
2008-10-03 14:26 ` Grant Edwards
0 siblings, 1 reply; 6+ messages in thread
From: johnny @ 2008-10-03 5:10 UTC (permalink / raw)
To: linux-serial
Hi,
Right Now I need to write a simple C code to control the serial / parallel
port under linux working like this:
Detect there is an input signal / voltage change and send some output signal
/ voltage accordingly, eg: if DSR is detected to be high, I want to set RTS
to be high as well; if RI is detected to be high, I want DTR set to be low
etc.
I have read the Serial-How to and Serial programming-How to, however I am
still not so clear regarding to this simple programming.
Could anyone direct me some useful references / codes regarding to this
project?
Thanks & Best Regards,
Johnny Xing
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Help:Serial / Parallel Port Control Under Linux
2008-10-03 5:10 Help:Serial / Parallel Port Control Under Linux johnny
@ 2008-10-03 14:26 ` Grant Edwards
2008-10-06 8:54 ` johnny
0 siblings, 1 reply; 6+ messages in thread
From: Grant Edwards @ 2008-10-03 14:26 UTC (permalink / raw)
To: linux-serial
On 2008-10-03, johnny <johnny@pan-tone.com.sg> wrote:
> Right Now I need to write a simple C code to control the
> serial / parallel port under linux working like this: Detect
> there is an input signal / voltage change and send some output
> signal / voltage accordingly, eg: if DSR is detected to be
> high, I want to set RTS to be high as well; if RI is detected
> to be high, I want DTR set to be low etc.
>
> I have read the Serial-How to and Serial programming-How to,
> however I am still not so clear regarding to this simple
> programming.
Ignore the serial programming howto. It's out-of-date,
incomplete, unmaintained and just plain wrong in many areas. I
needs to be gotten rid of, but that doesn't seem to be
possible.
A far better source of information is the Serial Programming
Guide for Posix Operating Systems:
http://www.easysw.com/~mike/serial/serial.html
Specifically, the information about modem control and status
lines is in chapter 5.1:
http://www.easysw.com/~mike/serial/serial.html#5_1
--
Grant Edwards grante Yow! Inside, I'm already
at SOBBING!
visi.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Help:Serial / Parallel Port Control Under Linux
2008-10-03 14:26 ` Grant Edwards
@ 2008-10-06 8:54 ` johnny
2008-10-06 9:12 ` Andreas Stricker
0 siblings, 1 reply; 6+ messages in thread
From: johnny @ 2008-10-06 8:54 UTC (permalink / raw)
To: 'Grant Edwards', linux-serial
Hi, Grant,
I have written a simple program based on the POXIS programming guide,
however, it seems that ioctl() function doesn't have a command of
'TIOCMGET'and 'TIOCMSET'.
I am currently using Centos system.
Do you know any other function which could control the serial port pin
status?
Error:
serialIO.c:195: error: `TIOCMGET' undeclared (first use in this function)
serialIO.c:195: error: (Each undeclared identifier is reported only once
serialIO.c:195: error: for each function it appears in.)
serialIO.c:207: error: `TIOCM_CD' undeclared (first use in this function)
serialIO.c:208: error: `TIOCM_CTS' undeclared (first use in this function)
serialIO.c:209: error: `TIOCM_DSR' undeclared (first use in this function)
serialIO.c:210: error: `TIOCM_RI' undeclared (first use in this function)
serialIO.c:212: error: `TIOCM_DTR' undeclared (first use in this function)
serialIO.c:215: error: `TIOCM_RTS' undeclared (first use in this function)
serialIO.c:223: error: `TIOCMSET' undeclared (first use in this function)
-----Original Message-----
From: linux-serial-owner@vger.kernel.org
[mailto:linux-serial-owner@vger.kernel.org] On Behalf Of Grant Edwards
Sent: 2008年10月3日 22:27
To: linux-serial@vger.kernel.org
Subject: Re: Help:Serial / Parallel Port Control Under Linux
On 2008-10-03, johnny <johnny@pan-tone.com.sg> wrote:
> Right Now I need to write a simple C code to control the
> serial / parallel port under linux working like this: Detect
> there is an input signal / voltage change and send some output
> signal / voltage accordingly, eg: if DSR is detected to be
> high, I want to set RTS to be high as well; if RI is detected
> to be high, I want DTR set to be low etc.
>
> I have read the Serial-How to and Serial programming-How to,
> however I am still not so clear regarding to this simple
> programming.
Ignore the serial programming howto. It's out-of-date,
incomplete, unmaintained and just plain wrong in many areas. I
needs to be gotten rid of, but that doesn't seem to be
possible.
A far better source of information is the Serial Programming
Guide for Posix Operating Systems:
http://www.easysw.com/~mike/serial/serial.html
Specifically, the information about modem control and status
lines is in chapter 5.1:
http://www.easysw.com/~mike/serial/serial.html#5_1
--
Grant Edwards grante Yow! Inside, I'm already
at SOBBING!
visi.com
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Help:Serial / Parallel Port Control Under Linux
2008-10-06 8:54 ` johnny
@ 2008-10-06 9:12 ` Andreas Stricker
2008-10-08 4:01 ` johnny
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Stricker @ 2008-10-06 9:12 UTC (permalink / raw)
To: linux-serial
johnny schrieb:
> serialIO.c:195: error: `TIOCMGET' undeclared (first use in this function)
Did you include termios.h? (See `man ioctl_list`)
Regards,
Andy
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Help:Serial / Parallel Port Control Under Linux
2008-10-06 9:12 ` Andreas Stricker
@ 2008-10-08 4:01 ` johnny
2008-10-08 10:05 ` Grant Edwards
0 siblings, 1 reply; 6+ messages in thread
From: johnny @ 2008-10-08 4:01 UTC (permalink / raw)
To: 'Andreas Stricker', linux-serial
I realized that I need to #include iotcl.h as well in order to use TIOCMGET
constant.
If I want to run this small program continuously and detect the changes of
the input pins all the time, can I simply use an infinite loop to do that?
Does it anything wrong to the serial port?
Thanks & Best Regards,
Johnny Xing
-----Original Message-----
From: linux-serial-owner@vger.kernel.org
[mailto:linux-serial-owner@vger.kernel.org] On Behalf Of Andreas Stricker
Sent: 2008年10月6日 17:13
To: linux-serial@vger.kernel.org
Subject: Re: Help:Serial / Parallel Port Control Under Linux
johnny schrieb:
> serialIO.c:195: error: `TIOCMGET' undeclared (first use in this function)
Did you include termios.h? (See `man ioctl_list`)
Regards,
Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Help:Serial / Parallel Port Control Under Linux
2008-10-08 4:01 ` johnny
@ 2008-10-08 10:05 ` Grant Edwards
0 siblings, 0 replies; 6+ messages in thread
From: Grant Edwards @ 2008-10-08 10:05 UTC (permalink / raw)
To: linux-serial
On 2008-10-08, johnny <johnny@pan-tone.com.sg> wrote:
> If I want to run this small program continuously and detect
> the changes of the input pins all the time, can I simply use
> an infinite loop to do that?
Yes. Though you may want to sleep a little between polls to
allow other things to run. Unfortunately, there are no "block
until modem status change" semantics in the Unix tty driver
(one of a number of useful things that the Unix tty driver is
missing).
> Does it anything wrong to the serial port?
No.
--
Grant
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-10-08 10:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-03 5:10 Help:Serial / Parallel Port Control Under Linux johnny
2008-10-03 14:26 ` Grant Edwards
2008-10-06 8:54 ` johnny
2008-10-06 9:12 ` Andreas Stricker
2008-10-08 4:01 ` johnny
2008-10-08 10:05 ` Grant Edwards
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).