Skip to content

Commit a51c653

Browse files
authored
Create goodix.h
1 parent 6129a4f commit a51c653

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
* Goodix 5110 driver for libfprint
3+
*
4+
* Copyright (C) 2021 Alexander Meiler <[email protected]>
5+
*
6+
* This library is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Lesser General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 2.1 of the License, or (at your option) any later version.
10+
*
11+
* This library is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public
17+
* License along with this library; if not, write to the Free Software
18+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19+
*/
20+
21+
#pragma once
22+
23+
#include <glib.h>
24+
#include <stdint.h>
25+
#include <openssl/ssl.h>
26+
27+
#define GOODIX_VEND_ID 0x27c6
28+
29+
#define GOODIX_CMD_LEN 64
30+
#define GOODIX_EP_CMD_OUT 0x1
31+
#define GOODIX_EP_CMD_IN 0x81
32+
33+
// Needed for commands which don't send an answer back (currently known only NOP)
34+
#define GOODIX_CMD_SKIP_READ -1
35+
36+
// 10 seconds USB read timeout
37+
#define GOODIX_CMD_TIMEOUT 10000
38+
39+
#define GOODIX_FIRMWARE_VERSION_SUPPORTED "GF_ST411SEC_APP_12109"
40+
41+
struct goodix_cmd
42+
{
43+
uint8_t cmd[64];
44+
int response_len;
45+
int response_len_2;
46+
};
47+
48+
static const struct goodix_cmd nop = {
49+
.cmd = {0xA0, 0x08, 0x00, 0xA8, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA5},
50+
.response_len = GOODIX_CMD_SKIP_READ,
51+
};
52+
53+
static const struct goodix_cmd enable_chip = {
54+
.cmd = {0xA0, 0X06, 0x00, 0xA6, 0x96, 0x03, 0x00, 0x01, 0x00, 0x10},
55+
.response_len = 10,
56+
};
57+
58+
static const struct goodix_cmd read_fw = {
59+
.cmd = {0xA0, 0x06, 0x00, 0xA6, 0xA8, 0x03, 0x00, 0x00, 0x00, 0xFF},
60+
.response_len = 10,
61+
.response_len_2 = 30,
62+
};
63+
64+
G_DECLARE_FINAL_TYPE (FpiDeviceGoodixTLS, fpi_device_goodixtls, FPI, DEVICE_GOODIXTLS,
65+
FpImageDevice);
66+
67+
// VID=0 PID=0 is needed for termination
68+
static const FpIdEntry goodix_id_table[] = {
69+
{.vid = GOODIX_VEND_ID, .pid = 0x5110, .driver_data = 0},
70+
{.vid = 0, .pid = 0, .driver_data = 0},
71+
};
72+
73+
static void goodix_dev_reset_state (FpiDeviceGoodixTLS *goodixdev);
74+
static void goodix_cmd_cb (FpiUsbTransfer *transfer, FpDevice *dev, gpointer user_data, GError *error);

0 commit comments

Comments
 (0)