ucom and sio

Daniel O'Connor doconnor at gsoft.com.au
Sat Jan 8 17:11:55 PST 2005


On Sun, 9 Jan 2005 11:28, Brandon Fosdick wrote:
> Daniel O'Connor wrote:
> > Is it blocking waiting for carrier detect to come up?
> > Try using the cuaNN device instead.
>
> The software in question worked fine using a cuaNN device until said
> device died.
>
> Somebody else mentioned that I could set the device to ignore the
> carrier detect signal. How do I do that? Is it a flag to tcsetattr() or
> some kind of ioctl?

Something like this should work..

    if ((sfd = open(portfname, O_RDWR | O_NONBLOCK)) == -1) {
        fprintf(stderr, "Couldn't open serial port - %s\n", strerror(errno));
        exit(1);
    }

    if (tcgetattr(sfd, &tp) == -1) {
        fprintf(stderr, "Couldn't get attr - %s\n", strerror(errno));
        exit(1);
    }

    tp.c_cflag = CLOCAL;

    if (tcflush(sfd, TCIOFLUSH) == -1) {
        fprintf(stderr, "Couldn't flush - %s\n", strerror(errno));
        exit(1);
    }

    if (tcsetattr(sfd, TCSANOW, &tp) == -1) {
        fprintf(stderr, "Couldn't set attrs - %s\n", strerror(errno));
	exit(1);
    }

ie setting CLOCAL.

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20050109/dae6e987/attachment.bin


More information about the freebsd-stable mailing list