sr: use proper definitions for parity setting
ols driver fixed to use these as well.
This commit is contained in:
parent
5d4fb4fc0d
commit
f8c1fcda46
|
@ -297,13 +297,13 @@ SR_PRIV int serial_set_params(int fd, int baudrate, int bits, int parity,
|
||||||
term.c_iflag &= ~IGNPAR;
|
term.c_iflag &= ~IGNPAR;
|
||||||
term.c_cflag &= ~(PARODD | PARENB);
|
term.c_cflag &= ~(PARODD | PARENB);
|
||||||
switch (parity) {
|
switch (parity) {
|
||||||
case 0:
|
case SERIAL_PARITY_NONE:
|
||||||
term.c_iflag |= IGNPAR;
|
term.c_iflag |= IGNPAR;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case SERIAL_PARITY_EVEN:
|
||||||
term.c_cflag |= PARENB;
|
term.c_cflag |= PARENB;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case SERIAL_PARITY_ODD:
|
||||||
term.c_cflag |= PARENB | PARODD;
|
term.c_cflag |= PARENB | PARODD;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -398,7 +398,7 @@ static int hw_init(const char *devinfo)
|
||||||
fd = serial_open(l->data, O_RDWR | O_NONBLOCK);
|
fd = serial_open(l->data, O_RDWR | O_NONBLOCK);
|
||||||
if (fd != -1) {
|
if (fd != -1) {
|
||||||
serial_params[devcnt] = serial_backup_params(fd);
|
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;
|
ret = SR_OK;
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < 5; i++) {
|
||||||
if ((ret = send_shortcommand(fd,
|
if ((ret = send_shortcommand(fd,
|
||||||
|
|
|
@ -48,6 +48,9 @@ struct sr_usb_dev_inst {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define SERIAL_PARITY_NONE 0
|
||||||
|
#define SERIAL_PARITY_EVEN 1
|
||||||
|
#define SERIAL_PARITY_ODD 2
|
||||||
struct sr_serial_dev_inst {
|
struct sr_serial_dev_inst {
|
||||||
char *port;
|
char *port;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
Loading…
Reference in New Issue