X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fcommon%2Fserial.c;h=002b23c32ef6fd8f73dbe49433eb5d6af15ec419;hb=428edbe13de32b4349af56c9fb3569d63a54e4c8;hp=332cb587cd1a6678f3d89636e406965bfc971a6d;hpb=133a37bfba1a7e1423716b2b872d3bb82a2e64d9;p=libsigrok.git diff --git a/hardware/common/serial.c b/hardware/common/serial.c index 332cb587..002b23c3 100644 --- a/hardware/common/serial.c +++ b/hardware/common/serial.c @@ -1,7 +1,7 @@ /* * This file is part of the sigrok project. * - * Copyright (C) 2010 Bert Vermeulen + * Copyright (C) 2010-2012 Bert Vermeulen * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,8 +30,8 @@ #endif #include #include -#include "sigrok.h" -#include "sigrok-internal.h" +#include "libsigrok.h" +#include "libsigrok-internal.h" // FIXME: Must be moved, or rather passed as function argument. #ifdef _WIN32 @@ -190,7 +190,7 @@ SR_PRIV void serial_restore_params(int fd, void *backup) * flowcontrol: 1 = rts/cts, 2 = xon/xoff * parity: 0 = none, 1 = even, 2 = odd */ -SR_PRIV int serial_set_params(int fd, int speed, int bits, int parity, +SR_PRIV int serial_set_params(int fd, int baudrate, int bits, int parity, int stopbits, int flowcontrol) { #ifdef _WIN32 @@ -201,8 +201,7 @@ SR_PRIV int serial_set_params(int fd, int speed, int bits, int parity, return SR_ERR; } - /* TODO: Rename 'speed' to 'baudrate'. */ - switch(speed) { + switch (baudrate) { /* TODO: Support for higher baud rates. */ case 115200: dcb.BaudRate = CBR_115200; @@ -235,7 +234,7 @@ SR_PRIV int serial_set_params(int fd, int speed, int bits, int parity, struct termios term; speed_t baud; - switch (speed) { + switch (baudrate) { case 9600: baud = B9600; break; @@ -298,13 +297,13 @@ SR_PRIV int serial_set_params(int fd, int speed, int bits, int parity, term.c_iflag &= ~IGNPAR; term.c_cflag &= ~(PARODD | PARENB); switch (parity) { - case 0: + case SERIAL_PARITY_NONE: term.c_iflag |= IGNPAR; break; - case 1: + case SERIAL_PARITY_EVEN: term.c_cflag |= PARENB; break; - case 2: + case SERIAL_PARITY_ODD: term.c_cflag |= PARENB | PARODD; break; default: