klte-common: fingerprint: fix missing sensor_init()

vcs_stop_auth_session() was called invoking qseecom securefp app without
first calling sensor_init(). That crashes soft-reboot.

Add some more other robustness too and close the fd.

Change-Id: I586139f52d3dc841b8960e1de8c50d596e98d210
This commit is contained in:
Andrea Arcangeli 2017-07-26 16:38:45 +02:00 committed by Kevin F. Haggerty
parent 3ec82b7254
commit a984faaba1
1 changed files with 10 additions and 0 deletions

View File

@ -633,8 +633,11 @@ static int fingerprint_close(hw_device_t* device) {
vcs_fingerprint_device_t* vdev = (vcs_fingerprint_device_t*)device;
fingerprint_cancel(&vdev->device);
pthread_mutex_lock(&vdev->lock);
db_uninit(vdev);
sensor_init();
vcs_init();
vcs_stop_auth_session();
vcs_uninit();
@ -646,6 +649,12 @@ static int fingerprint_close(hw_device_t* device) {
pthread_mutex_destroy(&tz.lock);
pthread_mutex_destroy(&tz.timeout.lock);
free(vdev);
vdev = NULL;
if (close(sensor.fd) < 0) {
ALOGE("Close sensor error!");
}
sensor.fd = -1;
return 0;
}
@ -693,6 +702,7 @@ static int fingerprint_open(const hw_module_t* module, const char __unused *id,
pthread_mutex_init(&tz.timeout.lock, NULL);
pthread_cond_init(&tz.timeout.cond, NULL);
pthread_cond_init(&sensor.cond, NULL);
sensor.signal = false;
tz.timeout.timeout_thread = 0;
*device = &vdev->device.common;