added utility script to find correct usb device for the fingerprint reader.
This commit is contained in:
parent
eb2f4aed00
commit
a25ec4ae25
2 changed files with 40 additions and 0 deletions
|
@ -11,6 +11,7 @@
|
||||||
# ID 27c6:609c Shenzhen Goodix Technology Co.,Ltd
|
# ID 27c6:609c Shenzhen Goodix Technology Co.,Ltd
|
||||||
# On Framework 16 the USB is:
|
# On Framework 16 the USB is:
|
||||||
# Bus 005 Device 007: ID 27c6:609c Shenzhen Goodix Technology Co.,Ltd
|
# Bus 005 Device 007: ID 27c6:609c Shenzhen Goodix Technology Co.,Ltd
|
||||||
|
# Use `findfp.sh` to find the correct USB device.
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.mySystem.system.fingerprint-reader-on-laptop-lid;
|
cfg = config.mySystem.system.fingerprint-reader-on-laptop-lid;
|
||||||
|
|
39
nixos/modules/nixos/system/fingerprint-reader-on-laptop-lid/findfp.sh
Executable file
39
nixos/modules/nixos/system/fingerprint-reader-on-laptop-lid/findfp.sh
Executable 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
|
Loading…
Reference in a new issue