REQ: Code to read Serial port signal lines

REQ: Code to read Serial port signal lines

Post by MIke » Tue, 01 Aug 2000 04:00:00



Anyone have example code that wiil allow me to read signal lines from a serial
port i.e. RTS, CTS. I am trying to trigger an event based on one of these lines.

Thanks

Mike


 
 
 

REQ: Code to read Serial port signal lines

Post by root » Wed, 02 Aug 2000 04:00:00



> Anyone have example code that wiil allow me to read signal lines from a serial
> port i.e. RTS, CTS. I am trying to trigger an event based on one of these lines.

        int controlbits;

        ioctl(fd,TIOCMGET,&controlbits);

But, I experienced that when the CD drops, the ioctl fails! Under Linux
I don't have this problem. I posted this problem earlier this month without
any response and since SUNs source code is only available to educational
institutes.....

> Thanks
> Mike



 
 
 

REQ: Code to read Serial port signal lines

Post by Andy Lennar » Wed, 02 Aug 2000 04:00:00


You can still use this ioctl after CD drops if you issue the
TIOCSSOFTCAR ioctl() first. However, this mode persists (or seems to)
after you close the port, so a subsequent open() will proceed
irrespective of CD status.

I'm having 'fun' with this at present. Does anyone know where the
operation of serial i/o is defined?
'man termio' is all well and good, but there are a number of holes in it
and it is certainly not a complete documentation of the implementation.

TIA.
Andy.




>> Anyone have example code that wiil allow me to read signal lines from a serial
>> port i.e. RTS, CTS. I am trying to trigger an event based on one of these
>lines.

>       int controlbits;

>       ioctl(fd,TIOCMGET,&controlbits);

>But, I experienced that when the CD drops, the ioctl fails! Under Linux
>I don't have this problem. I posted this problem earlier this month without
>any response and since SUNs source code is only available to educational
>institutes.....

>> Thanks

>> Mike




 
 
 

REQ: Code to read Serial port signal lines

Post by Greg Andre » Fri, 04 Aug 2000 04:00:00




>> Anyone have example code that wiil allow me to read signal lines from a serial
>> port i.e. RTS, CTS. I am trying to trigger an event based on one of these lines.

>    int controlbits;

>    ioctl(fd,TIOCMGET,&controlbits);

>But, I experienced that when the CD drops, the ioctl fails!

Have you set clocal?

  -Greg
--

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 
 
 

REQ: Code to read Serial port signal lines

Post by Dima Volodi » Sat, 12 Aug 2000 04:00:00


On a related issue:

does anybody have any experience with _contolling_ serial port signals?
What I need to do is to control RTS, and I'm having real trouble with
it. To start with, TIOCMSET doesn't seem to be working at all. When I
try to use TIOCMBIC/TIOCMBIS, things start moving, but in a really weird
ass way. TIOCMBIC sometimes work, sometimes doesn't, and I swear to God
it depends on the current working directory of the process. TIOCMBIS
does set RTS, but in the process DTR is dropped and never restored, even
if I try to restore it explicitly with TIOCMBIS. These strange things
happen on my garden-variety x86 box with garden-variety 16550 asy ports.
I'm running 5.7 Generic_106542-12 if it matters. You can find two little
programs I used while trying to figure it all out at
http://burka.dvv.org/dvv/x86serial.tar .

Any hints & clues will be greatly appreciated.

Cheers!

Dima


> You can still use this ioctl after CD drops if you issue the
> TIOCSSOFTCAR ioctl() first. However, this mode persists (or seems to)
> after you close the port, so a subsequent open() will proceed
> irrespective of CD status.

> I'm having 'fun' with this at present. Does anyone know where the
> operation of serial i/o is defined?
> 'man termio' is all well and good, but there are a number of holes in it
> and it is certainly not a complete documentation of the implementation.

> TIA.
> Andy.

 
 
 

REQ: Code to read Serial port signal lines

Post by Dima Volodi » Tue, 15 Aug 2000 04:00:00


An update:

after some experimenting, it looks to me now that TIOCMBIC doesn't work
for TIOCM_RTS if the third argument in a ioctl() call is a 8 byte
aligned pointer. If the word has a 8*n+4 address, TIOCMBIC happily
clears RTS. Go figure. I haven't tried any other combinations of ioctl()
arguments yet.

Cheers!

Dima


> On a related issue:

> does anybody have any experience with _contolling_ serial port signals?
> What I need to do is to control RTS, and I'm having real trouble with
> it. To start with, TIOCMSET doesn't seem to be working at all. When I
> try to use TIOCMBIC/TIOCMBIS, things start moving, but in a really weird
> ass way. TIOCMBIC sometimes work, sometimes doesn't, and I swear to God
> it depends on the current working directory of the process. TIOCMBIS
> does set RTS, but in the process DTR is dropped and never restored, even
> if I try to restore it explicitly with TIOCMBIS. These strange things
> happen on my garden-variety x86 box with garden-variety 16550 asy ports.
> I'm running 5.7 Generic_106542-12 if it matters. You can find two little
> programs I used while trying to figure it all out at
> http://burka.dvv.org/dvv/x86serial.tar .

> Any hints & clues will be greatly appreciated.

> Cheers!

> Dima


> > You can still use this ioctl after CD drops if you issue the
> > TIOCSSOFTCAR ioctl() first. However, this mode persists (or seems to)
> > after you close the port, so a subsequent open() will proceed
> > irrespective of CD status.

> > I'm having 'fun' with this at present. Does anyone know where the
> > operation of serial i/o is defined?
> > 'man termio' is all well and good, but there are a number of holes in it
> > and it is certainly not a complete documentation of the implementation.

> > TIA.
> > Andy.

 
 
 

1. Serial port modem code examples req'd.

I'm looking for code examples (C) for serial port programming. Most
particularily, controlling a modem.

I can do simple stuff like sending an AT string to the modem and getting it
to dial.

But I need to negotiate a SEND/EXPECT interaction as for a PPP dial up link.
Any web resources for this -- I have read the HOWTO.

Bruce

2. keypad mapping

3. Serial port access C code blocks at 1st read, why?

4. Data transfer

5. Need 'C' code to read from a serial port

6. Print to Win-98 from Linux

7. Serial port access C code blocks at 1st read, why?

8. SATAN

9. Req: help w/ Netbsd-mac68k serial ports

10. read from stdin while reading line by line a file

11. Checking/Changing serial line signals (RNG, CD, DTR, etc)

12. Can't send a break signal to a serial line defined as /dev/lp1

13. line by line reading of the lines in list