Skip to content

Commit 3c75356

Browse files
Astrrraskotopes
andauthored
Fix detection of GProx II cards and false detection of other cards (#3869)
* Fix detection of GProx II cards and false detection of other cards as GProx II * Fix incorrect parity starting bit Co-authored-by: あく <alleteam@gmail.com>
1 parent 8caa861 commit 3c75356

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/lfrfid/protocols/protocol_gproxii.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ void protocol_gproxii_free(ProtocolGProxII* protocol) {
3939
}
4040

4141
uint8_t* protocol_gproxii_get_data(ProtocolGProxII* proto) {
42-
return proto->data;
42+
return proto->decoded_data;
4343
}
4444

4545
void protocol_gproxii_decoder_start(ProtocolGProxII* protocol) {
4646
memset(protocol->data, 0, GPROXII_ENCODED_BYTE_FULL_SIZE);
47+
memset(protocol->decoded_data, 0, GPROXII_DATA_SIZE);
4748
protocol->last_short = false;
4849
}
4950

@@ -88,8 +89,9 @@ static bool protocol_gproxii_can_be_decoded(ProtocolGProxII* protocol) {
8889
if(bit_lib_get_bits(protocol->data, 0, 6) != 0b111110) return false;
8990

9091
// Check always 0 parity on every 5th bit after preamble
91-
if(bit_lib_test_parity(protocol->data, 5, GPROXII_ENCODED_BIT_SIZE, BitLibParityAlways0, 5))
92+
if(!bit_lib_test_parity(protocol->data, 6, GPROXII_ENCODED_BIT_SIZE, BitLibParityAlways0, 5)) {
9293
return false;
94+
}
9395

9496
// Start GProx II decode
9597
bit_lib_copy_bits(protocol->decoded_data, 0, GPROXII_ENCODED_BIT_SIZE, protocol->data, 6);

0 commit comments

Comments
 (0)