diff --git a/udfps/UdfpsHandler.cpp b/udfps/UdfpsHandler.cpp index 1e84f7bb5237761bb8200ad8adbc3cae52e0339d..6015840795953a551e6c30e87bdca8e3aefb96a2 100644 --- a/udfps/UdfpsHandler.cpp +++ b/udfps/UdfpsHandler.cpp @@ -80,14 +80,7 @@ class XiaomiUdfpsHander : public UdfpsHandler { continue; } - if (readBool(fd)) { - mDevice->extCmd(mDevice, COMMAND_NIT, PARAM_NIT_UDFPS); - set(FOD_STATUS_PATH, FOD_STATUS_ON); - } else { - mDevice->extCmd(mDevice, COMMAND_NIT, PARAM_NIT_NONE); - set(FOD_HBM_PATH, FOD_HBM_OFF); - set(FOD_STATUS_PATH, FOD_STATUS_OFF); - } + mDevice->extCmd(mDevice, COMMAND_NIT, readBool(fd) ? PARAM_NIT_UDFPS : PARAM_NIT_NONE); } }).detach(); } @@ -100,12 +93,22 @@ class XiaomiUdfpsHander : public UdfpsHandler { // nothing } - void onAcquired(int32_t /*result*/, int32_t /*vendorCode*/) { - // nothing + void onAcquired(int32_t result, int32_t vendorCode) { + if (result == FINGERPRINT_ACQUIRED_GOOD) { + set(FOD_HBM_PATH, FOD_HBM_OFF); + set(FOD_STATUS_PATH, FOD_STATUS_OFF); + } else if (vendorCode == 21 || vendorCode == 23) { + /* + * vendorCode = 21 waiting for fingerprint authentication + * vendorCode = 23 waiting for fingerprint enroll + */ + set(FOD_STATUS_PATH, FOD_STATUS_ON); + } } void cancel() { - // nothing + set(FOD_STATUS_PATH, FOD_STATUS_OFF); + set(FOD_HBM_PATH, FOD_HBM_OFF); } private: