merbanan / rfid_app

Linux version for China 125kHz rfid reader/writer (RFID_APP_EN)
144 stars 27 forks source link

fix checksum handling in send_read() #8

Closed martinayotte closed 6 years ago

martinayotte commented 6 years ago

I think this should fix the issue https://github.com/merbanan/rfid_app/issues/7

merbanan commented 6 years ago

Did you test this? Can you show the command line output before and after?

martinayotte commented 6 years ago

Of course I did tested it ... In my local version, I've added few more printf() to prove that checksum is properly calculated ...

As mentioned in issue #7, I've said :

Obsiously, the CRC verify isn't correct, it is calculated on empty buffer, therefore always zero.

https://github.com/merbanan/rfid_app/blob/master/rfid_app.c#L130-L134

also result comparision is done with the wrong bytes, against c[cnt-1], while printf is done with c[cnt] :

https://github.com/merbanan/rfid_app/blob/master/rfid_app.c#L146-L147

merbanan commented 6 years ago

Thank you

martinayotte commented 6 years ago

Welcome !