From: Martin Ling Date: Tue, 26 Nov 2013 15:26:18 +0000 (+0000) Subject: Return SP_ERR_SUPP on attempt to set mark/space parity without CMSPAR. X-Git-Tag: libserialport-0.1.0~40 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=afb518f04aeab35d385bdbd77137a92045312b96;p=libserialport.git Return SP_ERR_SUPP on attempt to set mark/space parity without CMSPAR. --- diff --git a/serialport.c b/serialport.c index 82ccf2f..7ee60db 100644 --- a/serialport.c +++ b/serialport.c @@ -1456,18 +1456,20 @@ static enum sp_return set_config(struct sp_port *port, struct port_data *data, case SP_PARITY_ODD: data->term.c_cflag |= PARENB | PARODD; break; +#ifdef CMSPAR case SP_PARITY_MARK: data->term.c_cflag |= PARENB | PARODD; -#ifdef CMSPAR data->term.c_cflag |= CMSPAR; -#endif break; case SP_PARITY_SPACE: data->term.c_cflag |= PARENB; -#ifdef CMSPAR data->term.c_cflag |= CMSPAR; -#endif break; +#else + case SP_PARITY_MARK: + case SP_PARITY_SPACE: + RETURN_ERROR(SP_ERR_SUPP, "Mark/space parity not supported"); +#endif default: RETURN_ERROR(SP_ERR_ARG, "Invalid parity setting"); }