Commit 575a483b authored by Huang Vincent's avatar Huang Vincent

Add Synaptics driver

parent 3cbc908a
Pipeline #30164 passed with stages
in 7 minutes and 5 seconds
......@@ -26,6 +26,7 @@ private_headers = [
'vfs301_proto_fragments.h',
'vfs301_proto.h',
'vfs5011_proto.h',
'synaptics.h',
# NBIS
'morph.h',
......
......@@ -42,6 +42,7 @@ enum {
VFS5011_ID = 19,
VFS0050_ID = 20,
ELAN_ID = 21,
SYNAPTICS_ID = 22,
};
#endif
This diff is collapsed.
/*
* Copyright (C) 2019 Synaptics Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _BMKT_INTERNAL_H_
#define _BMKT_INTERNAL_H_
#include "bmkt.h"
#include "bmkt_message.h"
#include "platform.h"
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
typedef enum
{
BYTE_ORDER_BIG = 0,
BYTE_ORDER_LITTLE = 1,
BYTE_ORDER_SENSOR = BYTE_ORDER_LITTLE,
} bmkt_byte_order_t;
uint32_t extract32(const uint8_t *buf, int *offset, bmkt_byte_order_t byte_order);
uint16_t extract16(const uint8_t *buf, int *offset, bmkt_byte_order_t byte_order);
uint8_t extract8(const uint8_t *buf, int *offset, bmkt_byte_order_t byte_order);
void encode32(uint32_t value, uint8_t *buf, int *offset, bmkt_byte_order_t byte_order);
void encode16(uint16_t value, uint8_t *buf, int *offset, bmkt_byte_order_t byte_order);
void encode8(uint8_t value, uint8_t *buf, int *offset, bmkt_byte_order_t byte_order);
#ifdef FULL_LOGGING
void print_buffer(uint8_t *buf, int len);
#endif
#endif /* _BMKT_INTERNAL_H_ */
\ No newline at end of file
/*
* Copyright (C) 2019 Synaptics Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef BMKT_MESSAGE_H_
#define BMKT_MESSAGE_H_
#include "bmkt_internal.h"
#define BMKT_MESSAGE_HEADER_ID 0xFE
#define BMKT_MESSAGE_HEADER_LEN (4)
#define BMKT_MESSAGE_CRC32_LEN (4)
#define BMKT_MESSAGE_HEADER_ID_FIELD 0
#define BMKT_MESSAGE_SEQ_NUM_FIELD 1
#define BMKT_MESSAGE_ID_FIELD 2
#define BMKT_MESSAGE_PAYLOAD_LEN_FIELD 3
#define BMKT_MESSAGE_PAYLOAD_FIELD 4
// Command messages
#define BMKT_CMD_CONTINUOUS_IMAGE_CAPTURE 0x01
#define BMKT_CMD_CONTINUOUS_IMAGE_CAPTURE_STOP 0x04
#define BMKT_CMD_SENSOR_MODULE_TEST 0x06
#define BMKT_CMD_SENSOR_MODULE_TEST_START 0x08
#define BMKT_CMD_NEXT_TEST_REPORT_CHUNK 0x0B
#define BMKT_CMD_FPS_INIT 0x11
#define BMKT_CMD_GET_FPS_MODE 0x21
#define BMKT_CMD_SET_SECURITY_LEVEL 0x31
#define BMKT_CMD_GET_SECURITY_LEVEL 0x34
#define BMKT_CMD_CANCEL_OP 0x41
#define BMKT_CMD_ENROLL_USER 0x51
#define BMKT_CMD_ENROLL_PAUSE 0x52
#define BMKT_CMD_ENROLL_RESUME 0x53
#define BMKT_CMD_ID_USER 0x61
#define BMKT_CMD_VERIFY_USER 0x65
#define BMKT_CMD_GET_TEMPLATE_RECORDS 0x71
#define BMKT_CMD_GET_NEXT_QUERY_RESPONSE 0x72
#define BMKT_CMD_GET_ENROLLED_FINGERS 0x73
#define BMKT_CMD_GET_DATABASE_CAPACITY 0x74
#define BMKT_CMD_DEL_USER_FP 0x81
#define BMKT_CMD_DEL_FULL_DB 0x84
#define BMKT_CMD_REPEAT_LAST_RSP 0x92
#define BMKT_CMD_POWER_DOWN_NOTIFY 0xA1
#define BMKT_CMD_GET_VERSION 0xB1
#define BMKT_CMD_DISABLE_PAIRING 0xC2
#define BMKT_CMD_QUERY_PAIRING 0xC5
#define BMKT_CMD_SENSOR_STATUS 0xD1
#define BMKT_CMD_ID_USER_IN_ORDER 0xE1
#define BMKT_CMD_ID_NEXT_USER 0xE3
#define BMKT_CMD_VERIFY_USER_IN_ORDER 0xF1
#define BMKT_CMD_VERIFY_FINGERS_IN_ORDER 0xF2
#define BMKT_CMD_GET_FINAL_RESULT 0xE4
#define BMKT_EVT_FINGER_REPORT 0x91
#define BMKT_EVT_FINGER_STATE_NOT_ON_SENSOR 0x00
#define BMKT_EVT_FINGER_STATE_ON_SENSOR 0x01
typedef struct bmkt_msg_resp
{
uint8_t msg_id;
uint8_t seq_num;
uint8_t payload_len;
uint8_t *payload;
int result;
} bmkt_msg_resp_t;
typedef struct bmkt_session_ctx
{
uint8_t seq_num;
bmkt_resp_cb_t resp_cb;
void *cb_ctx;
} bmkt_session_ctx_t;
int bmkt_compose_message(uint8_t *cmd, int *cmd_len, uint8_t msg_id, uint8_t seq_num,
uint8_t payload_size, uint8_t *payload);
int bmkt_parse_message_header(uint8_t *resp_buf, int resp_len, bmkt_msg_resp_t *msg_resp);
int bmkt_parse_message_payload(bmkt_msg_resp_t *msg_resp, bmkt_response_t *resp);
#endif /* BMKT_MESSAGE_H_ */
This diff is collapsed.
/*
* Copyright (C) 2019 Synaptics Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef CRC_H_
#define CRC_H_
#include <stdint.h>
uint32_t compute_crc32(uint8_t *data, uint8_t length, uint32_t prev_crc32);
enum checksum_crc_polynomial
{
CHECKSUM_CRC_POLY1, /* polynomial: 0xedb88320 */
CHECKSUM_CRC_POLY2 /* polynomial: 0x04c11db7 */
};
int crc_checksum(uint32_t initialValue, uint32_t *checksum, uint8_t *msg, uint32_t len, uint32_t poly);
#endif /* CRC_H_ */
\ No newline at end of file
/*
* Copyright (C) 2019 Synaptics Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _EVENT_H_
#define _EVENT_H_
#include "bmkt_internal.h"
int bmkt_event_init(bmkt_event_t *event);
int bmkt_event_set(bmkt_event_t *event);
int bmkt_event_wait(bmkt_event_t *event, int timeout);
int bmkt_event_try(bmkt_event_t *event);
int bmkt_event_clear(bmkt_event_t *event);
int bmkt_event_destroy(bmkt_event_t *event);
#endif /* _EVENT_H_ */
\ No newline at end of file
/*
* Copyright (C) 2019 Synaptics Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _MUTEX_H_
#define _MUTEX_H_
#include "bmkt_internal.h"
int bmkt_mutex_init(bmkt_mutex_t *mutex);
int bmkt_mutex_destroy(bmkt_mutex_t *mutex);
int bmkt_mutex_lock(bmkt_mutex_t *mutex);
int bmkt_mutex_unlock(bmkt_mutex_t *mutex);
#endif /* _MUTEX_H_ */
\ No newline at end of file
/*
* Copyright (C) 2019 Synaptics Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _PLATFORM_H_
#define _PLATFORM_H_
#include <stdio.h>
#include <string.h>
#include <semaphore.h>
#include <linux/limits.h>
#include "posix.h"
#include "event.h"
#include "plat_thread.h"
#include "thread.h"
int bmkt_log(const char *format, ...);
int bmkt_log_open(const char *log_file);
int bmkt_log_close(void);
#ifdef FULL_LOGGING
#define bmkt_dbg_log(format, ...) bmkt_log(format, ##__VA_ARGS__)
#define bmkt_info_log(format, ...) bmkt_log(format, ##__VA_ARGS__)
#define bmkt_warn_log(format, ...) bmkt_log(format, ##__VA_ARGS__)
#define bmkt_err_log(format, ...) bmkt_log(format, ##__VA_ARGS__)
#else
#define bmkt_dbg_log(format, ...)
#define bmkt_info_log(format, ...)
#define bmkt_warn_log(format, ...) bmkt_log(format, ##__VA_ARGS__)
#define bmkt_err_log(format, ...) bmkt_log(format, ##__VA_ARGS__)
#endif
typedef struct bmkt_event
{
sem_t event_sem;
} bmkt_event_t;
#endif /* _PLATFORM_H_ */
\ No newline at end of file
/*
* Copyright (C) 2019 Synaptics Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _PLAT_THREAD_H_
#define _PLAT_THREAD_H_
#include <pthread.h>
typedef struct plat_thread
{
pthread_t thread;
void *ctx;
} plat_thread_t;
#endif /* _PLAT_THREAD_H_ */
\ No newline at end of file
/*
* Copyright (C) 2019 Synaptics Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _POSIX_H_
#define _POSIX_H_
int bmkt_sleep(int ms);
void *bmkt_interrupt_thread(void *ctx);
typedef struct bmkt_mutex
{
pthread_mutex_t mutex;
} bmkt_mutex_t;
#endif /* _POSIX_H_ */
\ No newline at end of file
/*
* Copyright (C) 2019 Synaptics Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _SENSOR_H_
#define _SENSOR_H_
#include "transport.h"
#include "event.h"
#include "thread.h"
#define BMKT_MAX_PENDING_SESSIONS 2
typedef enum bmkt_sensor_state
{
BMKT_SENSOR_STATE_UNINIT = 0,
BMKT_SENSOR_STATE_IDLE,
BMKT_SENSOR_STATE_INIT,
BMKT_SENSOR_STATE_EXIT,
} bmkt_sensor_state_t;
typedef struct bmkt_sensor_drv bmkt_sensor_drv_t;
typedef struct bmkt_sensor_version
{
uint32_t build_time;
uint32_t build_num;
uint8_t version_major;
uint8_t version_minor;
uint8_t target;
uint8_t product;
uint8_t silicon_rev;
uint8_t formal_release;
uint8_t platform;
uint8_t patch;
uint8_t serial_number[6];
uint16_t security;
uint8_t iface;
uint8_t device_type;
} bmkt_sensor_version_t;
typedef struct bmkt_sensor
{
bmkt_transport_t xport;
bmkt_sensor_version_t version;
bmkt_session_ctx_t pending_sessions[BMKT_MAX_PENDING_SESSIONS];
int empty_session_idx;
int expect_response;
int flags;
int seq_num;
bmkt_event_t interrupt_event;
bmkt_sensor_state_t sensor_state;
bmkt_event_cb_t finger_event_cb;
void *finger_cb_ctx;
bmkt_general_error_cb_t gen_err_cb;
void *gen_err_cb_ctx;
#ifdef THREAD_SUPPORT
bmkt_thread_t interrupt_thread;
bmkt_mutex_t interrupt_mutex;
#endif /* THREAD_SUPPORT */
} bmkt_sensor_t;
int bmkt_sensor_open(bmkt_sensor_t *sensor, const bmkt_sensor_desc_t *desc,
bmkt_general_error_cb_t err_cb, void *err_cb_ctx);
int bmkt_sensor_close(bmkt_sensor_t *sensor);
int bmkt_sensor_init_fps(bmkt_sensor_t *sensor);
int bmkt_sensor_send_message(bmkt_sensor_t *sensor, uint8_t msg_id, uint8_t payload_size,
uint8_t *payload, bmkt_resp_cb_t resp_cb, void *resp_data);
int bmkt_sensor_send_message_sync(bmkt_sensor_t *sensor, uint8_t msg_id, uint8_t payload_size,
uint8_t *payload, uint8_t **resp_buf, int *resp_len, bmkt_response_t *resp);
int bmkt_sensor_handle_response(bmkt_sensor_t *sensor, uint8_t *resp_buf, int resp_len, bmkt_msg_resp_t *msg_resp);
int bmkt_sensor_handle_interrupt(bmkt_sensor_t *sensor);
int bmkt_sensor_process_pending_interrupts(bmkt_sensor_t *sensor);
#endif /* _SENSOR_H_ */
\ No newline at end of file
/*
* Copyright (C) 2019 Synaptics Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __synaptics_h__
#define __synaptics_h__
#define SYNAPTICS_VENDOR_ID 0x06cb
#define SYNAPTICS_PRODUCT_ID_A9 0x00a9
/* Number of enroll stages */
#define ENROLL_SAMPLES 8
#define SYNAPTICS_DRIVER_FULLNAME "Synaptics Sensors"
#include "bmkt.h"
#include "bmkt_response.h"
struct syna_enroll_resp_data
{
int progress;
};
typedef enum syna_state
{
SYNA_STATE_UNINIT = 0,
SYNA_STATE_IDLE ,
SYNA_STATE_ENROLL ,
SYNA_STATE_IDENTIFY ,
SYNA_STATE_IDENTIFY_DELAY_RESULT ,
SYNA_STATE_VERIFY ,
SYNA_STATE_VERIFY_DELAY_RESULT ,
} syna_state_t;
typedef struct synaptics_dev_s
{
void *hImage;
void *pEnrollData;
void *pCtx;
bmkt_ctx_t *ctx;
bmkt_sensor_desc_t sensor_desc;
bmkt_sensor_t *sensor;
bmkt_usb_config_t *usb_config;
struct syna_enroll_resp_data enroll_resp_data;
gboolean isFingerOnSensor;
syna_state_t state;
pthread_mutex_t op_mutex;
pthread_cond_t op_cond;
int op_finished;
GSList* file_gslist;
GSList* sensor_gslist;
}synaptics_dev;
#endif //__synaptics_h__
/*
* Copyright (C) 2019 Synaptics Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _THREAD_H_
#define _THREAD_H_
#include "plat_thread.h"
typedef enum
{
BMKT_THREAD_STATE_UNINITIALIZED = 0,
BMKT_THREAD_STATE_RUNNING,
BMKT_THREAD_STATE_FINISHED,
} bmkt_thread_state_t;
#ifdef WIN32
typedef DWORD(WINAPI *thread_func_t)(LPVOID lpThreadParameter);
#else
typedef void * (*thread_func_t)(void *ctx);
#endif
typedef struct bmkt_thread
{
bmkt_thread_state_t state;
plat_thread_t plat_thread;
} bmkt_thread_t;
int bmkt_thread_create(bmkt_thread_t *thread, thread_func_t fn, void *ctx);
int bmkt_thread_destroy(bmkt_thread_t *thread);
#endif /* _THREAD_H_ */
\ No newline at end of file
/*
* Copyright (C) 2019 Synaptics Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _TRANSPORT_H_
#define _TRANSPORT_H_
#include "bmkt_internal.h"
#ifdef THREAD_SUPPORT
#include "mutex.h"
#endif /* THREAD_SUPPORT */
#include "usb_transport.h"
#define BMKT_MAX_TRANSFER_LEN 263 + 1 /* SPI Header */ + 2 /* VCSFW header */
#define BMKT_XPORT_INT_NONE 0x0
#define BMKT_XPORT_INT_RESPONSE 0x1
#define BMKT_XPORT_INT_FINGER 0x2
#define BMKT_XPORT_INT_ASYNC 0x4
typedef struct bmkt_transport_drv bmkt_transport_drv_t;
typedef union
{
bmkt_usb_transport_t usb_xport;
} bmtk_transport_data_t;
typedef struct bmkt_transport
{
bmkt_transport_type_t xport_type;
bmkt_transport_config_t xport_config;
const bmkt_transport_drv_t *drv;
bmkt_sensor_t *sensor;
#ifdef THREAD_SUPPORT
bmkt_mutex_t transfer_buffer_mutex;
#endif /* THREAD_SUPPORT */
uint8_t transfer[BMKT_MAX_TRANSFER_LEN];
bmtk_transport_data_t xport_data;
} bmkt_transport_t;
struct bmkt_transport_drv
{
int (*open)(bmkt_transport_t *xport, const bmkt_transport_config_t *xport_config);
int (*close)(bmkt_transport_t *xport);
int (*send_command)(bmkt_transport_t *xport, int len);
int (*receive_response)(bmkt_transport_t *xport, int *len);
int (*send_command_sync)(bmkt_transport_t *xport, int len, uint8_t **resp_buf, int *resp_len);
int (*get_command_buffer)(bmkt_transport_t *xport, uint8_t **cmd, int *len);
int (*get_response_buffer)(bmkt_transport_t *xport, uint8_t **resp, int *len);
int (*reset)(bmkt_transport_t *xport);
int (*read_interrupt_status)(bmkt_transport_t *xport, int *interupt_mask);
};
int bmkt_transport_open(bmkt_transport_t *xport, bmkt_transport_type_t xport_type,
const bmkt_transport_config_t *config, bmkt_sensor_t *sensor);
int bmkt_transport_close(bmkt_transport_t *xport);
int bmkt_transport_get_command_buffer(bmkt_transport_t *xport, uint8_t **buf, int *len);
int bmkt_transport_release_command_buffer(bmkt_transport_t *xport);
int bmkt_transport_get_response_buffer(bmkt_transport_t *xport, uint8_t **resp, int *len);
int bmkt_transport_release_response_buffer(bmkt_transport_t *xport);
int bmkt_transport_send_command(bmkt_transport_t *xport, int len);
int bmkt_transport_send_command_sync(bmkt_transport_t *xport, int len, uint8_t **resp_buf, int *resp_len);
int bmkt_transport_receive_response(bmkt_transport_t *xport, int *len);
int bmkt_transport_read_interrupt_status(bmkt_transport_t *xport, int *interupt_mask);
#endif /* _TRANSPORT_H_ */
\ No newline at end of file
/*
* Copyright (C) 2019 Synaptics Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _USB_TRANSPORT_H_
#define _USB_TRANSPORT_H_
#include "libusb-1.0/libusb.h"
#include "thread.h"
#define USB_DEFAULT_CONFIGURATION 0
#define USB_DEFAULT_INTERFACE 0
#define USB_DEFAULT_ALT_SETTING 0
#define USB_EP_REQUEST 0x01
#define USB_EP_REPLY 0x81
#define USB_EP_FINGERPRINT 0x82
#define USB_EP_INTERRUPT 0x83
#define USB_INTERRUPT_DATA_SIZE 7