Skip to content
Open
22 changes: 22 additions & 0 deletions bin/omarchy-hw-fingerprint-tod
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# omarchy:summary=Returns true when the fingerprint reader present is a Goodix 53xc, which open libfprint cannot drive
# omarchy:hidden=true

# Goodix 27c6:530c / 533c / 538c readers (Dell machines) have no open-source
# driver — stock libfprint's goodixmoc table starts at 5840. Dell publishes a
# proprietary TOD plugin for Linux, packaged in the AUR as
# libfprint-goodix-53xc, whose compiled id table is exactly these three (the
# udev rule in that package also lists 5840, but the open driver covers it).
# Matching is by exact vid:pid, not vendor: nothing else from this vendor
# should be steered toward a closed blob when the open driver works.
tod_products=" 530c 533c 538c "
usb_devices_path="${OMARCHY_USB_DEVICES_PATH:-/sys/bus/usb/devices}"

for dev in "$usb_devices_path"/*; do
[[ -r $dev/idVendor && -r $dev/idProduct ]] || continue
[[ $(<"$dev/idVendor") == "27c6" ]] || continue
[[ $tod_products == *" $(<"$dev/idProduct") "* ]] && exit 0
done

exit 1
2 changes: 1 addition & 1 deletion bin/omarchy-remove-security-fingerprint
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ remove_resume_hook
sudo rm -rf -- "/var/lib/fprint/$fingerprint_user"

echo "Removing fingerprint packages..."
omarchy-pkg-drop fprintd libfprint libfprint-git
omarchy-pkg-drop fprintd libfprint libfprint-git libfprint-tod libfprint-goodix-53xc

echo -e "\e[32mFingerprint authentication and $fingerprint_user's local saved fingerprints have been removed.\e[0m"
93 changes: 91 additions & 2 deletions bin/omarchy-setup-security-fingerprint
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,64 @@ EOF
fi
}

# Only fprintd's own answer means no driver claimed the reader; a permission or
# D-Bus failure is left for enrollment to report rather than blamed on the driver.
fprintd_sees_no_device() {
[[ $(fprintd-list "$USER" 2>&1) == *"No devices available"* ]]
}

setup_goodix_tod_driver() {
# Goodix 53xc readers (Dell machines) have no open libfprint driver, so
# nothing claims the sensor and fprintd reports no devices. Dell ships a
# proprietary Linux one, repackaged in the AUR: the closed binary
# libfprint-goodix-53xc from Dell's Ubuntu archive, loaded through
# libfprint-tod — an open libfprint fork with a vendor-plugin interface.
# Closed source installs on a yes, not silently.
echo -e "\e[33m\nYour Goodix fingerprint reader has no open-source driver.\e[0m"
echo "Dell ships a proprietary one for Linux, packaged in the AUR as"
echo "libfprint-goodix-53xc (a closed binary from Dell's Ubuntu archive),"
echo "loaded on top of libfprint-tod (an open libfprint fork)."

if ! gum confirm --default=false "Install the proprietary Dell driver?"; then
echo -e "\e[31m\nFingerprint setup cannot continue without it. Aborting.\e[0m"
exit 1
fi

# libfprint-tod provides+conflicts libfprint, so whichever open provider is
# installed — stock libfprint or libfprint-git — has to go first, or the AUR
# install answers the conflict prompt with N and aborts. pacman -Qq resolves
# provides, so match the exact package name before removing it. Deps-only
# keeps an installed fprintd in place.
local removed=()
for provider in libfprint libfprint-git; do
if pacman -Qq -- "$provider" 2>/dev/null | grep -Fxq -- "$provider"; then
sudo pacman -Rdd --noconfirm "$provider"
removed+=("$provider")
fi
done
if ! omarchy-pkg-aur-add libfprint-tod libfprint-goodix-53xc; then
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
# Put the open provider back so a failed build does not leave fprintd
# without libfprint; --ask 4 replaces libfprint-tod if it got that far.
if (( ${#removed[@]} > 0 )); then
sudo pacman -S --noconfirm --ask 4 -- "${removed[@]}"
fi
exit 1
fi

# fprintd loads TOD plugins when libfprint initializes, and the driver
# installs a udev rule for the reader. Reload the rules and stop the daemon
# (it dbus-activates fresh on the next call) so the new driver is claimed.
sudo udevadm control --reload-rules
sudo udevadm trigger
sudo systemctl stop fprintd 2>/dev/null || true

if fprintd_sees_no_device; then
echo -e "\e[31m\nThe driver is installed, but fprintd still sees no devices.\e[0m"
echo "The reader sometimes needs a reboot before it answers a new driver."
exit 1
fi
}

echo -e "\e[32mSetting up fingerprint scanner for authentication.\n\e[0m"

# Bail before installing anything if there's no reader to talk to.
Expand All @@ -68,14 +126,45 @@ fi
# needs a pin bump in omarchy-pkgs. It conflicts with stock libfprint, and
# --noconfirm answers that prompt with N; --ask 4 accepts the replacement in
# one transaction, so a failed install leaves the existing driver in place.
if omarchy-pkg-missing libfprint-git fprintd usbutils; then
#
# libfprint-tod provides libfprint too, so a re-run after the Goodix setup
# below must not pull the open driver back in and fight the replacement.
# fprintd and usbutils are ensured either way — the fork provides libfprint,
# not them.
if pacman -Q libfprint-tod &>/dev/null; then
omarchy-pkg-add fprintd usbutils
elif omarchy-pkg-missing libfprint-git fprintd usbutils; then
echo "Installing required packages..."
sudo pacman -S --needed --noconfirm --ask 4 -- libfprint-git fprintd usbutils
fi

# Hardware detection proves a reader exists, not that libfprint can drive
# it — a reader no open driver claims never reaches fprintd, and enrollment
# dies instantly on "No devices available" with nothing pointing at the
# real problem. Ask fprintd before putting a finger on glass, and route
# Goodix 53xc readers to Dell's proprietary driver.
if fprintd_sees_no_device; then
if omarchy-hw-fingerprint-tod; then
setup_goodix_tod_driver
else
echo -e "\e[31m\nNo installed driver supports your fingerprint reader.\e[0m"
echo "The sensor is connected, but fprintd reports no devices, so open"
echo "libfprint has no driver for it. Check whether your reader's USB id"
echo "is listed at https://fprint.freedesktop.org/supported-devices.html"
exit 1
fi
fi

# Enroll first fingerprint
echo -e "\e[32m\nLet's setup your right index finger as the first fingerprint.\e[0m"
echo -e "Keep moving the finger around on sensor until the process completes.\n"
# The 53xc on Dell's driver is a press sensor, not a swipe sensor — the hint
# has to match or users scrub a finger it wants held still. Derived from the
# installed package, not this run's path, so it holds on every re-run too.
if pacman -Q libfprint-goodix-53xc &>/dev/null; then
echo -e "This is a press sensor: lay your finger flat and hold it until each stage completes.\n"
else
echo -e "Keep moving the finger around on sensor until the process completes.\n"
fi

if sudo fprintd-enroll "$USER"; then
echo -e "\e[32m\nFingerprint enrolled successfully!\e[0m"
Expand Down
2 changes: 2 additions & 0 deletions manual/37-hardware-authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ A lot of laptops come with a fingerprint sensor to do authentication. You can us

That'll install the fingerprint package, collect your print, verify it, and you'll be set to go using your fingerprint to unlock from the lock screen (which you can trigger with `Super + Ctrl + L`), enter sudo mode, and authorize system prompts.

Some Goodix readers found in Dell laptops (the 53xc family) have no open-source driver, so nothing in the stock fingerprint stack can talk to them. When setup detects one of those, it explains the situation and offers to install the proprietary driver Dell ships for Linux. That driver is closed source, which is why Omarchy asks before installing it. These sensors also read a finger that is pressed onto them rather than swiped: lay your finger flat and hold it still until each enrollment stage completes, and give the sensor a break if it reports that it has disabled itself to prevent overheating.

When your laptop lid is closed, the fingerprint prompt is automatically skipped, so you go straight to the password prompt instead of waiting on a sensor you can't reach. If you otherwise need to work on an external keyboard that doesn't have a sensor, just hit `CTRL + C`, when you're prompted for your fingerprint during `sudo`.

You can remove the fingerprint authentication under _Remove > Security > Fingerprint_ in the Omarchy menu.
Expand Down
33 changes: 32 additions & 1 deletion test/shell.d/fingerprint-package-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#
# The fingerprint setup installs libfprint-git in place of stock libfprint. The
# two conflict, so the swap has to happen inside one --ask 4 transaction, and a
# rerun with everything installed must not touch pacman at all. The real
# rerun with everything installed must not touch pacman at all. It only reaches
# enrollment once fprintd has claimed the reader, and a driverless reader is
# reported rather than sending the user into a doomed enroll. The real
# omarchy-pkg-missing runs; pacman and the privileged calls are stubbed.

set -euo pipefail
Expand All @@ -19,6 +21,10 @@ cat > "$scratch/bin/omarchy-hw-fingerprint" <<'STUB'
#!/bin/bash
exit "${HARDWARE_STATUS:-0}"
STUB
cat > "$scratch/bin/omarchy-hw-fingerprint-tod" <<'STUB'
#!/bin/bash
exit "${TOD_STATUS:-1}"
STUB
cat > "$scratch/bin/sudo" <<'STUB'
#!/bin/bash
case "$1" in
Expand Down Expand Up @@ -53,6 +59,13 @@ cat > "$scratch/bin/fprintd-enroll" <<'STUB'
echo enroll >> "$CALL_LOG"
exit "${ENROLL_STATUS:-1}"
STUB
# DRIVER_STATUS stands in for whether any installed driver claimed the reader;
# DRIVER_OUTPUT is what fprintd said when it did not.
cat > "$scratch/bin/fprintd-list" <<'STUB'
#!/bin/bash
(( ${DRIVER_STATUS:-0} == 0 )) || echo "${DRIVER_OUTPUT:-No devices available}"
exit "${DRIVER_STATUS:-0}"
STUB
cat > "$scratch/bin/fprintd-verify" <<'STUB'
#!/bin/bash
echo verify >> "$CALL_LOG"
Expand Down Expand Up @@ -111,6 +124,24 @@ if grep -qx enroll "$CALL_LOG"; then
fi
pass "a failed installation stops before enrollment"

# A connected reader that no driver claims must not fall through to a doomed
# enroll; non-53xc hardware gets the actionable message instead.
DRIVER_STATUS=1 TOD_STATUS=1 run_setup
grep -q 'No installed driver supports' "$scratch/output" || fail "a driverless reader reports the problem"
if grep -qx enroll "$CALL_LOG"; then
fail "a driverless reader does not attempt enrollment"
fi
pass "a driverless reader is reported instead of enrolling"

# Any other fprintd-list failure says nothing about the driver, so it is left
# for enrollment to report, as it was before the pre-flight.
DRIVER_STATUS=1 DRIVER_OUTPUT='ListEnrolledFingers failed: Not Authorized' TOD_STATUS=0 run_setup
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
grep -qx enroll "$CALL_LOG" || fail "a non-device fprintd failure still reaches enrollment"
if grep -q 'no open-source driver\|No installed driver supports' "$scratch/output"; then
fail "a non-device fprintd failure is not blamed on the driver"
fi
pass "a non-device fprintd failure is not blamed on the driver"

HARDWARE_STATUS=1 run_setup
[[ ! -s $CALL_LOG ]] || fail "missing hardware stops before package operations"
pass "missing hardware performs no package operations"
Expand Down
80 changes: 80 additions & 0 deletions test/shell.d/hw-fingerprint-tod-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/bash

set -euo pipefail

source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"

tmp_dir=$(mktemp -d)
trap 'rm -rf "$tmp_dir"' EXIT

write_usb_devices() {
rm -rf "$tmp_dir/devices"
mkdir -p "$tmp_dir/devices"

local index=0
local spec
for spec in "$@"; do
local vendor=${spec%%:*}
local product=${spec#*:}
local dev="$tmp_dir/devices/1-$index"

mkdir -p "$dev"
printf '%s\n' "$vendor" >"$dev/idVendor"
printf '%s\n' "$product" >"$dev/idProduct"
index=$((index + 1))
done
}

hw_fingerprint_tod() {
OMARCHY_USB_DEVICES_PATH="$tmp_dir/devices" "$ROOT/bin/omarchy-hw-fingerprint-tod"
}

assert_needs_tod() {
local description="$1"

hw_fingerprint_tod || fail "$description"
pass "$description"
}

assert_open_driver() {
local description="$1"

if hw_fingerprint_tod; then
fail "$description"
fi
pass "$description"
}

write_usb_devices '27c6:530c'
assert_needs_tod "a Goodix 530c is flagged for the proprietary driver"

write_usb_devices '27c6:533c'
assert_needs_tod "a Goodix 533c is flagged for the proprietary driver"

write_usb_devices '27c6:538c'
assert_needs_tod "a Goodix 538c is flagged for the proprietary driver"

# The open goodixmoc driver covers 5840 and up, so those must not be steered
# toward the closed blob.
write_usb_devices '27c6:5840'
assert_open_driver "a Goodix 5840 stays on the open driver"

write_usb_devices '27c6:6014'
assert_open_driver "a Goodix 6014 stays on the open driver"

write_usb_devices '27c6:9999'
assert_open_driver "an unknown Goodix product is not flagged"

write_usb_devices '138a:530c'
assert_open_driver "another vendor's 530c product id is not flagged"

# Real sysfs device directories can lack attribute files; a missing vendor
# attribute must be skipped rather than misread as a non-match on another
# field.
rm -rf "$tmp_dir/devices"
mkdir -p "$tmp_dir/devices/1-0"
printf '530c\n' >"$tmp_dir/devices/1-0/idProduct"
assert_open_driver "a device missing its vendor attribute is skipped"

write_usb_devices
assert_open_driver "a machine with no USB devices is not flagged"
2 changes: 1 addition & 1 deletion test/shell.d/security-fingerprint-remove-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ run_remove || fail "direct user removal succeeds" "$(cat "$output")"
fail "only the invoking user's local files are deleted"
grep -Fxq 'id -un' "$log" || fail "direct user is resolved through id"
grep -Fq "sudo rm -rf -- $test_tmp/fprint/alice" "$log" || fail "deletion precedes package drop"
[[ $(tail -n 1 "$log") == 'package fprintd libfprint libfprint-git' ]] || fail "packages drop after deletion"
[[ $(tail -n 1 "$log") == 'package fprintd libfprint libfprint-git libfprint-tod libfprint-goodix-53xc' ]] || fail "packages drop after deletion"
grep -Fq "alice's local saved fingerprints have been removed" "$output" || fail "success describes local saved files"
pass "direct user ignores spoofed USER and leaves other accounts alone"

Expand Down