Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | * AuthenTec AES4000 driver for libfprint | ||
3 | * | ||
4 | * AES4000 is a press-typed sensor, which captures image in 96x96 | ||
5 | * pixels. | ||
6 | * | ||
7 | * This work is derived from Daniel Drake's AES4000 driver. | ||
8 | * | ||
9 | * Copyright (C) 2013 Juvenn Woo <machese@gmail.com> | ||
10 | * Copyright (C) 2007-2008 Daniel Drake <dsd@gentoo.org> | ||
11 | * | ||
12 | * This library is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU Lesser General Public | ||
14 | * License as published by the Free Software Foundation; either | ||
15 | * version 2.1 of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This library is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
20 | * Lesser General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU Lesser General Public | ||
23 | * License along with this library; if not, write to the Free Software | ||
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
25 | */ | ||
26 | |||
27 | #define FP_COMPONENT "aes4000" | ||
28 | |||
29 | #include "aes3k.h" | ||
30 | |||
31 | #define DATA_BUFLEN 0x1259 | ||
32 | |||
33 | /* image size = FRAME_WIDTH x FRAME_WIDTH */ | ||
34 | #define FRAME_WIDTH 96 | ||
35 | #define FRAME_SIZE (FRAME_WIDTH * AES3K_FRAME_HEIGHT / 2) | ||
36 | #define FRAME_NUMBER (FRAME_WIDTH / AES3K_FRAME_HEIGHT) | ||
37 | #define ENLARGE_FACTOR 3 | ||
38 | |||
39 | |||
40 | static struct aes_regwrite init_reqs[] = { | ||
41 | /* master reset */ | ||
42 | { 0x80, 0x01 }, | ||
43 | { 0, 0 }, | ||
44 | { 0x80, 0x00 }, | ||
45 | { 0, 0 }, | ||
46 | |||
47 | { 0x81, 0x00 }, | ||
48 | { 0x80, 0x00 }, | ||
49 | { 0, 0 }, | ||
50 | |||
51 | /* scan reset */ | ||
52 | { 0x80, 0x02 }, | ||
53 | { 0, 0 }, | ||
54 | { 0x80, 0x00 }, | ||
55 | { 0, 0 }, | ||
56 | |||
57 | /* disable register buffering */ | ||
58 | { 0x80, 0x04 }, | ||
59 | { 0, 0 }, | ||
60 | { 0x80, 0x00 }, | ||
61 | { 0, 0 }, | ||
62 | |||
63 | { 0x81, 0x00 }, | ||
64 | { 0, 0 }, | ||
65 | /* windows driver reads registers now (81 02) */ | ||
66 | { 0x80, 0x00 }, | ||
67 | { 0x81, 0x00 }, | ||
68 | |||
69 | /* set excitation bias current: 2mhz drive ring frequency, | ||
70 | * 4V drive ring voltage, 16.5mA excitation bias */ | ||
71 | { 0x82, 0x04 }, | ||
72 | |||
73 | /* continuously sample drive ring for finger detection, | ||
74 | * 62.50ms debounce delay */ | ||
75 | { 0x83, 0x13 }, | ||
76 | |||
77 | { 0x84, 0x07 }, /* set calibration resistance to 12 kiloohms */ | ||
78 | { 0x85, 0x3d }, /* set calibration capacitance */ | ||
79 | { 0x86, 0x03 }, /* detect drive voltage */ | ||
80 | { 0x87, 0x01 }, /* set detection frequency to 125khz */ | ||
81 | { 0x88, 0x02 }, /* set column scan period */ | ||
82 | { 0x89, 0x02 }, /* set measure drive */ | ||
83 | { 0x8a, 0x33 }, /* set measure frequency and sense amplifier bias */ | ||
84 | { 0x8b, 0x33 }, /* set matrix pattern */ | ||
85 | { 0x8c, 0x0f }, /* set demodulation phase 1 */ | ||
86 | { 0x8d, 0x04 }, /* set demodulation phase 2 */ | ||
87 | { 0x8e, 0x23 }, /* set sensor gain */ | ||
88 | { 0x8f, 0x07 }, /* set image parameters */ | ||
89 | { 0x90, 0x00 }, /* carrier offset null */ | ||
90 | { 0x91, 0x1c }, /* set A/D reference high */ | ||
91 | { 0x92, 0x08 }, /* set A/D reference low */ | ||
92 | { 0x93, 0x00 }, /* set start row to 0 */ | ||
93 | { 0x94, 0x05 }, /* set end row to 5 */ | ||
94 | { 0x95, 0x00 }, /* set start column to 0 */ | ||
95 | { 0x96, 0x18 }, /* set end column to 24*4=96 */ | ||
96 | { 0x97, 0x04 }, /* data format and thresholds */ | ||
97 | { 0x98, 0x28 }, /* image data control */ | ||
98 | { 0x99, 0x00 }, /* disable general purpose outputs */ | ||
99 | { 0x9a, 0x0b }, /* set initial scan state */ | ||
100 | { 0x9b, 0x00 }, /* clear challenge word bits */ | ||
101 | { 0x9c, 0x00 }, /* clear challenge word bits */ | ||
102 | { 0x9d, 0x09 }, /* set some challenge word bits */ | ||
103 | { 0x9e, 0x53 }, /* clear challenge word bits */ | ||
104 | { 0x9f, 0x6b }, /* set some challenge word bits */ | ||
105 | { 0, 0 }, | ||
106 | }; | ||
107 | |||
108 | static struct aes_regwrite capture_reqs[] = { | ||
109 | { 0x80, 0x00 }, | ||
110 | { 0x81, 0x00 }, | ||
111 | { 0, 0 }, | ||
112 | { 0x81, 0x04 }, | ||
113 | { 0, 0 }, | ||
114 | { 0x81, 0x00 }, | ||
115 | }; | ||
116 | |||
117 | struct _FpiDeviceAes4000 | ||
118 | { | ||
119 | FpiDeviceAes3k parent; | ||
120 | }; | ||
121 | G_DECLARE_FINAL_TYPE (FpiDeviceAes4000, fpi_device_aes4000, FPI, | ||
122 | DEVICE_AES4000, FpiDeviceAes3k); | ||
123 |
4/5✓ Branch 0 taken 120 times.
✓ Branch 1 taken 24 times.
✓ Branch 2 taken 120 times.
✓ Branch 3 taken 120 times.
✗ Branch 4 not taken.
|
768 | G_DEFINE_TYPE (FpiDeviceAes4000, fpi_device_aes4000, FPI_TYPE_DEVICE_AES3K); |
124 | |||
125 | |||
126 | static const FpIdEntry id_table[] = { | ||
127 | { .vid = 0x08ff, .pid = 0x5501 }, | ||
128 | { .vid = 0, .pid = 0, .driver_data = 0 }, | ||
129 | }; | ||
130 | |||
131 | static void | ||
132 | ✗ | fpi_device_aes4000_init (FpiDeviceAes4000 *self) | |
133 | { | ||
134 | ✗ | } | |
135 | |||
136 | static void | ||
137 | 120 | fpi_device_aes4000_class_init (FpiDeviceAes4000Class *klass) | |
138 | { | ||
139 | 120 | FpDeviceClass *dev_class = FP_DEVICE_CLASS (klass); | |
140 | 120 | FpImageDeviceClass *img_class = FP_IMAGE_DEVICE_CLASS (klass); | |
141 | 120 | FpiDeviceAes3kClass *aes_class = FPI_DEVICE_AES3K_CLASS (klass); | |
142 | |||
143 | 120 | dev_class->id = "aes4000"; | |
144 | 120 | dev_class->full_name = "AuthenTec AES4000"; | |
145 | 120 | dev_class->id_table = id_table; | |
146 | |||
147 | 120 | img_class->img_height = FRAME_WIDTH * ENLARGE_FACTOR; | |
148 | 120 | img_class->img_width = FRAME_WIDTH * ENLARGE_FACTOR; | |
149 | |||
150 | 120 | aes_class->data_buflen = DATA_BUFLEN; | |
151 | 120 | aes_class->frame_width = FRAME_WIDTH; | |
152 | 120 | aes_class->frame_size = FRAME_SIZE; | |
153 | 120 | aes_class->frame_number = FRAME_NUMBER; | |
154 | 120 | aes_class->enlarge_factor = ENLARGE_FACTOR; | |
155 | 120 | aes_class->init_reqs = init_reqs; | |
156 | 120 | aes_class->init_reqs_len = G_N_ELEMENTS (init_reqs); | |
157 | 120 | aes_class->capture_reqs = capture_reqs; | |
158 | 120 | aes_class->capture_reqs_len = G_N_ELEMENTS (capture_reqs); | |
159 | } | ||
160 |