diff options
author | Benjamin Berg <bberg@redhat.com> | 2021-02-05 16:09:24 +0100 |
---|---|---|
committer | Benjamin Berg <bberg@redhat.com> | 2021-02-05 16:09:24 +0100 |
commit | 966703057d6424f89bdf1fce29dfc916a607a3cd (patch) | |
tree | 745931f9544b1cabefd48efd75e314c4f7cff51d | |
parent | 9e164485f037edb0367461a3638e74d5107b78b3 (diff) |
synaptics: Fix lost messages when sequence counter overflows
The device will always use sequence number 0 for certain messages. We
use this knowledge to filter the messages and assume that it is one of
these special messages rather than a response to a command.
However, we could end up sending a command with a sequence counter of 0
which would result in the response being ignored. Fix this by ensuring
we correctly wrap from 255 to 1 instead of 0.
Fixes: #358
-rw-r--r-- | libfprint/drivers/synaptics/synaptics.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libfprint/drivers/synaptics/synaptics.c b/libfprint/drivers/synaptics/synaptics.c index b4711fa..b2db9bd 100644 --- a/libfprint/drivers/synaptics/synaptics.c +++ b/libfprint/drivers/synaptics/synaptics.c @@ -348,7 +348,7 @@ synaptics_sensor_cmd (FpiDeviceSynaptics *self, * may only be a cancellation currently). */ if (seq_num <= 0) { - self->last_seq_num = MAX (1, self->last_seq_num + 1); + self->last_seq_num = MAX (1, (self->last_seq_num + 1) & 0xff); real_seq_num = self->last_seq_num; if (seq_num == 0) self->cmd_seq_num = self->last_seq_num; |