Reject implausible state nibble in waveman (#3611)

Real captures (tests/waveman) show the state nibble is always exactly
0xe (ON) or 0x6 (OFF); the code previously treated any value other than
0xe as "OFF", silently accepting 14 of 16 possible nibble values as a
false decode. Reject anything but those two observed values instead.
This commit is contained in:
Benjamin Larsson
2026-07-16 23:00:11 +02:00
parent 3c2c0dcff2
commit 87beabe31c

View File

@@ -62,6 +62,14 @@ static int waveman_callback(r_device *decoder, bitbuffer_t *bitbuffer)
| ((b[i] & 0x01) ? 0x00 : 0x08);
}
// Only 0xe (ON) and 0x6 (OFF) are valid states in real captures; any other
// value was previously still accepted and reported as "OFF", silently
// letting 14 of 16 possible nibble values through as a false decode.
if (nb[2] != 0xe && nb[2] != 0x6) {
decoder_logf(decoder, 2, __func__, "implausible state nibble: %x", nb[2]);
return DECODE_FAIL_SANITY;
}
id_str[0] = 'A' + nb[0];
id_str[1] = '\0';