added utility script to find correct usb device for the fingerprint reader.

This commit is contained in:
Joseph Hanson 2024-09-08 18:02:17 -05:00
parent eb2f4aed00
commit a25ec4ae25
Signed by: jahanson
SSH key fingerprint: SHA256:vy6dKBECV522aPAwklFM3ReKAVB086rT3oWwiuiFG7o
2 changed files with 40 additions and 0 deletions

View file

@ -11,6 +11,7 @@
# ID 27c6:609c Shenzhen Goodix Technology Co.,Ltd
# On Framework 16 the USB is:
# Bus 005 Device 007: ID 27c6:609c Shenzhen Goodix Technology Co.,Ltd
# Use `findfp.sh` to find the correct USB device.
{ config, lib, pkgs, ... }:
let
cfg = config.mySystem.system.fingerprint-reader-on-laptop-lid;

View file

@ -0,0 +1,39 @@
#!/usr/bin/env bash
find_usb_device() {
local idVendor=$1
local idProduct=$2
local device_id="${idVendor}:${idProduct}"
for device in /sys/bus/usb/devices/*; do
if [ -f "$device/idVendor" ] && [ -f "$device/idProduct" ]; then
vendor=$(cat "$device/idVendor")
product=$(cat "$device/idProduct")
if [ "${vendor}:${product}" = "$device_id" ]; then
echo "$device"
return 0
fi
fi
done
return 1
}
# Example usage
idVendor="27c6"
idProduct="609c"
device_path=$(find_usb_device "$idVendor" "$idProduct")
if [ -n "$device_path" ]; then
echo "Device found at: $device_path"
# Print additional information
manufacturer=$(cat "$device_path/manufacturer" 2>/dev/null)
product=$(cat "$device_path/product" 2>/dev/null)
echo "Manufacturer: ${manufacturer:-N/A}"
echo "Product: ${product:-N/A}"
else
echo "Device not found"
fi