Compare commits

..

12 Commits

Author SHA1 Message Date
Saeed/Ali Rk (PesarAmmehZa)
0726462d3b Merge branch 'egiscalib' into 'master'
Draft: fix: calibration for egis0570

See merge request libfprint/libfprint!548
2025-10-28 13:50:04 +00:00
saeedark
05f7631023 chore: clean up 2025-10-28 17:18:58 +03:30
saeedark
2050902767 fix: calibration for egis0570 2025-10-26 21:00:35 +03:30
Benjamin Berg
7c97dcd985 device: Add API for perstistent data storage
API consumers should fetch the persistent data when they are done and
store it to disk. It is undefined when this data is updated by the
driver, but in general, it should only be updated once the first time
a device is used.
2025-10-22 20:27:30 +03:30
Danny
596b5f8032 fpcmoc: add 10a5:a306 fingerprint reader 2025-08-08 21:30:32 +02:00
Aris Lin
7f5304d6ee synaptics: add new PID 0x019F, 0x109 and 0x10A 2025-07-31 23:56:39 +00:00
Aris Lin
bde868f05e synaptics: add usb reset in probe to recover stall condition 2025-07-31 23:56:39 +00:00
Marco Trevisan (Treviño)
a7448fbb4a ci: Only run pages step on push events 2025-08-01 01:47:17 +02:00
Marco Trevisan (Treviño)
f84ab3d104 gcovr: Add gcovr project configuration
And mark suspicious hits as warnings instead of failures
2025-08-01 01:42:01 +02:00
Benjamin Berg
da42268911 goodixmoc: fix crash in exit callback handler
If the button shield command cannot be executed due to an underlying
error then resp is NULL. Avoid the crash by adding the appropriate
check.

Closes: #694
2025-07-24 08:39:54 +02:00
Benjamin Berg
d83a785260 ci: permit coverage failures for now
gcovr seems to fail for unclear reasons. Permit failures to not block
merge requests.
2025-07-23 19:09:54 +02:00
Jordan Petridis
2b100a912b ci: Pin the version of the Flatpak template
In [1] the template broke due to the inclusion of
a sub-include which doesn't resolve across different
gitlab instances without the same group setup.

Pin the template for now to the previous working commit

[1] https://gitlab.gnome.org/GNOME/citemplates/-/merge_requests/104#note_2501085
2025-07-23 19:09:04 +02:00
14 changed files with 1651 additions and 31 deletions

View File

@@ -4,7 +4,7 @@ include:
- project: 'freedesktop/ci-templates'
ref: master
file: '/templates/fedora.yml'
- remote: 'https://gitlab.gnome.org/GNOME/citemplates/-/raw/master/flatpak/flatpak_ci_initiative.yml'
- remote: 'https://gitlab.gnome.org/GNOME/citemplates/-/raw/71e636e012ae0ab04c5e0fe40ca73ada91ae6bde/flatpak/flatpak_ci_initiative.yml'
default:
# Auto-retry jobs in case of infra failures
@@ -88,7 +88,7 @@ test:
script:
- meson setup _build --werror -Ddrivers=all -Db_coverage=true
- meson test -C _build --print-errorlogs --no-stdsplit --timeout-multiplier 3
- ninja -C _build coverage
- ninja -C _build coverage || true
- cat _build/meson-logs/coverage.txt || true
artifacts:
reports:
@@ -293,4 +293,4 @@ pages:
paths:
- public
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push"

View File

@@ -184,6 +184,7 @@ usb:v2808pA78A*
# Supported by libfprint driver fpcmoc
usb:v10A5pFFE0*
usb:v10A5pA305*
usb:v10A5pA306*
usb:v10A5pDA04*
usb:v10A5pD805*
usb:v10A5pD205*
@@ -255,6 +256,8 @@ usb:v06CBp0104*
usb:v06CBp0106*
usb:v06CBp0107*
usb:v06CBp0108*
usb:v06CBp0109*
usb:v06CBp010A*
usb:v06CBp0123*
usb:v06CBp0124*
usb:v06CBp0126*
@@ -265,6 +268,7 @@ usb:v06CBp016C*
usb:v06CBp0173*
usb:v06CBp0174*
usb:v06CBp019D*
usb:v06CBp019F*
ID_AUTOSUSPEND=1
ID_PERSIST=0

View File

@@ -40,6 +40,8 @@ fp_device_has_feature
fp_device_has_storage
fp_device_supports_identify
fp_device_supports_capture
fp_device_get_persistent_data
fp_device_set_persistent_data
fp_device_is_open
fp_device_open
fp_device_close

1
gcovr.cfg Normal file
View File

@@ -0,0 +1 @@
gcov-ignore-parse-errors = suspicious_hits.warn

File diff suppressed because it is too large Load Diff

View File

@@ -18,10 +18,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "drivers_api.h"
#ifndef __EGIS0570_H
#define __EGIS0570_H 1
/*
* Device data
*/
@@ -54,6 +57,33 @@
#define EGIS0570_INIT_TOTAL (sizeof ((init_pkts)) / sizeof ((init_pkts[0])))
// static unsigned char init_pkts[][EGIS0570_PKTSIZE] =
// {
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x20, 0x3f },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x58, 0x3f },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x21, 0x09 },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x57, 0x09 },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x22, 0x03 },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x56, 0x03 },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x23, 0x01 },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x55, 0x01 },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x24, 0x01 },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x54, 0x01 },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x16, 0x3e },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x09, 0x0b },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x14, 0x03 },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x15, 0x00 },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x02, 0x0f },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x10, 0x00 },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x11, 0x38 },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x12, 0x00 },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x13, 0x71 },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x03, 0x80 },
// { 0x45, 0x47, 0x49, 0x53, 0x00, 0x02, 0x80 },
// { 0x45, 0x47, 0x49, 0x53, 0x01, 0x02, 0x2f },
// { 0x45, 0x47, 0x49, 0x53, 0x06, 0x00, 0xfe } /* image returned after this packet */
// };
static unsigned char init_pkts[][EGIS0570_PKTSIZE] =
{
{ 0x45, 0x47, 0x49, 0x53, 0x01, 0x20, 0x3f },
@@ -66,6 +96,8 @@ static unsigned char init_pkts[][EGIS0570_PKTSIZE] =
{ 0x45, 0x47, 0x49, 0x53, 0x01, 0x55, 0x01 },
{ 0x45, 0x47, 0x49, 0x53, 0x01, 0x24, 0x01 },
{ 0x45, 0x47, 0x49, 0x53, 0x01, 0x54, 0x01 },
{ 0x45, 0x47, 0x49, 0x53, 0x01, 0x25, 0x00 },
{ 0x45, 0x47, 0x49, 0x53, 0x01, 0x53, 0x00 },
{ 0x45, 0x47, 0x49, 0x53, 0x01, 0x16, 0x3e },
{ 0x45, 0x47, 0x49, 0x53, 0x01, 0x09, 0x0b },
{ 0x45, 0x47, 0x49, 0x53, 0x01, 0x14, 0x03 },
@@ -175,3 +207,386 @@ static unsigned char repeat_pkts[][EGIS0570_PKTSIZE] =
#define EGIS0570_RESIZE 2
#endif
// Calibration
enum driver_version {
PACKET_CALIBRATION,
PACKET_VERSION_1,
NONE,
};
#define PRESISTENT_DATA_LENGTH 9
#define EGIS0570_CAL_IMG_TOT 22 //124
#define EGIS0570_CAL_INPSIZE 6528
#define EGIS0570_CAL_BS_ELM 7
#define IMG_COL_IGNORE 23
#define TARGET_UPPER 80
#define TARGET_LOWER 70
// #define SIDE_DIFF (-10)
#define SIDE_DIFF (+5)
/* static pkts */
static guint8 EGIS0570_CAL_CONFIGURATION_MODE_PKT[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x01, 0x0d, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x0e, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x02, 0x1f},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x05, 0x08},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x03, 0xff}
};
static guint8 EGIS0570_CAL_PKT_ZERO_RANGE[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x01, 0x01, 0x10},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x02, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x03, 0x80},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x04, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x05, 0x08},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x06, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x07, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x08, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x09, 0x0a},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x0a, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x0b, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x0c, 0xff},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x0d, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x0e, 0x00}
};
static guint8 EGIS0570_CAL_CAPTURING_AREA[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x01, 0x10, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x11, 0x38},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x12, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x13, 0x71}
};
static guint8 EGIS0570_CAL_SENSOR_AND_EMITTER[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x01, 0x14, 0x15},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x15, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x16, 0x08}
};
static guint8 EGIS0570_CAL_WHITE_SETTING[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x01, 0x09, 0x0f},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x14, 0x3f},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x15, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x16, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x00, 0x02, 0x00}
};
static guint8 EGIS0570_CAL_BLACK_WHITE_GET_IMAGE[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x01, 0x02, 0x20},
{0x45, 0x47, 0x49, 0x53, 0x06, 0x00, 0x33}
};
static guint8 EGIS0570_CAL_BLACK_WHITE_AFTER_IMAGE[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x01, 0x02, 0x00}
};
static guint8 EGIS0570_CAL_BLACK_SETTING[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x01, 0x09, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x14, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x15, 0x03},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x16, 0xff},
{0x45, 0x47, 0x49, 0x53, 0x00, 0x02, 0xff}
};
static guint8 EGIS0570_CAL_BLACK_WHITE_CLEAR[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x01, 0x15, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x16, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x09, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x14, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x02, 0x0f},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x03, 0x80},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x09, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x14, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x15, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x16, 0x00}
};
static guint8 EGIS0570_CAL_MIDDLE_BLACK_SETTING[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x01, 0x09, 0x0a},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x15, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x16, 0x7f},
{0x45, 0x47, 0x49, 0x53, 0x00, 0x02, 0x7f},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x02, 0x2f}
};
static guint8 EGIS0570_CAL_GET_IMAGE[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x06, 0x00, 0x33}
};
static guint8 EGIS0570_CAL_AFTER_IMAGE[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x01, 0x02, 0x0f}
};
static guint8 EGIS0570_CAL_REPEAT[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x00, 0x02, 0x0f},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x02, 0x2f}
};
static guint8 EGIS0570_CAL_BORDER_WHITE_SETTING[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x01, 0x09, 0x0a},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x15, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x16, 0x3f},
{0x45, 0x47, 0x49, 0x53, 0x00, 0x02, 0x3f},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x02, 0x2f}
};
static guint8 EGIS0570_CAL_FIRST_BS_SETTING[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x01, 0x15, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x16, 0x00},
};
static guint8 EGIS0570_CAL_BEFORE_GET_IMAGE[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x01, 0x02, 0x2f}
};
static guint8 EGIS0570_CAL_NO_IMAGE_CAPTURING_AREA[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x01, 0x10, 0x1c},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x11, 0x1c},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x12, 0x31},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x13, 0x40}
};
static guint8 EGIS0570_CAL_NO_IMAGE_SETTING_0[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x01, 0x09, 0x05},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x14, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x15, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x16, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x08, 0x1c}
};
static guint8 EGIS0570_CAL_NO_IMAGE_BINARY_14_SETTING[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x01, 0x0b, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x0c, 0xff},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x0d, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x0e, 0xff},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x02, 0x1d},
{0x45, 0x47, 0x49, 0x53, 0x01, 0x04, 0x00}
};
static guint8 EGIS0570_CAL_NO_IMAGE_PRE_FIRST[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x01, 0x01, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x00, 0x01, 0x00}
};
static guint8 EGIS0570_CAL_NO_IMAGE_REQUEST[][EGIS0570_PKTSIZE] =
{
{0x45, 0x47, 0x49, 0x53, 0x01, 0x01, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x00, 0x01, 0x00},
{0x45, 0x47, 0x49, 0x53, 0x00, 0x01, 0x00}
};
#define EGIS0570_CAL_STATIC_LIST_SIZEOF (sizeof ((EGIS0570_CAL_STATIC_LIST)) / sizeof ((EGIS0570_CAL_STATIC_LIST[0])))
static guint8 * EGIS0570_CAL_STATIC_LIST[] = {
*EGIS0570_CAL_CONFIGURATION_MODE_PKT,
*EGIS0570_CAL_PKT_ZERO_RANGE,
*EGIS0570_CAL_CAPTURING_AREA,
*EGIS0570_CAL_SENSOR_AND_EMITTER,
*EGIS0570_CAL_WHITE_SETTING,
*EGIS0570_CAL_BLACK_WHITE_GET_IMAGE,
*EGIS0570_CAL_BLACK_WHITE_AFTER_IMAGE,
*EGIS0570_CAL_BLACK_SETTING,
*EGIS0570_CAL_BLACK_WHITE_CLEAR,
*EGIS0570_CAL_MIDDLE_BLACK_SETTING,
*EGIS0570_CAL_GET_IMAGE,
*EGIS0570_CAL_AFTER_IMAGE,
*EGIS0570_CAL_REPEAT,
*EGIS0570_CAL_BORDER_WHITE_SETTING,
*EGIS0570_CAL_FIRST_BS_SETTING,
*EGIS0570_CAL_BEFORE_GET_IMAGE,
*EGIS0570_CAL_NO_IMAGE_CAPTURING_AREA,
*EGIS0570_CAL_NO_IMAGE_SETTING_0,
*EGIS0570_CAL_NO_IMAGE_BINARY_14_SETTING,
*EGIS0570_CAL_NO_IMAGE_PRE_FIRST,
*EGIS0570_CAL_NO_IMAGE_REQUEST,
};
#define EGIS0570_HELPER_PKT_SIZEOF(x) (sizeof (x) / sizeof (x[0]))
static guint8 EGIS0570_CAL_STATIC_LIST_SIZE[] = {
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_CONFIGURATION_MODE_PKT),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_PKT_ZERO_RANGE),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_CAPTURING_AREA),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_SENSOR_AND_EMITTER),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_WHITE_SETTING),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_BLACK_WHITE_GET_IMAGE),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_BLACK_WHITE_AFTER_IMAGE),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_BLACK_SETTING),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_BLACK_WHITE_CLEAR),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_MIDDLE_BLACK_SETTING),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_GET_IMAGE),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_AFTER_IMAGE),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_REPEAT),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_BORDER_WHITE_SETTING),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_FIRST_BS_SETTING),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_BEFORE_GET_IMAGE),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_NO_IMAGE_CAPTURING_AREA),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_NO_IMAGE_SETTING_0),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_NO_IMAGE_BINARY_14_SETTING),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_NO_IMAGE_PRE_FIRST),
EGIS0570_HELPER_PKT_SIZEOF (EGIS0570_CAL_NO_IMAGE_REQUEST),
};
/* Calibration logic */
enum cal_proc_en {
CAL_CONF_PKT,
CAL_PKT_ZERO_RNG,
CAL_CAPT_AREA,
CAL_SENS_AND_EMIT,
CAL_RNG_20_58,
CAL_RNG_60_D0,
CAL_WHITE_SET,
CAL_BLACK_WHITE_GET_IMG,
CAL_BLACK_WHITE_AFTER_IMAGE,
CAL_BLACK_SET,
CAL_CHECK_BLACK_WHITE,
CAL_5_ROWS_ZEROS,
CAL_BLACK_WHITE_CLEAR,
CAL_RNG_60_D1,
CAL_MID_BLACK_SET,
CAL_GET_IMG,
CAL_AFTER_IMG,
CAL_GET_9,
CAL_BORDER_WHITE_SET,
CAL_FIRST_BS_SET,
CAL_BS_CHK_SET,
CAL_PKT_02,
CAL_BEFORE_IMG,
CAL_BS_JUMP,
CAL_BS_END,
CAL_PKT_15_0,
CAL_PKT_16_3C,
CAL_CHK_NEW_CONF,
CAL_GET_21,
CAL_NO_IMG_CAP_AREA,
CAL_NO_IMG_SET_0,
CAL_NO_IMG_03_1C,
CAL_NO_CHK_03_80,
CAL_NO_SET_03_80,
CAL_NO_IMG_14_BS_SET,
CAL_NO_IMG_14_BS_CHK_SET,
CAL_NO_IMG_PRE_FIRST,
CAL_NO_IMG_GET_8,
CAL_NO_IMG_14_BS_JUMP,
CAL_NO_IMG_14_BS_END,
CAL_NO_IMG_16_BS_SET,
CAL_NO_IMG_16_BS_CHK_SET_15,
CAL_NO_IMG_16_BS_SET_16,
CAL_NO_IMG_16_BS_JUMP,
CAL_NO_IMG_16_BS_END,
CAL_END,
};
#define EGIS0570_CAL_PROC_SIZEOF (sizeof ((calibration_procedure)) / sizeof ((calibration_procedure[0])))
static guint8 calibration_procedure[] = {
// conf
CAL_CONF_PKT,
// sensor check
CAL_PKT_ZERO_RNG,
CAL_CAPT_AREA,
CAL_SENS_AND_EMIT,
CAL_RNG_20_58,
CAL_RNG_60_D0,
CAL_WHITE_SET,
CAL_BLACK_WHITE_GET_IMG,
CAL_BLACK_WHITE_AFTER_IMAGE,
CAL_BLACK_SET,
CAL_BLACK_WHITE_GET_IMG,
CAL_BLACK_WHITE_AFTER_IMAGE,
CAL_CHECK_BLACK_WHITE,
// not binary 16
CAL_CAPT_AREA,
CAL_5_ROWS_ZEROS,
CAL_BLACK_WHITE_CLEAR,
CAL_RNG_20_58,
CAL_RNG_60_D1,
CAL_MID_BLACK_SET,
CAL_GET_IMG,
CAL_AFTER_IMG,
CAL_GET_9,
CAL_BORDER_WHITE_SET,
CAL_GET_IMG,
CAL_AFTER_IMG,
CAL_GET_9,
// binary
CAL_FIRST_BS_SET,
CAL_BS_CHK_SET, // 0
CAL_PKT_02, // 1
CAL_BEFORE_IMG, // 2
CAL_GET_IMG, // 3
CAL_AFTER_IMG, // 4
CAL_GET_9, // 5
CAL_BS_JUMP, // 6
CAL_BS_END, // 7
// check pictures.
CAL_PKT_15_0,
CAL_PKT_16_3C,
CAL_CHK_NEW_CONF,
CAL_PKT_02,
CAL_BEFORE_IMG,
CAL_GET_IMG,
CAL_AFTER_IMG,
CAL_GET_21,
// no image 14
CAL_NO_IMG_CAP_AREA,
CAL_NO_IMG_SET_0,
CAL_NO_IMG_03_1C,
CAL_NO_CHK_03_80,
CAL_NO_SET_03_80,
CAL_NO_IMG_14_BS_SET,
CAL_NO_IMG_14_BS_CHK_SET, // 0
CAL_NO_IMG_PRE_FIRST, // 1
CAL_NO_IMG_GET_8, // 2
CAL_NO_IMG_14_BS_JUMP, // 3
CAL_NO_IMG_14_BS_END, // 4
// no image 16
CAL_NO_IMG_16_BS_SET,
CAL_NO_IMG_16_BS_CHK_SET_15, // 0
CAL_NO_IMG_16_BS_SET_16, // 1
CAL_NO_IMG_PRE_FIRST, // 2
CAL_NO_IMG_GET_8, // 3
CAL_NO_IMG_16_BS_JUMP, // 4
CAL_NO_IMG_16_BS_END, // 5
// end
CAL_CONF_PKT,
CAL_CONF_PKT,
CAL_END,
};

View File

@@ -65,6 +65,7 @@ typedef struct
static const FpIdEntry id_table[] = {
{ .vid = 0x10A5, .pid = 0xFFE0, },
{ .vid = 0x10A5, .pid = 0xA305, },
{ .vid = 0x10A5, .pid = 0xA306, },
{ .vid = 0x10A5, .pid = 0xDA04, },
{ .vid = 0x10A5, .pid = 0xD805, },
{ .vid = 0x10A5, .pid = 0xD205, },
@@ -1638,6 +1639,7 @@ fpc_dev_probe (FpDevice *device)
{
case 0xFFE0:
case 0xA305:
case 0xA306:
case 0xD805:
case 0xDA04:
case 0xD205:

View File

@@ -1483,9 +1483,7 @@ gx_fp_exit_cb (FpiDeviceGoodixMoc *self,
gxfp_cmd_response_t *resp,
GError *error)
{
if (resp->result >= GX_FAILED)
if (resp && resp->result >= GX_FAILED)
fp_dbg ("Setting power button shield failed, result: 0x%x", resp->result);
self->is_power_button_shield_on = false;
gx_fp_release_interface (self, error);

View File

@@ -45,6 +45,8 @@ static const FpIdEntry id_table[] = {
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0x0106, },
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0x0107, },
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0x0108, },
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0x0109, },
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0x010A, },
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0x0123, },
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0x0124, },
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0x0126, },
@@ -55,6 +57,7 @@ static const FpIdEntry id_table[] = {
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0x0173, },
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0x0174, },
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0x019D, },
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0x019F, },
{ .vid = 0, .pid = 0, .driver_data = 0 }, /* terminating entry */
};
@@ -1254,6 +1257,12 @@ dev_probe (FpDevice *device)
return;
}
if (!g_usb_device_reset (usb_dev, &error))
{
fp_dbg ("%s g_usb_device_reset failed %s", G_STRFUNC, error->message);
goto err_close;
}
if (!g_usb_device_claim_interface (usb_dev, 0, 0, &error))
goto err_close;

View File

@@ -61,6 +61,7 @@ typedef struct
FpDeviceFeature features;
guint64 driver_data;
GVariant *persistent_data;
gint nr_enroll_stages;
GSList *sources;

View File

@@ -54,6 +54,7 @@ enum {
PROP_FPI_UDEV_DATA_SPIDEV,
PROP_FPI_UDEV_DATA_HIDRAW,
PROP_FPI_DRIVER_DATA,
PROP_FPI_PERSISTENT_DATA,
N_PROPS
};
@@ -235,6 +236,8 @@ fp_device_finalize (GObject *object)
g_clear_pointer (&priv->udev_data.spidev_path, g_free);
g_clear_pointer (&priv->udev_data.hidraw_path, g_free);
g_clear_pointer (&priv->persistent_data, g_variant_unref);
G_OBJECT_CLASS (fp_device_parent_class)->finalize (object);
}
@@ -304,6 +307,10 @@ fp_device_get_property (GObject *object,
g_value_set_string (value, NULL);
break;
case PROP_FPI_PERSISTENT_DATA:
g_value_set_variant (value, priv->persistent_data);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -354,6 +361,11 @@ fp_device_set_property (GObject *object,
priv->driver_data = g_value_get_uint64 (value);
break;
case PROP_FPI_PERSISTENT_DATA:
g_clear_pointer (&priv->persistent_data, g_variant_unref);
priv->persistent_data = g_value_dup_variant (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -594,6 +606,21 @@ fp_device_class_init (FpDeviceClass *klass)
0,
G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
/**
* FpDevice::fpi-persistent-data: (skip)
*
* This property is only for internal purposes.
*
* Stability: private
*/
properties[PROP_FPI_PERSISTENT_DATA] =
g_param_spec_variant ("fpi-persistent-data",
"Persistent Driver Data",
"Private: Previously stored data for the device",
G_VARIANT_TYPE_ANY,
NULL,
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE);
g_object_class_install_properties (object_class, N_PROPS, properties);
}
@@ -739,6 +766,139 @@ fp_device_get_temperature (FpDevice *device)
return priv->temp_current;
}
/**
* fp_device_get_persistent_data:
* @device: A #FpDevice
* @data: (array length=length) (transfer full) (out): Return location for data pointer
* @length: (transfer full) (out): Length of @data
* @error: Return location for error
*
* Retrieves persistent data that should be stored for this device. Storage
* needs to be device specific, i.e. device ID and driver must match when
* restored.
*
* Returns: (type void): %TRUE on success
*/
gboolean
fp_device_get_persistent_data (FpDevice *device,
guchar **data,
gsize *length,
GError **error)
{
g_autoptr(GVariant) res = NULL;
FpDevicePrivate *priv = fp_device_get_instance_private (device);
g_assert (data);
g_assert (length);
if (priv->persistent_data == NULL)
{
*data = NULL;
*length = 0;
return TRUE;
}
/* Version + variant from driver */
res = g_variant_new ("(issv)",
1,
fp_device_get_driver (device),
priv->device_id,
priv->persistent_data);
*length = g_variant_get_size (res);
*data = g_malloc (*length);
g_variant_store (res, *data);
return TRUE;
}
/**
* fp_device_get_persistent_data:
* @device: A #FpDevice
* @data: (array length=length) (transfer none): Persistent Data
* @length: (transfer none): Length of @data
* @error: Return location for error
*
* Load persistent data from storage. This function should be called after
* a device was discovered and before it is opened for the first time. It is
* an error to call it if data has already been set (or generated by the
* driver).
*
* Note that the driver may update the data. The API user should retrieve the
* value when done with the device and store it in a persistent location.
*
* Returns: (type void): %TRUE on success
*/
gboolean
fp_device_set_persistent_data (FpDevice *device,
guchar *data,
gsize length,
GError **error)
{
g_autoptr(GVariant) stored = NULL;
g_autoptr(GVariant) loaded = NULL;
FpDevicePrivate *priv = fp_device_get_instance_private (device);
guchar *copy;
gint version;
const gchar *device_id;
const gchar *driver;
if (priv->is_open)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
"Data can only be set right after device creation");
return FALSE;
}
if (priv->persistent_data)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_EXISTS,
"Data has already been set");
return FALSE;
}
if (length == 0)
{
g_clear_pointer (&priv->persistent_data, g_variant_unref);
g_object_notify_by_pspec (G_OBJECT (device), properties[PROP_FPI_PERSISTENT_DATA]);
return TRUE;
}
g_assert (data);
copy = g_memdup2 (data, length);
stored = g_variant_new_from_data (G_VARIANT_TYPE ("(issv)"), copy, length, FALSE, g_free, copy);
if (!stored)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
"Data could not be parsed");
return FALSE;
}
g_variant_get (stored, "(issv)", &version, &driver, &device_id, &loaded);
if (version != 1)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
"Unknown data storage version");
return FALSE;
}
if (g_strcmp0 (device_id, priv->device_id) != 0 ||
g_strcmp0 (driver, fp_device_get_driver (device)) != 0)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
"Driver or device ID mismatch!");
return FALSE;
}
g_clear_pointer (&priv->persistent_data, g_variant_unref);
priv->persistent_data = g_steal_pointer (&loaded);
g_object_notify_by_pspec (G_OBJECT (device), properties[PROP_FPI_PERSISTENT_DATA]);
return TRUE;
}
/**
* fp_device_supports_identify:
* @device: A #FpDevice

View File

@@ -233,6 +233,15 @@ FpDeviceFeature fp_device_get_features (FpDevice *device);
gboolean fp_device_has_feature (FpDevice *device,
FpDeviceFeature feature);
gboolean fp_device_get_persistent_data (FpDevice *device,
guchar **data,
gsize *length,
GError **error);
gboolean fp_device_set_persistent_data (FpDevice *device,
guchar *data,
gsize length,
GError **error);
/* Opening the device */
void fp_device_open (FpDevice *device,
GCancellable *cancellable,

View File

@@ -3,7 +3,7 @@ N: bus/usb/001/019=1201000200000040A510E0FF10000102000109021900010104A0320904000
E: DEVNAME=/dev/bus/usb/001/019
E: DEVTYPE=usb_device
E: DRIVER=usb
E: PRODUCT=10a5/ffe0/10
E: PRODUCT=10a5/a306/10
E: TYPE=0/0/0
E: BUSNUM=001
E: DEVNUM=019
@@ -13,11 +13,11 @@ E: SUBSYSTEM=usb
E: ID_VENDOR=FPC
E: ID_VENDOR_ENC=FPC
E: ID_VENDOR_ID=10a5
E: ID_MODEL=FPC_L:0001_FW:127010
E: ID_MODEL_ENC=FPC\x20L:0001\x20FW:127010
E: ID_MODEL_ID=ffe0
E: ID_MODEL=FPC_L:0001_FW:222709
E: ID_MODEL_ENC=FPC\x20L:0001\x20FW:222709
E: ID_MODEL_ID=a306
E: ID_REVISION=0010
E: ID_SERIAL=FPC_FPC_L:0001_FW:127010
E: ID_SERIAL=FPC_FPC_L:0001_FW:222709
E: ID_BUS=usb
E: ID_USB_INTERFACES=:ffffff:
E: ID_PATH=pci-0000:00:14.0-usb-0:1
@@ -45,7 +45,7 @@ A: devnum=19\n
A: devpath=1\n
L: driver=../../../../../bus/usb/drivers/usb
L: firmware_node=../../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:1c/device:1d/device:1e
A: idProduct=ffe0\n
A: idProduct=a306\n
A: idVendor=10a5\n
A: ltm_capable=no\n
A: manufacturer=FPC\n
@@ -74,7 +74,7 @@ A: power/wakeup_expire_count=\n
A: power/wakeup_last_time_ms=\n
A: power/wakeup_max_time_ms=\n
A: power/wakeup_total_time_ms=\n
A: product=FPC L:0001 FW:127010\n
A: product=FPC L:0001 FW:222709\n
A: quirks=0x0\n
A: removable=removable\n
A: rx_lanes=1\n

View File

@@ -262,6 +262,53 @@ test_device_identify_null_prints (void)
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_DATA_INVALID);
}
static void
test_device_persistent_data (void)
{
g_autoptr(FptContext) tctx = fpt_context_new_with_virtual_device (FPT_VIRTUAL_DEVICE_IMAGE);
g_autoptr(GVariant) initial = NULL;
g_autoptr(GVariant) loaded = NULL;
g_autoptr(GError) error = NULL;
guint8 *data = (guint8 *) 0xdeadbeef;
gsize length = 1;
initial = g_variant_ref_sink (g_variant_new ("(s)", "stored data"));
g_assert_true (fp_device_get_persistent_data (tctx->device, &data, &length, &error));
g_assert_cmpint (length, ==, 0);
g_assert_null (data);
g_assert_no_error (error);
/* Use the fact that this is a property that we can poke from the outside. */
g_object_set (tctx->device, "fpi-persistent-data", initial, NULL);
/* Works now */
g_assert_true (fp_device_get_persistent_data (tctx->device, &data, &length, &error));
g_assert_cmpint (length, !=, 0);
g_assert_nonnull (data);
g_assert_no_error (error);
/* We can't load the data, as data has been set already. */
g_assert_false (fp_device_set_persistent_data (tctx->device, data, length, &error));
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_EXISTS);
g_clear_pointer (&error, g_error_free);
/* Abuse that we can "load" again if the data is set to NULL.
* This is an implementation detail and just a lack of error checking. */
g_object_set (tctx->device, "fpi-persistent-data", NULL, NULL);
/* Incomplete data, causes parsing error */
g_assert_false (fp_device_set_persistent_data (tctx->device, data, 5, &error));
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA);
g_clear_pointer (&error, g_error_free);
g_assert_true (fp_device_set_persistent_data (tctx->device, data, length, &error));
g_assert_no_error (error);
g_object_get (tctx->device, "fpi-persistent-data", &loaded, NULL);
g_assert_cmpvariant (initial, loaded);
}
int
main (int argc, char *argv[])
{
@@ -284,6 +331,7 @@ main (int argc, char *argv[])
g_test_add_func ("/device/sync/has_storage", test_device_has_storage);
g_test_add_func ("/device/sync/identify/cancelled", test_device_identify_cancelled);
g_test_add_func ("/device/sync/identify/null-prints", test_device_identify_null_prints);
g_test_add_func ("/device/persistent_data", test_device_persistent_data);
return g_test_run ();
}