Last active
November 7, 2022 05:59
-
-
Save serverwentdown/3527d6473a5009d94b60031396b53511 to your computer and use it in GitHub Desktop.
Clear fingerprint reader (Goodix, etc) fingerprints on Linux via direct libfprint calls.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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