[Nut-upsdev] [RFC apcsmart V3 17/18] drivers/apcsmart.c: add ser_flush_in() in setver_enum() and do_cmd()

Michal Soltys soltys at ziu.info
Sat Mar 5 10:38:34 UTC 2011


Just in case, and for the sake of consistency with setvar_string().

Signed-off-by: Michal Soltys <soltys at ziu.info>
---
 drivers/apcsmart.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/apcsmart.c b/drivers/apcsmart.c
index 63b91b5..70aebfc 100644
--- a/drivers/apcsmart.c
+++ b/drivers/apcsmart.c
@@ -1141,6 +1141,7 @@ static int setvar_enum(apc_vartab_t *vt, const char *val)
 	char	orig[256], temp[256];
 	const char	*ptr;
 
+	ser_flush_in(upsfd, IGNCHARS, nut_debug_level);
 	ret = ser_send_char(upsfd, vt->cmd);
 
 	if (ret != 1) {
@@ -1235,7 +1236,6 @@ static int setvar_string(apc_vartab_t *vt, const char *val)
 	char	temp[256];
 
 	ser_flush_in(upsfd, IGNCHARS, nut_debug_level);
-
 	ret = ser_send_char(upsfd, vt->cmd);
 
 	if (ret != 1) {
@@ -1338,6 +1338,7 @@ static int do_cmd(apc_cmdtab_t *ct)
 	int	ret;
 	char	buf[SMALLBUF];
 
+	ser_flush_in(upsfd, IGNCHARS, nut_debug_level);
 	ret = ser_send_char(upsfd, ct->cmd);
 
 	if (ret != 1) {
-- 
1.7.2.1




More information about the Nut-upsdev mailing list