diff options
Diffstat (limited to 'fingerprint/fingerprint.c')
-rw-r--r-- | fingerprint/fingerprint.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/fingerprint/fingerprint.c b/fingerprint/fingerprint.c index 6405e26..278b431 100644 --- a/fingerprint/fingerprint.c +++ b/fingerprint/fingerprint.c @@ -27,19 +27,22 @@ */ #define LOG_TAG "FingerprintHal" +#include <cutils/log.h> +#include <hardware/hardware.h> +#include <hardware/fingerprint.h> +#include <system/qemu_pipe.h> + #include <errno.h> #include <endian.h> #include <inttypes.h> #include <malloc.h> +#include <poll.h> +#include <stdbool.h> +#include <stdlib.h> #include <string.h> -#include <cutils/log.h> -#include <hardware/hardware.h> -#include <hardware/fingerprint.h> -#include <hardware/qemud.h> -#include <poll.h> -#define FINGERPRINT_LISTEN_SERVICE_NAME "fingerprintlisten" +#define FINGERPRINT_LISTEN_SERVICE_NAME "pipe:qemud:fingerprintlisten" #define FINGERPRINT_FILENAME "emufp.bin" #define AUTHENTICATOR_ID_FILENAME "emuauthid.bin" #define MAX_COMM_CHARS 128 @@ -659,7 +662,7 @@ static void* listenerFunction(void* data) { qemu_fingerprint_device_t* qdev = (qemu_fingerprint_device_t*)data; pthread_mutex_lock(&qdev->lock); - qdev->qchanfd = qemud_channel_open(FINGERPRINT_LISTEN_SERVICE_NAME); + qdev->qchanfd = qemu_pipe_open(FINGERPRINT_LISTEN_SERVICE_NAME); if (qdev->qchanfd < 0) { ALOGE("listener cannot open fingerprint listener service exit"); pthread_mutex_unlock(&qdev->lock); @@ -668,8 +671,9 @@ static void* listenerFunction(void* data) { qdev->listener.state = STATE_IDLE; pthread_mutex_unlock(&qdev->lock); - const char* cmd = "listen"; - if (qemud_channel_send(qdev->qchanfd, cmd, strlen(cmd)) < 0) { + static const char kListenCmd[] = "listen"; + size_t kListenCmdSize = sizeof(kListenCmd) - 1U; + if (qemu_pipe_frame_send(qdev->qchanfd, kListenCmd, kListenCmdSize) < 0) { ALOGE("cannot write fingerprint 'listen' to host"); goto done_quiet; } @@ -724,8 +728,8 @@ static void* listenerFunction(void* data) { } // Shouldn't block since we were just notified of a POLLIN event - if ((size = qemud_channel_recv(qdev->qchanfd, buffer, - sizeof(buffer) - 1)) > 0) { + if ((size = qemu_pipe_frame_recv(qdev->qchanfd, buffer, + sizeof(buffer) - 1)) > 0) { buffer[size] = '\0'; if (sscanf(buffer, "on:%d", &fid) == 1) { if (fid > 0 && fid <= MAX_FID_VALUE) { |