diff options
author | David Chiu <david.chiu@tw.synaptics.com> | 2020-11-20 17:16:16 +0800 |
---|---|---|
committer | Vincent Huang <vincenthsw@gmail.com> | 2020-11-20 17:39:03 +0800 |
commit | 47a49a5d6bbdf7b60f55639fcb915bcaacd7fce5 (patch) | |
tree | 764b037af0aa62448eade4f6492511249d8cee5b | |
parent | 5cb14058c133df217ac1597f33b0eb372b5d7c37 (diff) | |
download | rmi4utils-47a49a5d6bbdf7b60f55639fcb915bcaacd7fce5.tar.gz |
Change path name for i2c_hid to i2c_hid_acpi according to patch on 2020/11, and also need backward compatible.
-rwxr-xr-x | rmidevice/hiddevice.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/rmidevice/hiddevice.cpp b/rmidevice/hiddevice.cpp index 89bc93c..8405b88 100755 --- a/rmidevice/hiddevice.cpp +++ b/rmidevice/hiddevice.cpp @@ -749,9 +749,10 @@ void HIDDevice::RebindDriver() } } - + bindFile = m_driverPath + "bind"; unbindFile = m_driverPath + "unbind"; + Sleep(500); if (!WriteDeviceNameToFile(unbindFile.c_str(), m_transportDeviceName.c_str())) { fprintf(stderr, "Failed to unbind HID device %s: %s\n", @@ -787,7 +788,15 @@ bool HIDDevice::FindTransportDevice(uint32_t bus, std::string & hidDeviceName, if (bus == BUS_I2C) { devicePrefix += "i2c/"; - driverPath = devicePrefix + "drivers/i2c_hid/"; + // From new patch released on 2020/11, i2c_hid would be renamed as i2c_hid_acpi, + // and also need backward compatible. + std::string driverPathTemp = devicePrefix + "drivers/i2c_hid/"; + DIR *driverPathtest = opendir(driverPathTemp.c_str()); + if(!driverPathtest) { + driverPath = devicePrefix + "drivers/i2c_hid_acpi/"; + } else { + driverPath = devicePrefix + "drivers/i2c_hid/"; + } } else { devicePrefix += "usb/"; driverPath = devicePrefix + "drivers/usbhid/"; |