# Shenzhen Goodix FingerPrint (27c6:538d)
## Requirements
* python >= 3.8
* pip3
* meson
* ninja
* git
## Installation
### Flash the firmware
Flash the firmware of the sensor with an earlier version.
```bash
pip3 install pyusb crcmod
git clone --recurse-submodules https://github.com/mpi3d/goodix-fp-dump.git
cd goodix-fp-dump
sudo python3 run_538d.py
```
### Installing libfprint
libfprint is the component which talks to fingerprint reading devices, and process fingerprint data.
Install required packages
```bash
# Arch/Manjaro
yes | sudo pacman -S pam_wrapper gobject-introspection
# Debian/Ubuntu
sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y libpam-wrapper \
libglib2.0-dev libgusb-dev libgirepository1.0-dev \
libcairo2-dev libssl-dev libgudev-1.0-dev udev gtk-doc-tools
```
Compile and install libfprint
```bash
pip3 install python-dbusmock
cd -
git clone -b unstable --single-branch https://github.com/Infinytum/libfprint.git
cd libfprint
meson setup --prefix /usr --libexecdir lib \
--sbindir bin --buildtype plain \
--auto-features enabled --wrap-mode nodownload \
-D b_lto=true -D b_pie=true \
build
ninja -C build
sudo meson install -C build
```
### Installing fprintd
fprintd is a daemon that provides fingerprint scanning functionality over D-Bus.
```bash
cd -
git clone https://gitlab.freedesktop.org/libfprint/fprintd.git
cd fprintd
meson setup --prefix /usr --libexecdir lib \
--sbindir bin --buildtype plain \
--auto-features enabled --wrap-mode nodownload \
-D b_lto=true -D b_pie=true \
build
ninja -C build
sudo meson install -C build
sudo systemctl start fprintd
```
## Troubleshooting
**Timeout error in firmware flashing process**
1. Compile the code with
```bash
gcc usbreset.c -o usbreset
```
2. Find the usb address of the reader. Look specifically at the "bus" and "device" fields.
```bash
lsusb | grep FingerPrint
```
3. Run the command bellow substituting <bus> and <device> with the values from the last command.
```bash
sudo ./usbreset /dev/bus/usb/<bus>/<device>
```
Example,
```bash
sudo ./usbreset /dev/bus/usb/003/002
```
## References
* https://bestofcpp.com/repo/knauth-goodix-521d-explanation