summaryrefslogtreecommitdiffstats
path: root/sw/linux/src/serial.c
blob: a13ef455197dedc5e8e911899a866dd56a0f7bd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "serial.h"

int serial_connect(const char *devpath, long baudrate)
{
    int fd;
    struct termios tty;
    // struct termios tty_old;
    
    // open device
    if ((fd = open(devpath, O_RDWR | O_NOCTTY)) < 0) {
        return -1;
    }

    // set parameters
    if (tcgetattr(fd, &tty) != 0) {
        return -1;
    }

    // cfsetospeed(&tty, 

    return fd;
}