Skip to content

Instantly share code, notes, and snippets.

@rmtsrc
Last active March 31, 2024 05:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmtsrc/80e41c9c6e23c765142f0d6d1a9817d8 to your computer and use it in GitHub Desktop.
Save rmtsrc/80e41c9c6e23c765142f0d6d1a9817d8 to your computer and use it in GitHub Desktop.
Remove existing fingerprints from Goodix BIOS via libfprint

Install

Fixes issue with Goodix fingerprint reader when a fingerprint has already been enrolled in the BIOS, but then the OS has been removed (without un-enrolling the fingerprint first). I.e. fprintd device reported an error during enrol: Finger is too similar to another, try use a different finger

sudo pamac install base-devel meson gobject-introspection gtk-doc

git clone https://gitlab.freedesktop.org/libfprint/libfprint.git

cd libfprint

git apply ../libfprint.patch

mkdir build
cd build
meson -Dprefix=/usr ..
ninja
ninja install

sudo systemctl restart fprintd.service

fprintd-enrol # An error will be shown enrolling for the first attempt, but subsequent enrolments should work

Debug

sudo systemctl edit fprintd.service

[Service]
Environment=G_MESSAGES_DEBUG=all

sudo systemctl restart fprintd.service

journalctl -u fprintd -f

diff --git a/libfprint/drivers/goodixmoc/goodix.c b/libfprint/drivers/goodixmoc/goodix.c
index d012d46..3078566 100644
--- a/libfprint/drivers/goodixmoc/goodix.c
+++ b/libfprint/drivers/goodixmoc/goodix.c
@@ -73,6 +73,11 @@ typedef struct
SynCmdMsgCallback callback;
} CommandData;
+static inline void delete_all_callback()
+{
+ g_debug ("delete all -- callback fired - all fingerprints deleted");
+}
+
static gboolean parse_print_data (GVariant *data,
guint8 *finger,
const guint8 **tid,
@@ -634,6 +639,16 @@ fp_enroll_identify_cb (FpiDeviceGoodixMoc *self,
}
if (resp->verify.match)
{
+ g_debug ("delete all -- sending command");
+
+ goodix_sensor_cmd (self, MOC_CMD0_DELETETEMPLATE, MOC_CMD1_DELETE_ALL,
+ false,
+ NULL,
+ 0,
+ delete_all_callback);
+
+ g_debug ("delete all -- command triggered");
+
fpi_ssm_mark_failed (self->task_ssm,
fpi_device_error_new_msg (FP_DEVICE_ERROR_DATA_DUPLICATE,
"Finger is too similar to another, try use a different finger"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment