* Re: modifying line state manually on ttyS
2003-04-07 15:02 modifying line state manually on ttyS Michael Buesch
@ 2003-04-07 14:16 ` Alan Cox
2003-04-07 15:42 ` Michael Buesch
2003-04-07 15:34 ` Sergei Organov
2003-04-07 15:51 ` Richard B. Johnson
2 siblings, 1 reply; 11+ messages in thread
From: Alan Cox @ 2003-04-07 14:16 UTC (permalink / raw)
To: Michael Buesch; +Cc: Linux Kernel Mailing List
On Llu, 2003-04-07 at 16:02, Michael Buesch wrote:
> I have developed my own device, that is connected to ttyS0.
> To talk to my device, I need to set the state of the TxD line
> manually to either 0 or 1 (+12v or -12v). What I try to say is,
TxD is a bad choice. A lot of the hardware cannot control TXD this
way. DTR is the usual one because it is easy to handle but there
are other control lines you can drive directly (see TIOCGMODEM)
^ permalink raw reply [flat|nested] 11+ messages in thread
* modifying line state manually on ttyS
@ 2003-04-07 15:02 Michael Buesch
2003-04-07 14:16 ` Alan Cox
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Michael Buesch @ 2003-04-07 15:02 UTC (permalink / raw)
To: linux-kernel
Hi.
I have asked in many other mailing-lists, but I got no good
solution for my problem, so I try to ask here, although it may
not be the exaclty correct list for it.
I have developed my own device, that is connected to ttyS0.
To talk to my device, I need to set the state of the TxD line
manually to either 0 or 1 (+12v or -12v). What I try to say is,
I don't want to write a whole byte to the port, but only one single
bit, that then stays persistent on the line, until I reset its state.
Better sayed, I want to handle TxD line, like it's possible for
DTR-line for example.
Is kernel-support by the ttyS driver present for this, or do I
have to write my own driver for my device. I'm trying to
implement the driver in user-space, but I didn't find a solution
to set linestate of TxD.
Regards
Michael Buesch.
--
My homepage: http://www.8ung.at/tuxsoft
fighting for peace is like fu**ing for virginity
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: modifying line state manually on ttyS
2003-04-07 15:02 modifying line state manually on ttyS Michael Buesch
2003-04-07 14:16 ` Alan Cox
@ 2003-04-07 15:34 ` Sergei Organov
2003-04-07 16:32 ` Michael Buesch
2003-04-07 15:51 ` Richard B. Johnson
2 siblings, 1 reply; 11+ messages in thread
From: Sergei Organov @ 2003-04-07 15:34 UTC (permalink / raw)
To: Michael Buesch; +Cc: linux-kernel
Michael Buesch <freesoftwaredeveloper@web.de> writes:
> Hi.
>
> I have asked in many other mailing-lists, but I got no good
> solution for my problem, so I try to ask here, although it may
> not be the exaclty correct list for it.
>
> I have developed my own device, that is connected to ttyS0.
> To talk to my device, I need to set the state of the TxD line
> manually to either 0 or 1 (+12v or -12v). What I try to say is,
> I don't want to write a whole byte to the port, but only one single
> bit, that then stays persistent on the line, until I reset its state.
> Better sayed, I want to handle TxD line, like it's possible for
> DTR-line for example.
Do ioctl(fd, TIOCSBRK, 0) / ioctl(fd, TIOCCBRK, 0) help?
--
Sergei.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: modifying line state manually on ttyS
2003-04-07 14:16 ` Alan Cox
@ 2003-04-07 15:42 ` Michael Buesch
0 siblings, 0 replies; 11+ messages in thread
From: Michael Buesch @ 2003-04-07 15:42 UTC (permalink / raw)
To: linux-kernel
On Monday 07 April 2003 16:16, Alan Cox wrote:
> TxD is a bad choice. A lot of the hardware cannot control TXD this
> way. DTR is the usual one because it is easy to handle but there
> are other control lines you can drive directly (see TIOCGMODEM)
Oh great, you have just discovered the reason, why my driver is working
on my Pentium1-PC but not on my Pentium4-PC. It's simply not supported
by hardware. I've spent hours and hours about this. :)
My device is actually using DTR and RTS. What line could I use instead of
TxD? Is it possible to use CTS for this, although it is normally a
"input-signal", but not a "output-signal" like RTS?
Regards
Michael Buesch.
--
My homepage: http://www.8ung.at/tuxsoft
fighting for peace is like fu**ing for virginity
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: modifying line state manually on ttyS
2003-04-07 15:51 ` Richard B. Johnson
@ 2003-04-07 15:48 ` Michael Buesch
0 siblings, 0 replies; 11+ messages in thread
From: Michael Buesch @ 2003-04-07 15:48 UTC (permalink / raw)
To: root; +Cc: linux-kernel
On Monday 07 April 2003 17:51, Richard B. Johnson wrote:
> This means that you can't control TxD directly. I suggest that
> you use the parallel printer-port. This port allows you to set
That's my problem. parallel-port is used by a printer and I don't
wanna by an expensive extension card for second parport. :)
> Now, if you really need the +/- 12 volts that you think you
> will get out of a UART, please measure it first. Many new computers
> use I/O chips that only provide +/- 5 volts! Anyway, you can use the
That's no problem, because I "down-volt" it to 4.7V before using it.
> calls. You probably want to disable the SIGHUP signal before
> you muck with those bits. Some versions of Linux will send the
> hangup signal to the TTY owner even though it's not the controlling
> terminal for the process. This could cause your program to exit
> for "unknown" reasons; signal(SIGHUP, SIG_IGN) prevents such problems.
Thanks for this important information.
Regards
Michael Buesch.
--
My homepage: http://www.8ung.at/tuxsoft
fighting for peace is like fu**ing for virginity
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: modifying line state manually on ttyS
2003-04-07 15:02 modifying line state manually on ttyS Michael Buesch
2003-04-07 14:16 ` Alan Cox
2003-04-07 15:34 ` Sergei Organov
@ 2003-04-07 15:51 ` Richard B. Johnson
2003-04-07 15:48 ` Michael Buesch
2 siblings, 1 reply; 11+ messages in thread
From: Richard B. Johnson @ 2003-04-07 15:51 UTC (permalink / raw)
To: Michael Buesch; +Cc: linux-kernel
On Mon, 7 Apr 2003, Michael Buesch wrote:
> Hi.
>
> I have asked in many other mailing-lists, but I got no good
> solution for my problem, so I try to ask here, although it may
> not be the exaclty correct list for it.
>
> I have developed my own device, that is connected to ttyS0.
> To talk to my device, I need to set the state of the TxD line
> manually to either 0 or 1 (+12v or -12v). What I try to say is,
> I don't want to write a whole byte to the port, but only one single
> bit, that then stays persistent on the line, until I reset its state.
> Better sayed, I want to handle TxD line, like it's possible for
> DTR-line for example.
>
> Is kernel-support by the ttyS driver present for this, or do I
> have to write my own driver for my device. I'm trying to
> implement the driver in user-space, but I didn't find a solution
> to set linestate of TxD.
>
> Regards
> Michael Buesch.
Well ttyS0 is connected to the rest of the machine using a UART.
This means that you can't control TxD directly. I suggest that
you use the parallel printer-port. This port allows you to set
individual bits and they remain <forever> in the last state set.
An ordinary (old-fashioned) printer-port allows you to set or
reset 8 data bits plus three control bits. The newer ones allow
you to read and write up to 16 bits.
Now, if you really need the +/- 12 volts that you think you
will get out of a UART, please measure it first. Many new computers
use I/O chips that only provide +/- 5 volts! Anyway, you can use the
modem-control bits if you need that kind of voltage swing. You can
set/reset modem control bits using the TIOCMGET/TIOCMSET ioctl()
calls. You probably want to disable the SIGHUP signal before
you muck with those bits. Some versions of Linux will send the
hangup signal to the TTY owner even though it's not the controlling
terminal for the process. This could cause your program to exit
for "unknown" reasons; signal(SIGHUP, SIG_IGN) prevents such problems.
Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: modifying line state manually on ttyS
2003-04-07 15:34 ` Sergei Organov
@ 2003-04-07 16:32 ` Michael Buesch
2003-04-07 17:01 ` Sergei Organov
0 siblings, 1 reply; 11+ messages in thread
From: Michael Buesch @ 2003-04-07 16:32 UTC (permalink / raw)
To: Sergei Organov; +Cc: linux-kernel
On Monday 07 April 2003 17:34, Sergei Organov wrote:
> Do ioctl(fd, TIOCSBRK, 0) / ioctl(fd, TIOCSBRK, 0) help?
What does it do? I haven't found a description for TIOCSBRK, TIOCSBRK.
Regards
Michael Buesch.
--
My homepage: http://www.8ung.at/tuxsoft
fighting for peace is like fu**ing for virginity
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: modifying line state manually on ttyS
2003-04-07 16:32 ` Michael Buesch
@ 2003-04-07 17:01 ` Sergei Organov
2003-04-07 17:16 ` Michael Buesch
0 siblings, 1 reply; 11+ messages in thread
From: Sergei Organov @ 2003-04-07 17:01 UTC (permalink / raw)
To: Michael Buesch; +Cc: linux-kernel
Michael Buesch <freesoftwaredeveloper@web.de> writes:
> On Monday 07 April 2003 17:34, Sergei Organov wrote:
> > Do ioctl(fd, TIOCSBRK, 0) / ioctl(fd, TIOCSBRK, 0) help?
>
> What does it do? I haven't found a description for TIOCSBRK, TIOCSBRK.
Changes the state of TxD line, I believe. Did you hear about "break
condition"? It sets/clears the "break condition", at least for me ;)
--
Sergei.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: modifying line state manually on ttyS
2003-04-07 17:01 ` Sergei Organov
@ 2003-04-07 17:16 ` Michael Buesch
0 siblings, 0 replies; 11+ messages in thread
From: Michael Buesch @ 2003-04-07 17:16 UTC (permalink / raw)
To: Sergei Organov; +Cc: linux-kernel
On Monday 07 April 2003 19:01, Sergei Organov wrote:
> Michael Buesch <freesoftwaredeveloper@web.de> writes:
> > What does it do? I haven't found a description for TIOCSBRK, TIOCSBRK.
>
> Changes the state of TxD line, I believe. Did you hear about "break
> condition"? It sets/clears the "break condition", at least for me ;)
Oh my goodness, it works. Thank you *very* much!
Regards
Michael Buesch.
--
My homepage: http://www.8ung.at/tuxsoft
fighting for peace is like fu**ing for virginity
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: modifying line state manually on ttyS
2003-04-07 16:22 Ed Vance
@ 2003-04-07 16:48 ` Michael Buesch
0 siblings, 0 replies; 11+ messages in thread
From: Michael Buesch @ 2003-04-07 16:48 UTC (permalink / raw)
To: Ed Vance; +Cc: linux-kernel
On Monday 07 April 2003 18:22, Ed Vance wrote:
> No, CTS cannot operate as an output.
>
> The following ioctl calls are implemented in the generic serial driver,
> /usr/src/linux*/drivers/char/serial.c:
> [...]
puh, that's very bad. I have to modify the device.
(Better had informed before building it. :)
Thanks to all, who helped me (although this was not the
very correct list :)
Regards
Michael Buesch.
--
My homepage: http://www.8ung.at/tuxsoft
fighting for peace is like fu**ing for virginity
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: modifying line state manually on ttyS
@ 2003-04-07 16:22 Ed Vance
2003-04-07 16:48 ` Michael Buesch
0 siblings, 1 reply; 11+ messages in thread
From: Ed Vance @ 2003-04-07 16:22 UTC (permalink / raw)
To: 'Michael Buesch'; +Cc: linux-kernel
On Mon, Apr 07, 2003 at 8:42 AM, Michael Buesch wrote:
> On Monday 07 April 2003 16:16, Alan Cox wrote:
> > TxD is a bad choice. A lot of the hardware cannot control TXD this
> > way. DTR is the usual one because it is easy to handle but there
> > are other control lines you can drive directly (see TIOCGMODEM)
>
> Oh great, you have just discovered the reason, why my driver
> is working
> on my Pentium1-PC but not on my Pentium4-PC. It's simply not supported
> by hardware. I've spent hours and hours about this. :)
>
> My device is actually using DTR and RTS. What line could I
> use instead of
> TxD? Is it possible to use CTS for this, although it is normally a
> "input-signal", but not a "output-signal" like RTS?
>
No, CTS cannot operate as an output.
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 (DTE output)
TIOCM_RTS request to send (DTE output)
TIOCM_CTS clear to send (DTE input)
TIOCM_CAR carrier detect (DTE input)
TIOCM_RNG ring (DTE input)
TIOCM_DSR data set ready (DTE input)
TIOCM_OUT1 UART OUT1 signal (misc output)
TIOCM_OUT2 UART OUT2 signal (misc output)
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. Output signals OUT1 and OUT2 are not
always connected to port interface pins. Often they are
dedicated to control of UART special functions or loopback.
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] 11+ messages in thread
end of thread, other threads:[~2003-04-07 17:05 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-07 15:02 modifying line state manually on ttyS Michael Buesch
2003-04-07 14:16 ` Alan Cox
2003-04-07 15:42 ` Michael Buesch
2003-04-07 15:34 ` Sergei Organov
2003-04-07 16:32 ` Michael Buesch
2003-04-07 17:01 ` Sergei Organov
2003-04-07 17:16 ` Michael Buesch
2003-04-07 15:51 ` Richard B. Johnson
2003-04-07 15:48 ` Michael Buesch
2003-04-07 16:22 Ed Vance
2003-04-07 16:48 ` Michael Buesch
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).