Skip to content

Instantly share code, notes, and snippets.

@serverwentdown
Last active November 7, 2022 05:59
Show Gist options
  • Save serverwentdown/3527d6473a5009d94b60031396b53511 to your computer and use it in GitHub Desktop.
Save serverwentdown/3527d6473a5009d94b60031396b53511 to your computer and use it in GitHub Desktop.
Clear fingerprint reader (Goodix, etc) fingerprints on Linux via direct libfprint calls.
// gcc `pkg-config --cflags --libs libfprint-2` -o fprint-clear fprint-clear.c
// compile, stop fprintd, run as root, start fprintd
#include <stdio.h>
#include <fprint.h>
int main() {
FpContext *ctx = fp_context_new ();
printf("Got context\n");
GPtrArray *devices = fp_context_get_devices (ctx);
printf("Got devices\n");
if (devices->len != 1) {
return 1;
}
FpDevice *dev = g_object_ref (g_ptr_array_index (devices, 0));
printf("Opening device 0\n");
if (!fp_device_open_sync(dev, NULL, NULL)) {
return 1;
}
g_autoptr(GError) clear_err = NULL;
printf("Clearing device 0\n");
if (!fp_device_clear_storage_sync(dev, NULL, &clear_err)) {
printf("Failed to clear storage before first enrollment: %s\n", clear_err->message);
}
printf("Done\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment