From b1d2ccc2e0f45169d6dda672c80a5aaf4770e7a3 Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Sun, 5 Jun 2016 19:23:32 +0200 Subject: [PATCH 1/1] hmuartlgw: simplify crc check --- hmuartlgw.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hmuartlgw.c b/hmuartlgw.c index 2e6757a..4c274cf 100644 --- a/hmuartlgw.c +++ b/hmuartlgw.c @@ -413,10 +413,8 @@ int hmuartlgw_poll(struct hmuartlgw_dev *dev, int timeout) return -1; } - crc = crc16(dev->buf, dev->pos - 2); - if ((((crc >> 8) & 0xff) == dev->buf[dev->pos - 2]) && - ((crc & 0xff) == dev->buf[dev->pos - 1])) { - + crc = crc16(dev->buf, dev->pos); + if (crc == 0x0000) { if (debug) hexdump(dev->buf, dev->pos, "UARTLGW > "); -- 2.39.5