Redhat 5.2 setting serial port speed

Redhat 5.2 setting serial port speed

Post by G. » Thu, 14 Oct 1999 04:00:00



I have set up a slip link between 2 machines. The second machine is a
386dx40.
It seems that the default serial speed is 38.4k. The link does work into
the 386, but it's having a hard time decoding the packets as it can't
handle the 38.4k speed.

I have tried setting the stty to 19200, not help. I have also tried the
setserial command, but am unabe to work out the syntax, i'm trying to
get it to 19200 so that the old 386 can communicate.

Any ideas out there.

Thanks
G.

 
 
 

1. How can I send and receive data on the serial port 1 on RedHat 5.2

Hi:
I am currently learning to write serial programs on RedHat Linux 5.2.
I currently do not have any way of connecting to another machine.  As
a result I built a DB-9 Loopback Adapter.

I tied the following pins together to build the adapter:
 Pins 2-3      RXD-TXD
 Pins 7-8      RTS-CTS
 Pins 1-4-6-9  CD-DTR-DSR-RI
 Pin  5        GND (unused)

I was curious if anyone else has attempted this before and has gotten
it to work.  I am trying the adapter with the given program listed
below.  The program will send but not receive data.

Please ignore the fact I am not using select to read the port and
other various infractions.  I just wanted a dirty little program to
make sure I could send and receive before doing something more useful.

Any insight of how to get this running or another method of doing a
loopback-ish trick, I would much appreciate the help.

Please mail to me so I don't miss the message.

Thanks,

====================================================================
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>

#define PORT "/dev/ttyS1"

#define STR1 "Hello"
#define STR2 "World"

int open_port (char *port)
{
    int    fd;

    fd = open (port, O_RDWR | O_NOCTTY | O_NDELAY);
    if (fd == -1)
        fprintf(stderr,"Open Port: %s - %s\n", port, strerror(errno));
    else
        fprintf(stderr,"Port: %s opened.\n", port);

    return (fd);

void main ()
{
    int    fd;
    char   buf[80];
    int    n;

    if ((fd = open_port(PORT)) > 0)
    {
        printf("Sending: %s %s\n", STR1, STR2);
        n = write(fd, STR1, strlen(STR1));
        printf("Bytes sent: %d\n", n);
        n = write(fd, STR2, strlen(STR2));
        printf("Bytes sent: %d\n\n\n", n);

        while(1)
        {
            if (read(fd,buf,sizeof(buf)) > 0)
                printf("%s",buf);
        }
    }

    close(fd);

2. Getting DHCP to work with 1999 Q3 Install

3. HELP!: How to set serial port speed (2.6)

4. Where can I get NCSA httpd for Sco Unix?

5. modem/serial port speeds > 115200: "set SPD_* flags is deprecated"

6. multiprocessor support for Linux....

7. how to set up a 14400 speed for the serial port ?

8. AIX 3.1.0 -> AIX 3.1.5 HELPPPPP!

9. How to set serial port speed to 57600

10. Set serial port speed?

11. Q: How to set serial port speed to 76800

12. How set speed of Serial port?

13. Serial Port Speed Setting