00001
00021 #include <stdlib.h>
00022 #include <stdio.h>
00023 #include <fcntl.h>
00024 #include <termios.h>
00025 #include "sportident.h"
00026
00039 int OpenStation(const char * fd, si_station * station)
00040 {
00041 struct termios * options;
00042 station->fd=open(fd, O_RDWR);
00043 if (station->fd <0)
00044 {
00045
00046 return -1;
00047 }
00048
00049 tcgetattr(station->fd, options);
00050
00051 cfsetispeed(options, B38400);
00052 cfsetospeed(options, B38400);
00053
00054 options->c_cflag &= ~(CSIZE | PARENB | CSTOPB);
00055 options->c_cflag |= CS8;
00056
00057 options->c_iflag &= ~(IGNBRK | BRKINT | ICRNL | INLCR | PARMRK | INPCK | ISTRIP | IXON);
00058
00059 options->c_oflag = 0;
00060
00061 options->c_lflag &= ~(ICANON | ECHO | ECHONL | IEXTEN | ISIG);
00062
00063 options->c_cc[VMIN] =1;
00064 options->c_cc[VTIME]=0;
00065 tcsetattr(station->fd, TCSANOW, options);
00066 return station->fd;
00067 }