sr: use proper definitions for parity setting

ols driver fixed to use these as well.
This commit is contained in:
Bert Vermeulen 2012-07-01 22:31:31 +02:00
parent 5d4fb4fc0d
commit f8c1fcda46
3 changed files with 7 additions and 4 deletions

View File

@ -297,13 +297,13 @@ SR_PRIV int serial_set_params(int fd, int baudrate, 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:

View File

@ -398,7 +398,7 @@ static int hw_init(const char *devinfo)
fd = serial_open(l->data, O_RDWR | O_NONBLOCK);
if (fd != -1) {
serial_params[devcnt] = serial_backup_params(fd);
serial_set_params(fd, 115200, 8, 0, 1, 2);
serial_set_params(fd, 115200, 8, SERIAL_PARITY_NONE, 1, 2);
ret = SR_OK;
for (i = 0; i < 5; i++) {
if ((ret = send_shortcommand(fd,

View File

@ -48,6 +48,9 @@ struct sr_usb_dev_inst {
};
#endif
#define SERIAL_PARITY_NONE 0
#define SERIAL_PARITY_EVEN 1
#define SERIAL_PARITY_ODD 2
struct sr_serial_dev_inst {
char *port;
int fd;