From d7162912e6da57cd046545fecf4e26eb4e281290 Mon Sep 17 00:00:00 2001 From: Hyungwoo Yang Date: Mon, 27 Feb 2023 07:10:40 +0000 Subject: touch/novatek: stylus info handling on normal fairing Sometimes, even with the only one stylus, we see normal pairing happening instead of fast pairing. This removes the stylus information maintained in the driver and the UI platform cannot shows the stylus information until the driver collects the same information again. This patch, when there's normal pairing, compares new HASH ID with the one from the previous stylus. The driver removes the stylus information only when the HASH ID is changed. Bug: 259261326 Change-Id: I1cda091a3455d8e7adcdecfeeded5de69bbece5d Signed-off-by: Hyungwoo Yang --- nt36xxx/nt36xxx.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nt36xxx/nt36xxx.c b/nt36xxx/nt36xxx.c index ea24edb..ab7d104 100644 --- a/nt36xxx/nt36xxx.c +++ b/nt36xxx/nt36xxx.c @@ -1591,8 +1591,14 @@ static void process_usi_responses(uint16_t info_buf_flags, const uint8_t *info_b } } - if (info_buf_flags & USI_NORMAL_PAIR_FLAG) - nvt_usi_clear_stylus_read_map(); + if (info_buf_flags & USI_NORMAL_PAIR_FLAG) { + uint8_t hash_id[2] = {0}; + + /* clear stylus info map if the HASH ID is not available or not matched */ + if (nvt_usi_get_hash_id(hash_id) || hash_id[0] != *(info_buf + USI_HASH_ID_OFFSET) || + hash_id[1] != *(info_buf + USI_HASH_ID_OFFSET + 1)) + nvt_usi_clear_stylus_read_map(); + } if (info_buf_flags & USI_BATTERY_FLAG) { nvt_usi_store_battery(info_buf + USI_BATTERY_OFFSET); -- cgit v1.2.3