]> cvs.zerfleddert.de Git - hmcfgusb/commitdiff
hmuartlgw: simplify crc check
authorMichael Gernoth <michael@gernoth.net>
Sun, 5 Jun 2016 17:23:32 +0000 (19:23 +0200)
committerMichael Gernoth <michael@gernoth.net>
Sun, 5 Jun 2016 17:23:32 +0000 (19:23 +0200)
hmuartlgw.c

index 2e6757a4720ed68ee34ab9cc4de2f06590b83033..4c274cf93e85ea558c0995684c29363dbc112cb7 100644 (file)
@@ -413,10 +413,8 @@ int hmuartlgw_poll(struct hmuartlgw_dev *dev, int timeout)
                return -1;
        }
 
                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 > ");
 
                if (debug)
                        hexdump(dev->buf, dev->pos, "UARTLGW > ");
 
Impressum, Datenschutz