aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Duggan <aduggan@synaptics.com>2015-05-07 10:35:45 -0700
committerAndrew Duggan <aduggan@synaptics.com>2015-05-07 10:35:45 -0700
commitf2e021fd2d2411e5aa704bf314558ddcf199a2b7 (patch)
tree84579c9d2118448154857d6f57977345ae4d4d61
parent2c24adb818ca0dfc83e93e2f5c80442495a15b19 (diff)
downloadplatform_external_rmi4utils-f2e021fd2d2411e5aa704bf314558ddcf199a2b7.tar.gz
platform_external_rmi4utils-f2e021fd2d2411e5aa704bf314558ddcf199a2b7.tar.bz2
platform_external_rmi4utils-f2e021fd2d2411e5aa704bf314558ddcf199a2b7.zip
Rebind the driver when switching between bootloader and UI in case the size of input reports changed
If the firmware configuration has changed then the size of input reports between the bootloader and the UI may be different. Forcing a rebind of the driver when switching modes will update the transport drivers of the new input report size.
-rw-r--r--rmi4update/rmi4update.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/rmi4update/rmi4update.cpp b/rmi4update/rmi4update.cpp
index 7217701..ffb9445 100644
--- a/rmi4update/rmi4update.cpp
+++ b/rmi4update/rmi4update.cpp
@@ -205,6 +205,7 @@ int RMI4Update::UpdateFirmware(bool force, bool performLockdown)
fprintf(stdout, "Done writing config, time: %lld us.\n", duration_us);
}
m_device.Reset();
+ m_device.RebindDriver();
return UPDATE_SUCCESS;
@@ -377,7 +378,9 @@ int RMI4Update::EnterFlashProgramming()
if (rc < 0)
return UPDATE_FAIL_ENABLE_FLASH_PROGRAMMING;
- rc = WaitForIdle(RMI_F34_ENABLE_WAIT_MS);
+ Sleep(RMI_F34_ENABLE_WAIT_MS);
+ m_device.RebindDriver();
+ rc = WaitForIdle(0);
if (rc != UPDATE_SUCCESS)
return UPDATE_FAIL_NOT_IN_IDLE_STATE;
@@ -465,19 +468,21 @@ int RMI4Update::WaitForIdle(int timeout_ms)
int rc;
struct timeval tv;
- tv.tv_sec = timeout_ms / 1000;
- tv.tv_usec = (timeout_ms % 1000) * 1000;
-
- rc = m_device.WaitForAttention(&tv, m_f34.GetInterruptMask());
- if (rc == -ETIMEDOUT)
- /*
- * If for some reason we are not getting attention reports for HID devices
- * then we can still continue after the timeout and read F34 status
- * but if we have to wait for the timeout to ellapse everytime then this
- * will be slow. If this message shows up a lot then something is wrong
- * with receiving attention reports and that should be fixed.
- */
- fprintf(stderr, "Timed out waiting for attn report\n");
+ if (timeout_ms > 0) {
+ tv.tv_sec = timeout_ms / 1000;
+ tv.tv_usec = (timeout_ms % 1000) * 1000;
+
+ rc = m_device.WaitForAttention(&tv, m_f34.GetInterruptMask());
+ if (rc == -ETIMEDOUT)
+ /*
+ * If for some reason we are not getting attention reports for HID devices
+ * then we can still continue after the timeout and read F34 status
+ * but if we have to wait for the timeout to ellapse everytime then this
+ * will be slow. If this message shows up a lot then something is wrong
+ * with receiving attention reports and that should be fixed.
+ */
+ fprintf(stderr, "Timed out waiting for attn report\n");
+ }
rc = ReadF34Controls();
if (rc != UPDATE_SUCCESS)