diff options
author | david.chiu@tw.synaptics.com <david.chiu@tw.synaptics.com> | 2020-10-30 15:43:16 +0800 |
---|---|---|
committer | Vincent Huang <vincenthsw@gmail.com> | 2020-10-30 18:35:41 +0800 |
commit | 5cb14058c133df217ac1597f33b0eb372b5d7c37 (patch) | |
tree | 81e9004b8f0c770ac1e2b235db774e01aa00814e | |
parent | 81bddc486c188f888468b918097cb1b6f2f7926c (diff) | |
download | rmi4utils-5cb14058c133df217ac1597f33b0eb372b5d7c37.tar.gz |
Add a condition in HID descriptor for PTP, and let workaround of erasing before parsing necessary information be run for touch screen only.
-rwxr-xr-x | rmi4update/rmi4update.cpp | 22 | ||||
-rwxr-xr-x | rmidevice/hiddevice.cpp | 5 |
2 files changed, 15 insertions, 12 deletions
diff --git a/rmi4update/rmi4update.cpp b/rmi4update/rmi4update.cpp index 0eb6c7f..6eb2954 100755 --- a/rmi4update/rmi4update.cpp +++ b/rmi4update/rmi4update.cpp @@ -444,7 +444,7 @@ int RMI4Update::ReadFlashConfig() if (partition_temp) free(partition_temp); - + m_fwBlockCount = m_partitionCore ? m_partitionCore->partition_len : 0; m_configBlockCount = m_partitionConfig ? m_partitionConfig->partition_len : 0; m_guestBlockCount = m_partitionGuest ? m_partitionGuest->partition_len : 0; @@ -1141,17 +1141,17 @@ int RMI4Update::EnterFlashProgrammingV7() } else fprintf(stdout, "Already in BL mode, skip...\n"); - - // workaround - fprintf(stdout, "Erase in BL mode\n"); - rc = EraseFirmwareV7(); - if (rc != UPDATE_SUCCESS) { - fprintf(stderr, "%s: %s\n", __func__, update_err_to_string(rc)); - return UPDATE_FAIL_ERASE_ALL; - } - fprintf(stdout, "Erase in BL mode end\n"); - m_IsErased = true; + if(m_device.GetDeviceType() != RMI_DEVICE_TYPE_TOUCHPAD) { + // workaround for touchscreen only + fprintf(stdout, "Erase in BL mode\n"); + rc = EraseFirmwareV7(); + if (rc != UPDATE_SUCCESS) { + fprintf(stderr, "%s: %s\n", __func__, update_err_to_string(rc)); + return UPDATE_FAIL_ERASE_ALL; + } + fprintf(stdout, "Erase in BL mode end\n"); + } m_device.RebindDriver(); Sleep(RMI_F34_ENABLE_WAIT_MS); diff --git a/rmidevice/hiddevice.cpp b/rmidevice/hiddevice.cpp index 8cf778a..89bc93c 100755 --- a/rmidevice/hiddevice.cpp +++ b/rmidevice/hiddevice.cpp @@ -250,13 +250,16 @@ void HIDDevice::ParseReportDescriptor() // usage. if (m_deviceType == RMI_DEVICE_TYPE_TOUCHSCREEN) break; - + if (m_rptDesc.value[i + 1] == 0x01) { if (m_rptDesc.value[i + 2] == 0x09 && m_rptDesc.value[i + 3] == 0x02) m_deviceType = RMI_DEVICE_TYPE_TOUCHPAD; } else if (m_rptDesc.value[i + 1] == 0x0d) { if (m_rptDesc.value[i + 2] == 0x09 && m_rptDesc.value[i + 3] == 0x04) m_deviceType = RMI_DEVICE_TYPE_TOUCHSCREEN; + // for Precision Touch Pad + else if (m_rptDesc.value[i + 2] == 0x09 && m_rptDesc.value[i + 3] == 0x05) + m_deviceType = RMI_DEVICE_TYPE_TOUCHPAD; } i += 3; break; |