From b8e97e56c30fe37df5d01b071701a05f88de4ca4 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Thu, 3 Oct 2019 13:54:52 +0100 Subject: [PATCH] synaptics-rmi: Speed up reading the PDT from 900ms to 30ms Don't continue to scan pages after the last function. --- plugins/synaptics-rmi/fu-synaptics-rmi-device.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/synaptics-rmi/fu-synaptics-rmi-device.c b/plugins/synaptics-rmi/fu-synaptics-rmi-device.c index 6a8a515aa..4cfc96926 100644 --- a/plugins/synaptics-rmi/fu-synaptics-rmi-device.c +++ b/plugins/synaptics-rmi/fu-synaptics-rmi-device.c @@ -394,6 +394,7 @@ fu_synaptics_rmi_device_scan_pdt (FuSynapticsRmiDevice *self, GError **error) /* scan pages */ for (guint page = 0; page < RMI_DEVICE_MAX_PAGE; page++) { + gboolean found = FALSE; guint32 page_start = RMI_DEVICE_PAGE_SIZE * page; guint32 pdt_start = page_start + RMI_DEVICE_PAGE_SCAN_START; guint32 pdt_end = page_start + RMI_DEVICE_PAGE_SCAN_END; @@ -418,7 +419,10 @@ fu_synaptics_rmi_device_scan_pdt (FuSynapticsRmiDevice *self, GError **error) break; interrupt_count += func->interrupt_source_count; g_ptr_array_add (priv->functions, g_steal_pointer (&func)); + found = TRUE; } + if (!found) + break; } /* see docs */